| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
| 8 import 'package:compiler/src/apiimpl.dart'; | 8 import 'package:compiler/src/apiimpl.dart'; |
| 9 import 'package:compiler/src/filenames.dart'; | 9 import 'package:compiler/src/filenames.dart'; |
| 10 import 'package:compiler/src/null_compiler_output.dart'; | 10 import 'package:compiler/src/null_compiler_output.dart'; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 resolveOnly: true, | 38 resolveOnly: true, |
| 39 resolutionInputs: resolutionInputs, | 39 resolutionInputs: resolutionInputs, |
| 40 packagesDiscoveryProvider: findPackages); | 40 packagesDiscoveryProvider: findPackages); |
| 41 | 41 |
| 42 var bazelSearchPaths = args['bazel-paths']; | 42 var bazelSearchPaths = args['bazel-paths']; |
| 43 var inputProvider = bazelSearchPaths != null | 43 var inputProvider = bazelSearchPaths != null |
| 44 ? new BazelInputProvider(bazelSearchPaths) | 44 ? new BazelInputProvider(bazelSearchPaths) |
| 45 : new CompilerSourceFileProvider(); | 45 : new CompilerSourceFileProvider(); |
| 46 | 46 |
| 47 var outputProvider = const NullCompilerOutput(); | 47 var outputProvider = const NullCompilerOutput(); |
| 48 var diagnostics = new FormattingDiagnosticHandler(inputProvider); | 48 var diagnostics = new FormattingDiagnosticHandler(inputProvider) |
| 49 ..enableColors = true; |
| 49 var compiler = | 50 var compiler = |
| 50 new CompilerImpl(inputProvider, outputProvider, diagnostics, options); | 51 new CompilerImpl(inputProvider, outputProvider, diagnostics, options); |
| 51 | 52 |
| 52 if (args.rest.isEmpty) { | 53 if (args.rest.isEmpty) { |
| 53 print('missing input files'); | 54 print('missing input files'); |
| 54 exit(1); | 55 exit(1); |
| 55 } | 56 } |
| 56 | 57 |
| 57 var inputs = args.rest | 58 var inputs = args.rest |
| 58 .map((uri) => currentDirectory.resolve(nativeToUriPath(uri))) | 59 .map((uri) => currentDirectory.resolve(nativeToUriPath(uri))) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 76 inputs.map((lib) => compiler.libraryLoader.lookupLibrary(lib)).toList(); | 77 inputs.map((lib) => compiler.libraryLoader.lookupLibrary(lib)).toList(); |
| 77 | 78 |
| 78 var serializer = | 79 var serializer = |
| 79 compiler.serialization.createSerializer(librariesToSerialize); | 80 compiler.serialization.createSerializer(librariesToSerialize); |
| 80 var text = serializer.toText(const JsonSerializationEncoder()); | 81 var text = serializer.toText(const JsonSerializationEncoder()); |
| 81 | 82 |
| 82 var outFile = args['out'] ?? 'out.data'; | 83 var outFile = args['out'] ?? 'out.data'; |
| 83 | 84 |
| 84 await new File(outFile).writeAsString(text); | 85 await new File(outFile).writeAsString(text); |
| 85 } | 86 } |
| OLD | NEW |