Index: pkg/dev_compiler/lib/src/compiler/command.dart |
diff --git a/pkg/dev_compiler/lib/src/compiler/command.dart b/pkg/dev_compiler/lib/src/compiler/command.dart |
index af34e95f711c3490304d9cd70cff1f4cfdcaa5f6..b778c5b532574089144ed5bafab346ecb30fe854 100644 |
--- a/pkg/dev_compiler/lib/src/compiler/command.dart |
+++ b/pkg/dev_compiler/lib/src/compiler/command.dart |
@@ -2,6 +2,7 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
+import 'dart:async'; |
import 'dart:io'; |
import 'package:analyzer/src/command_line/arguments.dart' |
show |
@@ -13,10 +14,10 @@ import 'package:analyzer/src/summary/package_bundle_reader.dart' |
show ConflictingSummaryException, InSummarySource; |
import 'package:args/args.dart' show ArgParser, ArgResults; |
import 'package:args/command_runner.dart' show UsageException; |
+import 'package:dev_compiler/src/compiler/compiler.dart'; |
import 'package:path/path.dart' as path; |
import '../analyzer/context.dart' show AnalyzerOptions; |
-import 'compiler.dart' show BuildUnit, CompilerOptions, ModuleCompiler; |
import 'module_builder.dart'; |
const _binaryName = 'dartdevc'; |
@@ -28,7 +29,7 @@ bool _verbose = false; |
/// This handles argument parsing, usage, error handling. |
/// See bin/dartdevc.dart for the actual entry point, which includes Bazel |
/// worker support. |
-int compile(List<String> args, {void printFn(Object obj)}) { |
+Future<int> compile(List<String> args, {void printFn(Object obj)}) async { |
printFn ??= print; |
ArgResults argResults; |
@@ -57,7 +58,7 @@ int compile(List<String> args, {void printFn(Object obj)}) { |
} |
try { |
- _compile(argResults, analyzerOptions, printFn); |
+ await _compile(argResults, analyzerOptions, printFn); |
return 0; |
} on UsageException catch (error) { |
// Incorrect usage, input file not found, etc. |
@@ -131,8 +132,8 @@ bool _changed(List<int> list1, List<int> list2) { |
return false; |
} |
-void _compile(ArgResults argResults, AnalyzerOptions analyzerOptions, |
- void printFn(Object obj)) { |
+Future<Null> _compile(ArgResults argResults, AnalyzerOptions analyzerOptions, |
+ void printFn(Object obj)) async { |
var compiler = new ModuleCompiler(analyzerOptions); |
var compilerOpts = new CompilerOptions.fromArguments(argResults); |
var outPaths = argResults['out'] as List<String>; |
@@ -183,7 +184,7 @@ void _compile(ArgResults argResults, AnalyzerOptions analyzerOptions, |
var unit = new BuildUnit(modulePath, libraryRoot, argResults.rest, |
(source) => _moduleForLibrary(moduleRoot, source, compilerOpts)); |
- var module = compiler.compile(unit, compilerOpts); |
+ JSModuleFile module = await compiler.compile(unit, compilerOpts); |
module.errors.forEach(printFn); |
if (!module.isValid) { |