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 library fasta.compile_platform; | 5 library fasta.compile_platform; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'ticker.dart' show Ticker; | 9 import 'ticker.dart' show Ticker; |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 return null; | 37 return null; |
38 } | 38 } |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 Future compilePlatform(List<String> arguments) async { | 42 Future compilePlatform(List<String> arguments) async { |
43 Ticker ticker = new Ticker(); | 43 Ticker ticker = new Ticker(); |
44 await CompilerCommandLine.withGlobalOptions("compile_platform", arguments, | 44 await CompilerCommandLine.withGlobalOptions("compile_platform", arguments, |
45 (CompilerContext c) { | 45 (CompilerContext c) { |
46 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); | 46 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); |
47 Uri output = Uri.base.resolveUri(new Uri.file(c.options.arguments[1])); | 47 Uri fullOutput = Uri.base.resolveUri(new Uri.file(c.options.arguments[1])); |
48 return compilePlatformInternal(c, ticker, patchedSdk, output); | 48 Uri outlineOutput = |
| 49 Uri.base.resolveUri(new Uri.file(c.options.arguments[2])); |
| 50 return compilePlatformInternal( |
| 51 c, ticker, patchedSdk, fullOutput, outlineOutput); |
49 }); | 52 }); |
50 } | 53 } |
51 | 54 |
52 Future compilePlatformInternal( | 55 Future compilePlatformInternal(CompilerContext c, Ticker ticker, Uri patchedSdk, |
53 CompilerContext c, Ticker ticker, Uri patchedSdk, Uri output) async { | 56 Uri fullOutput, Uri outlineOutput) async { |
54 if (c.options.strongMode) { | 57 if (c.options.strongMode) { |
55 print("Note: strong mode support is preliminary and may not work."); | 58 print("Note: strong mode support is preliminary and may not work."); |
56 } | 59 } |
57 ticker.isVerbose = c.options.verbose; | 60 ticker.isVerbose = c.options.verbose; |
58 Uri deps = Uri.base.resolveUri(new Uri.file("${output.toFilePath()}.d")); | 61 Uri deps = Uri.base.resolveUri(new Uri.file("${fullOutput.toFilePath()}.d")); |
59 ticker.logMs("Parsed arguments"); | 62 ticker.logMs("Parsed arguments"); |
60 if (ticker.isVerbose) { | 63 if (ticker.isVerbose) { |
61 print("Compiling $patchedSdk to $output"); | 64 print("Generating outline of $patchedSdk into $outlineOutput"); |
| 65 print("Compiling $patchedSdk to $fullOutput"); |
62 } | 66 } |
63 | 67 |
64 TranslateUri uriTranslator = | 68 TranslateUri uriTranslator = |
65 await TranslateUri.parse(c.fileSystem, patchedSdk, c.options.packages); | 69 await TranslateUri.parse(c.fileSystem, patchedSdk, c.options.packages); |
66 ticker.logMs("Read packages file"); | 70 ticker.logMs("Read packages file"); |
67 | 71 |
68 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); | 72 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); |
69 KernelTarget kernelTarget = new KernelTarget(c.fileSystem, dillTarget, | 73 KernelTarget kernelTarget = new KernelTarget(c.fileSystem, dillTarget, |
70 uriTranslator, c.options.strongMode, c.uriToSource); | 74 uriTranslator, c.options.strongMode, c.uriToSource); |
71 | 75 |
72 kernelTarget.read(Uri.parse("dart:core")); | 76 kernelTarget.read(Uri.parse("dart:core")); |
73 await dillTarget.writeOutline(null); | 77 await dillTarget.writeOutline(null); |
74 await kernelTarget.writeOutline(output); | 78 await kernelTarget.writeOutline(outlineOutput); |
75 | 79 |
76 if (exitCode != 0) return null; | 80 if (exitCode != 0) return null; |
77 await kernelTarget.writeProgram(output, | 81 await kernelTarget.writeProgram(fullOutput, |
78 dumpIr: c.options.dumpIr, verify: c.options.verify); | 82 dumpIr: c.options.dumpIr, verify: c.options.verify); |
79 await kernelTarget.writeDepsFile(output, deps); | 83 await kernelTarget.writeDepsFile(fullOutput, deps); |
80 } | 84 } |
OLD | NEW |