| Index: lib/src/compiler/command.dart
|
| diff --git a/lib/src/compiler/command.dart b/lib/src/compiler/command.dart
|
| index 6cb95da11657320bd2d0a2beddf127ab9143696a..29264fbb82bf8baa78130b9b6964f75c20fa68e9 100644
|
| --- a/lib/src/compiler/command.dart
|
| +++ b/lib/src/compiler/command.dart
|
| @@ -24,6 +24,10 @@ class CompileCommand extends Command {
|
| CompileCommand({MessageHandler messageHandler})
|
| : this.messageHandler = messageHandler ?? print {
|
| argParser.addOption('out', abbr: 'o', help: 'Output file (required)');
|
| + argParser.addOption('build-root',
|
| + help: '''
|
| +Root of source files. Generated library names are relative to this root.
|
| +''');
|
| CompilerOptions.addArguments(argParser);
|
| AnalyzerOptions.addArguments(argParser);
|
| }
|
| @@ -39,7 +43,14 @@ class CompileCommand extends Command {
|
| usageException('Please include the output file location. For example:\n'
|
| ' -o PATH/TO/OUTPUT_FILE.js');
|
| }
|
| - var unit = new BuildUnit(path.basenameWithoutExtension(outPath),
|
| +
|
| + var buildRoot = argResults['build-root'] as String;
|
| + if (buildRoot != null) {
|
| + buildRoot = path.absolute(buildRoot);
|
| + } else {
|
| + buildRoot = Directory.current.path;
|
| + }
|
| + var unit = new BuildUnit(path.basenameWithoutExtension(outPath), buildRoot,
|
| argResults.rest, _moduleForLibrary);
|
|
|
| JSModuleFile module = compiler.compile(unit, compilerOptions);
|
|
|