add a --libraries-file option to ddk
Change-Id: If0698f5b3f3736fe597fbfe0a1d13cc4205c9575
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105403
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
diff --git a/pkg/dev_compiler/lib/src/kernel/command.dart b/pkg/dev_compiler/lib/src/kernel/command.dart
index c4bcc5b..364981a 100644
--- a/pkg/dev_compiler/lib/src/kernel/command.dart
+++ b/pkg/dev_compiler/lib/src/kernel/command.dart
@@ -95,7 +95,9 @@
..addOption('dart-sdk',
help: '(unsupported with --kernel) path to the Dart SDK.', hide: true)
..addFlag('compile-sdk',
- help: 'Build an SDK module.', defaultsTo: false, hide: true);
+ help: 'Build an SDK module.', defaultsTo: false, hide: true)
+ ..addOption('libraries-file',
+ help: 'The path to the libraries.json file for the sdk.');
SharedCompilerOptions.addArguments(argParser);
var declaredVariables = parseAndRemoveDeclaredVariables(args);
@@ -157,15 +159,17 @@
summaryPaths.map(sourcePathToUri), options.summaryModules.values);
var useAnalyzer = summaryPaths.any((s) => !s.endsWith('.dill'));
var sdkSummaryPath = argResults['dart-sdk-summary'] as String;
- String librarySpecPath;
+ var librarySpecPath = argResults['libraries-file'] as String;
if (sdkSummaryPath == null) {
sdkSummaryPath =
useAnalyzer ? defaultAnalyzerSdkSummaryPath : defaultSdkSummaryPath;
- librarySpecPath = defaultLibrarySpecPath;
- } else {
+ librarySpecPath ??= defaultLibrarySpecPath;
+ }
+
+ if (librarySpecPath == null) {
// TODO(jmesserly): the `isSupported` bit should be included in the SDK
// summary, but front_end requires a separate file, so we have to work
- // around that, while avoiding yet another command line option.
+ // around that, while not requiring yet another command line option.
//
// Right now we search two locations: one level above the SDK summary
// (this works for the build and SDK layouts) or next to the SDK summary