Index: pkg/compiler/bin/resolver.dart |
diff --git a/pkg/compiler/bin/resolver.dart b/pkg/compiler/bin/resolver.dart |
index d5b56da25d3c58093f18c0855fcf61658755ec48..428508bbc667ee90b0685484689bbfab2b42ba9b 100644 |
--- a/pkg/compiler/bin/resolver.dart |
+++ b/pkg/compiler/bin/resolver.dart |
@@ -5,13 +5,9 @@ |
import 'dart:io'; |
import 'package:args/args.dart'; |
-import 'package:compiler/src/apiimpl.dart'; |
import 'package:compiler/src/filenames.dart'; |
-import 'package:compiler/src/null_compiler_output.dart'; |
-import 'package:compiler/src/options.dart'; |
-import 'package:compiler/src/serialization/json_serializer.dart'; |
-import 'package:compiler/src/source_file_provider.dart'; |
-import 'package:package_config/discovery.dart'; |
+ |
+import 'package:compiler/src/dart2js_resolver.dart'; |
main(var argv) async { |
var parser = new ArgParser(); |
@@ -22,34 +18,6 @@ main(var argv) async { |
parser.addOption('bazel-paths', abbr: 'I', allowMultiple: true); |
var args = parser.parse(argv); |
- var resolutionInputs = args['deps'] |
- .map((uri) => currentDirectory.resolve(nativeToUriPath(uri))) |
- .toList(); |
- var root = args['library-root']; |
- var libraryRoot = root == null |
- ? Platform.script.resolve('../../../sdk/') |
- : currentDirectory.resolve(nativeToUriPath(root)); |
- |
- var options = new CompilerOptions( |
- libraryRoot: libraryRoot, |
- packageConfig: args['packages'] == null |
- ? null |
- : currentDirectory.resolve(args['packages']), |
- resolveOnly: true, |
- resolutionInputs: resolutionInputs, |
- packagesDiscoveryProvider: findPackages); |
- |
- var bazelSearchPaths = args['bazel-paths']; |
- var inputProvider = bazelSearchPaths != null |
- ? new BazelInputProvider(bazelSearchPaths) |
- : new CompilerSourceFileProvider(); |
- |
- var outputProvider = const NullCompilerOutput(); |
- var diagnostics = new FormattingDiagnosticHandler(inputProvider) |
- ..enableColors = true; |
- var compiler = |
- new CompilerImpl(inputProvider, outputProvider, diagnostics, options); |
- |
if (args.rest.isEmpty) { |
print('missing input files'); |
exit(1); |
@@ -59,26 +27,12 @@ main(var argv) async { |
.map((uri) => currentDirectory.resolve(nativeToUriPath(uri))) |
.toList(); |
- await compiler.setupSdk(); |
- await compiler.setupPackages(inputs.first); |
- |
- for (var library in inputs) { |
- await compiler.libraryLoader.loadLibrary(library); |
- } |
- |
- for (var library in inputs) { |
- compiler.fullyEnqueueLibrary(compiler.libraryLoader.lookupLibrary(library), |
- compiler.enqueuer.resolution); |
- } |
- |
- compiler.processQueue(compiler.enqueuer.resolution, null); |
- |
- var librariesToSerialize = |
- inputs.map((lib) => compiler.libraryLoader.lookupLibrary(lib)).toList(); |
- |
- var serializer = |
- compiler.serialization.createSerializer(librariesToSerialize); |
- var text = serializer.toText(const JsonSerializationEncoder()); |
+ var text = await resolve( |
+ inputs, |
+ deps: args['deps'], |
+ root: args['library-root'], |
+ packages: args['packages'], |
+ bazelSearchPaths: args['bazel-paths']); |
var outFile = args['out'] ?? 'out.data'; |