| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.sdk.io; | 4 library engine.sdk.io; |
| 5 | 5 |
| 6 import 'java_core.dart'; | 6 import 'java_core.dart'; |
| 7 import 'java_io.dart'; | 7 import 'java_io.dart'; |
| 8 import 'java_engine_io.dart'; | 8 import 'java_engine_io.dart'; |
| 9 import 'source_io.dart'; | 9 import 'source_io.dart'; |
| 10 import 'error.dart'; | 10 import 'error.dart'; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 */ | 22 */ |
| 23 class DirectoryBasedDartSdk implements DartSdk { | 23 class DirectoryBasedDartSdk implements DartSdk { |
| 24 /** | 24 /** |
| 25 * The [AnalysisContext] which is used for all of the sources in this [DartSdk
]. | 25 * The [AnalysisContext] which is used for all of the sources in this [DartSdk
]. |
| 26 */ | 26 */ |
| 27 InternalAnalysisContext _analysisContext; | 27 InternalAnalysisContext _analysisContext; |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * The directory containing the SDK. | 30 * The directory containing the SDK. |
| 31 */ | 31 */ |
| 32 JavaFile directory; | 32 JavaFile _sdkDirectory; |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * The revision number of this SDK, or `"0"` if the revision number cannot be
discovered. | 35 * The revision number of this SDK, or `"0"` if the revision number cannot be
discovered. |
| 36 */ | 36 */ |
| 37 String _sdkVersion; | 37 String _sdkVersion; |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * The file containing the Dartium executable. | 40 * The file containing the Dartium executable. |
| 41 */ | 41 */ |
| 42 JavaFile _dartiumExecutable; | 42 JavaFile _dartiumExecutable; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 166 } |
| 167 return sdkDirectory; | 167 return sdkDirectory; |
| 168 } | 168 } |
| 169 | 169 |
| 170 /** | 170 /** |
| 171 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. | 171 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. |
| 172 * | 172 * |
| 173 * @param sdkDirectory the directory containing the SDK | 173 * @param sdkDirectory the directory containing the SDK |
| 174 */ | 174 */ |
| 175 DirectoryBasedDartSdk(JavaFile sdkDirectory) { | 175 DirectoryBasedDartSdk(JavaFile sdkDirectory) { |
| 176 this.directory = sdkDirectory.getAbsoluteFile(); | 176 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); |
| 177 initializeSdk(); | 177 initializeSdk(); |
| 178 initializeLibraryMap(); | 178 initializeLibraryMap(); |
| 179 _analysisContext = new AnalysisContextImpl(); | 179 _analysisContext = new AnalysisContextImpl(); |
| 180 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); | 180 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); |
| 181 List<String> uris = this.uris; | 181 List<String> uris = this.uris; |
| 182 ChangeSet changeSet = new ChangeSet(); | 182 ChangeSet changeSet = new ChangeSet(); |
| 183 for (String uri in uris) { | 183 for (String uri in uris) { |
| 184 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); | 184 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); |
| 185 } | 185 } |
| 186 _analysisContext.applyChanges(changeSet); | 186 _analysisContext.applyChanges(changeSet); |
| 187 } | 187 } |
| 188 | 188 |
| 189 /** | 189 /** |
| 190 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. | 190 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. |
| 191 * | 191 * |
| 192 * Added in order to test AnalysisContextImpl2. | 192 * Added in order to test AnalysisContextImpl2. |
| 193 * | 193 * |
| 194 * @param sdkDirectory the directory containing the SDK | 194 * @param sdkDirectory the directory containing the SDK |
| 195 */ | 195 */ |
| 196 DirectoryBasedDartSdk.con1(JavaFile sdkDirectory, bool ignored) { | 196 DirectoryBasedDartSdk.con1(JavaFile sdkDirectory, bool ignored) { |
| 197 this.directory = sdkDirectory.getAbsoluteFile(); | 197 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); |
| 198 initializeSdk(); | 198 initializeSdk(); |
| 199 initializeLibraryMap(); | 199 initializeLibraryMap(); |
| 200 _analysisContext = new AnalysisContextImpl(); | 200 _analysisContext = new AnalysisContextImpl(); |
| 201 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); | 201 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); |
| 202 List<String> uris = this.uris; | 202 List<String> uris = this.uris; |
| 203 ChangeSet changeSet = new ChangeSet(); | 203 ChangeSet changeSet = new ChangeSet(); |
| 204 for (String uri in uris) { | 204 for (String uri in uris) { |
| 205 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); | 205 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); |
| 206 } | 206 } |
| 207 _analysisContext.applyChanges(changeSet); | 207 _analysisContext.applyChanges(changeSet); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 227 } | 227 } |
| 228 return _dartiumExecutable; | 228 return _dartiumExecutable; |
| 229 } | 229 } |
| 230 | 230 |
| 231 /** | 231 /** |
| 232 * Return the directory where dartium can be found in the Dart SDK (the direct
ory that will be the | 232 * Return the directory where dartium can be found in the Dart SDK (the direct
ory that will be the |
| 233 * working directory is Dartium is invoked without changing the default). | 233 * working directory is Dartium is invoked without changing the default). |
| 234 * | 234 * |
| 235 * @return the directory where dartium can be found | 235 * @return the directory where dartium can be found |
| 236 */ | 236 */ |
| 237 JavaFile get dartiumWorkingDirectory => new JavaFile.relative(directory.getPar
entFile(), _CHROMIUM_DIRECTORY_NAME); | 237 JavaFile get dartiumWorkingDirectory => new JavaFile.relative(_sdkDirectory.ge
tParentFile(), _CHROMIUM_DIRECTORY_NAME); |
| 238 |
| 239 /** |
| 240 * Return the directory containing the SDK. |
| 241 * |
| 242 * @return the directory containing the SDK |
| 243 */ |
| 244 JavaFile get directory => _sdkDirectory; |
| 238 | 245 |
| 239 /** | 246 /** |
| 240 * Return the directory containing documentation for the SDK. | 247 * Return the directory containing documentation for the SDK. |
| 241 * | 248 * |
| 242 * @return the SDK's documentation directory | 249 * @return the SDK's documentation directory |
| 243 */ | 250 */ |
| 244 JavaFile get docDirectory => new JavaFile.relative(directory, _DOCS_DIRECTORY_
NAME); | 251 JavaFile get docDirectory => new JavaFile.relative(_sdkDirectory, _DOCS_DIRECT
ORY_NAME); |
| 245 | 252 |
| 246 /** | 253 /** |
| 247 * Return the auxiliary documentation file for the given library, or `null` if
no such file | 254 * Return the auxiliary documentation file for the given library, or `null` if
no such file |
| 248 * exists. | 255 * exists. |
| 249 * | 256 * |
| 250 * @param libraryName the name of the library associated with the documentatio
n file to be | 257 * @param libraryName the name of the library associated with the documentatio
n file to be |
| 251 * returned | 258 * returned |
| 252 * @return the auxiliary documentation file for the library | 259 * @return the auxiliary documentation file for the library |
| 253 */ | 260 */ |
| 254 JavaFile getDocFileFor(String libraryName) { | 261 JavaFile getDocFileFor(String libraryName) { |
| 255 JavaFile dir = docDirectory; | 262 JavaFile dir = docDirectory; |
| 256 if (!dir.exists()) { | 263 if (!dir.exists()) { |
| 257 return null; | 264 return null; |
| 258 } | 265 } |
| 259 JavaFile libDir = new JavaFile.relative(dir, libraryName); | 266 JavaFile libDir = new JavaFile.relative(dir, libraryName); |
| 260 JavaFile docFile = new JavaFile.relative(libDir, "${libraryName}${_DOC_FILE_
SUFFIX}"); | 267 JavaFile docFile = new JavaFile.relative(libDir, "${libraryName}${_DOC_FILE_
SUFFIX}"); |
| 261 if (docFile.exists()) { | 268 if (docFile.exists()) { |
| 262 return docFile; | 269 return docFile; |
| 263 } | 270 } |
| 264 return null; | 271 return null; |
| 265 } | 272 } |
| 266 | 273 |
| 267 /** | 274 /** |
| 268 * Return the directory within the SDK directory that contains the libraries. | 275 * Return the directory within the SDK directory that contains the libraries. |
| 269 * | 276 * |
| 270 * @return the directory that contains the libraries | 277 * @return the directory that contains the libraries |
| 271 */ | 278 */ |
| 272 JavaFile get libraryDirectory => new JavaFile.relative(directory, _LIB_DIRECTO
RY_NAME); | 279 JavaFile get libraryDirectory => new JavaFile.relative(_sdkDirectory, _LIB_DIR
ECTORY_NAME); |
| 273 | 280 |
| 274 /** | 281 /** |
| 275 * Return the file containing the Pub executable, or `null` if it does not exi
st. | 282 * Return the file containing the Pub executable, or `null` if it does not exi
st. |
| 276 * | 283 * |
| 277 * @return the file containing the Pub executable | 284 * @return the file containing the Pub executable |
| 278 */ | 285 */ |
| 279 JavaFile get pubExecutable { | 286 JavaFile get pubExecutable { |
| 280 String pubBinaryName = OSUtilities.isWindows() ? _PUB_EXECUTABLE_NAME_WIN :
_PUB_EXECUTABLE_NAME; | 287 String pubBinaryName = OSUtilities.isWindows() ? _PUB_EXECUTABLE_NAME_WIN :
_PUB_EXECUTABLE_NAME; |
| 281 JavaFile file = new JavaFile.relative(new JavaFile.relative(directory, _BIN_
DIRECTORY_NAME), pubBinaryName); | 288 JavaFile file = new JavaFile.relative(new JavaFile.relative(_sdkDirectory, _
BIN_DIRECTORY_NAME), pubBinaryName); |
| 282 return file.exists() ? file : null; | 289 return file.exists() ? file : null; |
| 283 } | 290 } |
| 284 | 291 |
| 285 List<SdkLibrary> get sdkLibraries => _libraryMap.sdkLibraries; | 292 List<SdkLibrary> get sdkLibraries => _libraryMap.sdkLibraries; |
| 286 | 293 |
| 287 SdkLibrary getSdkLibrary(String dartUri) => _libraryMap.getLibrary(dartUri); | 294 SdkLibrary getSdkLibrary(String dartUri) => _libraryMap.getLibrary(dartUri); |
| 288 | 295 |
| 289 /** | 296 /** |
| 290 * Return the revision number of this SDK, or `"0"` if the revision number can
not be | 297 * Return the revision number of this SDK, or `"0"` if the revision number can
not be |
| 291 * discovered. | 298 * discovered. |
| 292 * | 299 * |
| 293 * @return the revision number of this SDK | 300 * @return the revision number of this SDK |
| 294 */ | 301 */ |
| 295 String get sdkVersion { | 302 String get sdkVersion { |
| 296 { | 303 { |
| 297 if (_sdkVersion == null) { | 304 if (_sdkVersion == null) { |
| 298 _sdkVersion = DartSdk.DEFAULT_VERSION; | 305 _sdkVersion = DartSdk.DEFAULT_VERSION; |
| 299 JavaFile revisionFile = new JavaFile.relative(directory, _REVISION_FILE_
NAME); | 306 JavaFile revisionFile = new JavaFile.relative(_sdkDirectory, _REVISION_F
ILE_NAME); |
| 300 try { | 307 try { |
| 301 String revision = revisionFile.readAsStringSync(); | 308 String revision = revisionFile.readAsStringSync(); |
| 302 if (revision != null) { | 309 if (revision != null) { |
| 303 _sdkVersion = revision; | 310 _sdkVersion = revision; |
| 304 } | 311 } |
| 305 } on JavaIOException catch (exception) { | 312 } on JavaIOException catch (exception) { |
| 306 } | 313 } |
| 307 } | 314 } |
| 308 } | 315 } |
| 309 return _sdkVersion; | 316 return _sdkVersion; |
| 310 } | 317 } |
| 311 | 318 |
| 312 /** | 319 /** |
| 313 * Return an array containing the library URI's for the libraries defined in t
his SDK. | 320 * Return an array containing the library URI's for the libraries defined in t
his SDK. |
| 314 * | 321 * |
| 315 * @return the library URI's for the libraries defined in this SDK | 322 * @return the library URI's for the libraries defined in this SDK |
| 316 */ | 323 */ |
| 317 List<String> get uris => _libraryMap.uris; | 324 List<String> get uris => _libraryMap.uris; |
| 318 | 325 |
| 319 /** | 326 /** |
| 320 * Return the file containing the VM executable, or `null` if it does not exis
t. | 327 * Return the file containing the VM executable, or `null` if it does not exis
t. |
| 321 * | 328 * |
| 322 * @return the file containing the VM executable | 329 * @return the file containing the VM executable |
| 323 */ | 330 */ |
| 324 JavaFile get vmExecutable { | 331 JavaFile get vmExecutable { |
| 325 { | 332 { |
| 326 if (_vmExecutable == null) { | 333 if (_vmExecutable == null) { |
| 327 JavaFile file = new JavaFile.relative(new JavaFile.relative(directory, _
BIN_DIRECTORY_NAME), vmBinaryName); | 334 JavaFile file = new JavaFile.relative(new JavaFile.relative(_sdkDirector
y, _BIN_DIRECTORY_NAME), vmBinaryName); |
| 328 if (file.exists()) { | 335 if (file.exists()) { |
| 329 _vmExecutable = file; | 336 _vmExecutable = file; |
| 330 } | 337 } |
| 331 } | 338 } |
| 332 } | 339 } |
| 333 return _vmExecutable; | 340 return _vmExecutable; |
| 334 } | 341 } |
| 335 | 342 |
| 336 /** | 343 /** |
| 337 * Return `true` if this SDK includes documentation. | 344 * Return `true` if this SDK includes documentation. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } | 539 } |
| 533 } | 540 } |
| 534 } | 541 } |
| 535 } | 542 } |
| 536 } | 543 } |
| 537 librariesMap.setLibrary(libraryName, library); | 544 librariesMap.setLibrary(libraryName, library); |
| 538 } | 545 } |
| 539 return null; | 546 return null; |
| 540 } | 547 } |
| 541 } | 548 } |
| OLD | NEW |