Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library front_end.compiler_options; | 5 library front_end.compiler_options; |
| 6 | 6 |
| 7 import 'compilation_error.dart'; | 7 import 'compilation_error.dart'; |
| 8 import 'file_system.dart'; | 8 import 'file_system.dart'; |
| 9 import 'physical_file_system.dart'; | 9 import 'physical_file_system.dart'; |
| 10 | 10 |
| 11 /// Default error handler used by [CompielerOptions.onError]. | 11 /// Default error handler used by [CompielerOptions.onError]. |
| 12 void defaultErrorHandler(CompilationError error) => throw error; | 12 void defaultErrorHandler(CompilationError error) => throw error; |
| 13 | 13 |
| 14 /// Callback used to report errors encountered during compilation. | 14 /// Callback used to report errors encountered during compilation. |
| 15 typedef void ErrorHandler(CompilationError error); | 15 typedef void ErrorHandler(CompilationError error); |
| 16 | 16 |
| 17 /// Front-end options relevant to compiler back ends. | 17 /// Front-end options relevant to compiler back ends. |
| 18 /// | 18 /// |
| 19 /// Not intended to be implemented or extended by clients. | 19 /// Not intended to be implemented or extended by clients. |
| 20 class CompilerOptions { | 20 class CompilerOptions { |
| 21 /// The path to the Dart SDK. | 21 /// The URI of the Dart SDK (typically a "file:" URI). |
| 22 /// | 22 /// |
| 23 /// If `null`, the SDK will be searched for using | 23 /// If `null`, the SDK will be searched for using |
| 24 /// [Platform.resolvedExecutable] as a starting point. | 24 /// [Platform.resolvedExecutable] as a starting point. |
| 25 /// | 25 /// |
| 26 /// This option is mutually exclusive with [sdkSummary]. | 26 /// This option is mutually exclusive with [sdkSummary]. |
| 27 String sdkPath; | 27 Uri sdkPath; |
|
danrubel
2017/01/08 17:07:38
Since this is no longer a path, perhaps rename sdk
Paul Berry
2017/01/09 17:24:42
Done.
| |
| 28 | 28 |
| 29 /// Callback to which compilation errors should be delivered. | 29 /// Callback to which compilation errors should be delivered. |
| 30 /// | 30 /// |
| 31 /// By default, the first error will be reported by throwing an exception of | 31 /// By default, the first error will be reported by throwing an exception of |
| 32 /// type [CompilationError]. | 32 /// type [CompilationError]. |
| 33 ErrorHandler onError = defaultErrorHandler; | 33 ErrorHandler onError = defaultErrorHandler; |
| 34 | 34 |
| 35 /// Path to the ".packages" file. | 35 /// URI of the ".packages" file (typically a "file:" URI). |
| 36 /// | 36 /// |
| 37 /// If `null`, the ".packages" file will be found via the standard | 37 /// If `null`, the ".packages" file will be found via the standard |
| 38 /// package_config search algorithm. | 38 /// package_config search algorithm. |
| 39 /// | 39 /// |
| 40 /// If the empty string, no packages file will be used. | 40 /// If the URI's path component is empty (e.g. `new Uri()`), no packages file |
| 41 String packagesFilePath; | 41 /// will be used. |
| 42 Uri packagesFilePath; | |
|
danrubel
2017/01/08 17:07:38
Same as above... packagesFileUri?
Paul Berry
2017/01/09 17:24:42
Done.
| |
| 42 | 43 |
| 43 /// Paths to the input summary files (excluding the SDK summary). These files | 44 /// URIs of input summary files (excluding the SDK summary; typically these |
| 44 /// should all be linked summaries. They should also be closed, in the sense | 45 /// will be "file:" URIs). These files should all be linked summaries. They |
| 45 /// that any libraries they reference should also appear in [inputSummaries] | 46 /// should also be closed, in the sense that any libraries they reference |
| 46 /// or [sdkSummary]. | 47 /// should also appear in [inputSummaries] or [sdkSummary]. |
| 47 List<String> inputSummaries = []; | 48 List<Uri> inputSummaries = []; |
| 48 | 49 |
| 49 /// Path to the SDK summary file. | 50 /// URI of the SDK summary file (typically a "file:" URI). |
| 50 /// | 51 /// |
| 51 /// This should be a linked summary. If `null`, the SDK summary will be | 52 /// This should be a linked summary. If `null`, the SDK summary will be |
| 52 /// searched for at a default location within [sdkPath]. | 53 /// searched for at a default location within [sdkPath]. |
| 53 /// | 54 /// |
| 54 /// This option is mutually exclusive with [sdkPath]. TODO(paulberry): if the | 55 /// This option is mutually exclusive with [sdkPath]. TODO(paulberry): if the |
| 55 /// VM does not contain a pickled copy of the SDK, we might need to change | 56 /// VM does not contain a pickled copy of the SDK, we might need to change |
| 56 /// this. | 57 /// this. |
| 57 String sdkSummary; | 58 Uri sdkSummary; |
| 58 | 59 |
| 59 /// URI override map. | 60 /// URI override map. |
| 60 /// | 61 /// |
| 61 /// This is a map from Uri to file path. Any URI override listed in this map | 62 /// This is a map from URIs that might appear in import/export/part statements |
| 62 /// takes precedence over the URI resolution that would be implied by the | 63 /// to URIs that should be used to locate the corresponding files in the |
| 63 /// packages file (see [packagesFilePath]) and/or [bazelRoots]. | 64 /// [fileSystem]. Any URI override listed in this map takes precedence over |
| 65 /// the URI resolution that would be implied by the packages file (see | |
| 66 /// [packagesFilePath]) and/or [multiRoots]. | |
| 64 /// | 67 /// |
| 65 /// If a URI is not listed in this map, then the normal URI resolution | 68 /// If a URI is not listed in this map, then the normal URI resolution |
| 66 /// algorithm will be used. | 69 /// algorithm will be used. |
| 67 /// | 70 /// |
| 68 /// TODO(paulberry): transition analyzer and dev_compiler to use the | 71 /// TODO(paulberry): transition analyzer and dev_compiler to use the |
| 69 /// "file:///bazel-root" mechanism, and then remove this. | 72 /// "multi-root:" mechanism, and then remove this. |
| 70 @deprecated | 73 @deprecated |
| 71 Map<Uri, String> uriOverride = {}; | 74 Map<Uri, Uri> uriOverride = {}; |
| 72 | 75 |
| 73 /// Bazel roots. | 76 /// Multi-roots. |
| 74 /// | 77 /// |
| 75 /// Any Uri that resolves to "file:///bazel-root/$rest" will be searched for | 78 /// Any Uri that resolves to "multi-root:///$rest" will be searched for |
| 76 /// at "$root/$rest" ("$root\\$rest" in Windows), where "$root" is drawn from | 79 /// at "$root/$rest", where "$root" is drawn from this list. |
| 77 /// this list. If the file is not found at any of those locations, the URI | |
| 78 /// "file:///bazel-root/$rest" will be used directly. | |
| 79 /// | 80 /// |
| 80 /// Intended use: if the Bazel workspace is located at path "$workspace", this | 81 /// Intended use: if the Bazel workspace is located at path "$workspace", this |
| 81 /// could be set to `['$workspace', '$workspace/bazel-bin', | 82 /// could be set to the file URIs corresponding to the paths for "$workspace", |
| 82 /// '$workspace/bazel-genfiles']`, effectively overlaying source and generated | 83 /// "$workspace/bazel-bin", and "$workspace/bazel-genfiles", effectively |
| 83 /// files. | 84 /// overlaying source and generated files. |
| 84 List<String> bazelRoots = []; | 85 List<Uri> multiRoots = []; |
| 85 | 86 |
| 86 /// Sets the platform bit, which determines which patch files should be | 87 /// Sets the platform bit, which determines which patch files should be |
| 87 /// applied to the SDK. | 88 /// applied to the SDK. |
| 88 /// | 89 /// |
| 89 /// The value should be a power of two, and should match the `PLATFORM` bit | 90 /// The value should be a power of two, and should match the `PLATFORM` bit |
| 90 /// flags in sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart. If | 91 /// flags in sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart. If |
| 91 /// zero, no patch files will be applied. | 92 /// zero, no patch files will be applied. |
| 92 int platformBit; | 93 int platformBit; |
| 93 | 94 |
| 94 /// The declared variables for use by configurable imports and constant | 95 /// The declared variables for use by configurable imports and constant |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 114 /// that will be compiled are listed explicitly and all other dependencies | 115 /// that will be compiled are listed explicitly and all other dependencies |
| 115 /// are covered by summary files. | 116 /// are covered by summary files. |
| 116 /// | 117 /// |
| 117 /// When this option is true, these APIs will treat any dependency that is | 118 /// When this option is true, these APIs will treat any dependency that is |
| 118 /// not described in a summary as if it was explictly listed as an input. | 119 /// not described in a summary as if it was explictly listed as an input. |
| 119 bool chaseDependencies = false; | 120 bool chaseDependencies = false; |
| 120 | 121 |
| 121 /// Whether to intepret Dart sources in strong-mode. | 122 /// Whether to intepret Dart sources in strong-mode. |
| 122 bool strongMode = true; | 123 bool strongMode = true; |
| 123 } | 124 } |
| OLD | NEW |