OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.sdk.io; | 8 library engine.sdk.io; |
9 | 9 |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 static String _DOCS_DIRECTORY_NAME = "docs"; | 96 static String _DOCS_DIRECTORY_NAME = "docs"; |
97 | 97 |
98 /** | 98 /** |
99 * The suffix added to the name of a library to derive the name of the file | 99 * The suffix added to the name of a library to derive the name of the file |
100 * containing the documentation for that library. | 100 * containing the documentation for that library. |
101 */ | 101 */ |
102 static String _DOC_FILE_SUFFIX = "_api.json"; | 102 static String _DOC_FILE_SUFFIX = "_api.json"; |
103 | 103 |
104 /** | 104 /** |
105 * The name of the directory within the SDK directory that contains the | 105 * The name of the directory within the SDK directory that contains the |
106 * libraries file. | 106 * sdk_library_metadata directory. |
107 */ | 107 */ |
108 static String _INTERNAL_DIR = "_internal"; | 108 static String _INTERNAL_DIR = "_internal"; |
109 | 109 |
110 /** | 110 /** |
| 111 * The name of the sdk_library_metadata directory that contains the package |
| 112 * holding the libraries.dart file. |
| 113 */ |
| 114 static String _SDK_LIBRARY_METADATA_DIR = "sdk_library_metadata"; |
| 115 |
| 116 /** |
| 117 * The name of the directory within the sdk_library_metadata that contains |
| 118 * libraries.dart. |
| 119 */ |
| 120 static String _SDK_LIBRARY_METADATA_LIB_DIR = "lib"; |
| 121 |
| 122 /** |
111 * The name of the directory within the SDK directory that contains the | 123 * The name of the directory within the SDK directory that contains the |
112 * libraries. | 124 * libraries. |
113 */ | 125 */ |
114 static String _LIB_DIRECTORY_NAME = "lib"; | 126 static String _LIB_DIRECTORY_NAME = "lib"; |
115 | 127 |
116 /** | 128 /** |
117 * The name of the libraries file. | 129 * The name of the libraries file. |
118 */ | 130 */ |
119 static String _LIBRARIES_FILE = "libraries.dart"; | 131 static String _LIBRARIES_FILE = "libraries.dart"; |
120 | 132 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 @override | 468 @override |
457 SdkLibrary getSdkLibrary(String dartUri) => _libraryMap.getLibrary(dartUri); | 469 SdkLibrary getSdkLibrary(String dartUri) => _libraryMap.getLibrary(dartUri); |
458 | 470 |
459 /** | 471 /** |
460 * Read all of the configuration files to initialize the library maps. The | 472 * Read all of the configuration files to initialize the library maps. The |
461 * flag [useDart2jsPaths] is `true` if the dart2js path should be used when it | 473 * flag [useDart2jsPaths] is `true` if the dart2js path should be used when it |
462 * is available. Return the initialized library map. | 474 * is available. Return the initialized library map. |
463 */ | 475 */ |
464 LibraryMap initialLibraryMap(bool useDart2jsPaths) { | 476 LibraryMap initialLibraryMap(bool useDart2jsPaths) { |
465 JavaFile librariesFile = new JavaFile.relative( | 477 JavaFile librariesFile = new JavaFile.relative( |
466 new JavaFile.relative(libraryDirectory, _INTERNAL_DIR), | 478 new JavaFile.relative( |
| 479 new JavaFile.relative( |
| 480 new JavaFile.relative(libraryDirectory, _INTERNAL_DIR), |
| 481 _SDK_LIBRARY_METADATA_DIR), |
| 482 _SDK_LIBRARY_METADATA_LIB_DIR), |
467 _LIBRARIES_FILE); | 483 _LIBRARIES_FILE); |
468 try { | 484 try { |
469 String contents = librariesFile.readAsStringSync(); | 485 String contents = librariesFile.readAsStringSync(); |
470 return new SdkLibrariesReader(useDart2jsPaths).readFromFile( | 486 return new SdkLibrariesReader(useDart2jsPaths).readFromFile( |
471 librariesFile, contents); | 487 librariesFile, contents); |
472 } catch (exception, stackTrace) { | 488 } catch (exception, stackTrace) { |
473 AnalysisEngine.instance.logger.logError( | 489 AnalysisEngine.instance.logger.logError( |
474 "Could not initialize the library map from ${librariesFile.getAbsolute
Path()}", | 490 "Could not initialize the library map from ${librariesFile.getAbsolute
Path()}", |
475 new CaughtException(exception, stackTrace)); | 491 new CaughtException(exception, stackTrace)); |
476 return new LibraryMap(); | 492 return new LibraryMap(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 /** | 524 /** |
509 * Return the given [file] if it exists and is executable, or `null` if it | 525 * Return the given [file] if it exists and is executable, or `null` if it |
510 * does not exist or is not executable. | 526 * does not exist or is not executable. |
511 */ | 527 */ |
512 JavaFile _verifyExecutable(JavaFile file) => | 528 JavaFile _verifyExecutable(JavaFile file) => |
513 file.isExecutable() ? file : null; | 529 file.isExecutable() ? file : null; |
514 } | 530 } |
515 | 531 |
516 /** | 532 /** |
517 * An object used to read and parse the libraries file | 533 * An object used to read and parse the libraries file |
518 * (dart-sdk/lib/_internal/libraries.dart) for information about the libraries | 534 * (dart-sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart) for informat
ion |
519 * in an SDK. The library information is represented as a Dart file containing a | 535 * about the libraries in an SDK. The library information is represented as a |
520 * single top-level variable whose value is a const map. The keys of the map are | 536 * Dart file containing a single top-level variable whose value is a const map. |
521 * the names of libraries defined in the SDK and the values in the map are info | 537 * The keys of the map are the names of libraries defined in the SDK and the |
522 * objects defining the library. For example, a subset of a typical SDK might | 538 * values in the map are info objects defining the library. For example, a |
523 * have a libraries file that looks like the following: | 539 * subset of a typical SDK might have a libraries file that looks like the |
| 540 * following: |
524 * | 541 * |
525 * final Map<String, LibraryInfo> LIBRARIES = const <LibraryInfo>
; { | 542 * final Map<String, LibraryInfo> LIBRARIES = const <LibraryInfo> { |
526 * // Used by VM applications | 543 * // Used by VM applications |
527 * "builtin" : const LibraryInfo( | 544 * "builtin" : const LibraryInfo( |
528 * "builtin/builtin_runtime.dart", | 545 * "builtin/builtin_runtime.dart", |
529 * category: "Server", | 546 * category: "Server", |
530 * platforms: VM_PLATFORM), | 547 * platforms: VM_PLATFORM), |
531 * | 548 * |
532 * "compiler" : const LibraryInfo( | 549 * "compiler" : const LibraryInfo( |
533 * "compiler/compiler.dart", | 550 * "compiler/compiler.dart", |
534 * category: "Tools", | 551 * category: "Tools", |
535 * platforms: 0), | 552 * platforms: 0), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 585 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
569 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 586 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
570 // If any syntactic errors were found then don't try to visit the AST | 587 // If any syntactic errors were found then don't try to visit the AST |
571 // structure. | 588 // structure. |
572 if (!errorListener.errorReported) { | 589 if (!errorListener.errorReported) { |
573 unit.accept(libraryBuilder); | 590 unit.accept(libraryBuilder); |
574 } | 591 } |
575 return libraryBuilder.librariesMap; | 592 return libraryBuilder.librariesMap; |
576 } | 593 } |
577 } | 594 } |
OLD | NEW |