bazel worker fixes: add flag to set multi-root-scheme, resolve input uris correctly

Bug:
Change-Id: I4d680bdb56f54479cbf423dc1bc29dcdb6e273f6
Reviewed-on: https://dart-review.googlesource.com/30926
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
This commit is contained in:
Sigmund Cherem 2017-12-21 11:20:07 -08:00 committed by commit-bot@chromium.org
parent f3581accf2
commit 5e4ec2c8ab

View file

@ -85,6 +85,7 @@ final summaryArgsParser = new ArgParser()
..addOption('dart-sdk-summary')
..addOption('input-summary', allowMultiple: true)
..addOption('multi-root', allowMultiple: true)
..addOption('multi-root-scheme', defaultsTo: 'org-dartlang-multi-root')
..addOption('packages-file')
..addOption('source', allowMultiple: true)
..addOption('output');
@ -110,17 +111,17 @@ Future<bool> computeSummary(List<String> args,
// Bazel creates an overlay file system where some files may be located in the
// source tree, some in a gendir, and some in a bindir. The multi-root file
// system hides this from the front end.
var fileSystem = new MultiRootFileSystem(
'org-dartlang-multi-root',
parsedArgs['multi-root'].map(Uri.parse).toList(),
fe.PhysicalFileSystem.instance);
var multiRoots = parsedArgs['multi-root'].map(Uri.base.resolve).toList();
if (multiRoots.isEmpty) multiRoots.add(Uri.base);
var fileSystem = new MultiRootFileSystem(parsedArgs['multi-root-scheme'],
multiRoots, fe.PhysicalFileSystem.instance);
var state = await fe.initializeCompiler(
// TODO(sigmund): pass an old state once we can make use of it.
null,
Uri.parse(parsedArgs['dart-sdk-summary']),
Uri.parse(parsedArgs['packages-file']),
parsedArgs['input-summary'].map(Uri.parse).toList(),
Uri.base.resolve(parsedArgs['dart-sdk-summary']),
Uri.base.resolve(parsedArgs['packages-file']),
parsedArgs['input-summary'].map(Uri.base.resolve).toList(),
new NoneTarget(new TargetFlags()),
fileSystem);