Skip to content

Commit 76d94c0

Browse files
author
John Messerly
authored
Merge pull request #590 from dart-lang/505_compile_cmd
make compile command optional, fixes #505
2 parents 6f85eb0 + 477182e commit 76d94c0

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

pkg/dev_compiler/bin/dartdevc.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ Future main(List<String> args) async {
5757
Future<int> _runCommand(List<String> args,
5858
{MessageHandler messageHandler}) async {
5959
try {
60+
if (args.isEmpty || args.first != 'compile' && args.first != 'help') {
61+
// TODO(jmesserly): we should deprecate the commands. For now they are
62+
// still supported for backwards compatibility.
63+
args.insert(0, 'compile');
64+
}
6065
var runner = new CommandRunner('dartdevc', 'Dart Development Compiler');
6166
runner.addCommand(new CompileCommand(messageHandler: messageHandler));
6267
await runner.run(args);

pkg/dev_compiler/lib/src/compiler/code_generator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5104,7 +5104,7 @@ String jsLibraryName(String buildRoot, LibraryElement library) {
51045104
uri.path.substring(buildRoot.length).replaceAll('/', separator);
51055105
} else {
51065106
// We don't have a unique name.
5107-
throw 'Invalid build root. $buildRoot does not contain ${uri.toFilePath()}';
5107+
throw 'Invalid build root. $buildRoot does not contain ${uri.toFilePath()}';
51085108
}
51095109
return pathToJSIdentifier(qualifiedPath);
51105110
}

pkg/dev_compiler/test/worker/worker_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ main() {
163163
test('incorrect usage', () {
164164
var result = Process.runSync('dart', ['bin/dartdevc.dart', 'oops',]);
165165
expect(result.exitCode, 64);
166-
expect(result.stdout, contains('Could not find a command named "oops"'));
166+
expect(
167+
result.stdout, contains('Please include the output file location.'));
167168
expect(result.stdout, isNot(contains('#0')));
168169
});
169170

0 commit comments

Comments
 (0)