Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

make compile command optional, fixes #505 #590

Merged
merged 2 commits into from
Jun 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bin/dartdevc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ Future main(List<String> args) async {
Future<int> _runCommand(List<String> args,
{MessageHandler messageHandler}) async {
try {
if (args.isEmpty || args.first != 'compile' && args.first != 'help') {
// TODO(jmesserly): we should deprecate the commands. For now they are
// still supported for backwards compatibility.
args.insert(0, 'compile');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it may not be obvious from this diff view, but if you expand the file above, you can see that we're guaranteed a fresh mutable list (and there's a comment about it).

}
var runner = new CommandRunner('dartdevc', 'Dart Development Compiler');
runner.addCommand(new CompileCommand(messageHandler: messageHandler));
await runner.run(args);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/compiler/code_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5104,7 +5104,7 @@ String jsLibraryName(String buildRoot, LibraryElement library) {
uri.path.substring(buildRoot.length).replaceAll('/', separator);
} else {
// We don't have a unique name.
throw 'Invalid build root. $buildRoot does not contain ${uri.toFilePath()}';
throw 'Invalid build root. $buildRoot does not contain ${uri.toFilePath()}';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed a long line here. This doesn't fix #530 though.

}
return pathToJSIdentifier(qualifiedPath);
}
Expand Down
3 changes: 2 additions & 1 deletion test/worker/worker_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ main() {
test('incorrect usage', () {
var result = Process.runSync('dart', ['bin/dartdevc.dart', 'oops',]);
expect(result.exitCode, 64);
expect(result.stdout, contains('Could not find a command named "oops"'));
expect(
result.stdout, contains('Please include the output file location.'));
expect(result.stdout, isNot(contains('#0')));
});

Expand Down