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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 output = Uri.base.resolveUri(new Uri.file(c.options.arguments[1])); |
48 return compilePlatformInternal(c, ticker, patchedSdk, output); | 48 return compilePlatformInternal(c, ticker, patchedSdk, output); |
49 }); | 49 }); |
50 } | 50 } |
51 | 51 |
52 Future compilePlatformInternal( | 52 Future compilePlatformInternal( |
53 CompilerContext c, Ticker ticker, Uri patchedSdk, Uri output) async { | 53 CompilerContext c, Ticker ticker, Uri patchedSdk, Uri output) async { |
| 54 if (c.options.strongMode) { |
| 55 print("Note: strong mode support is preliminary and may not work."); |
| 56 } |
54 ticker.isVerbose = c.options.verbose; | 57 ticker.isVerbose = c.options.verbose; |
55 Uri deps = Uri.base.resolveUri(new Uri.file("${output.toFilePath()}.d")); | 58 Uri deps = Uri.base.resolveUri(new Uri.file("${output.toFilePath()}.d")); |
56 ticker.logMs("Parsed arguments"); | 59 ticker.logMs("Parsed arguments"); |
57 if (ticker.isVerbose) { | 60 if (ticker.isVerbose) { |
58 print("Compiling $patchedSdk to $output"); | 61 print("Compiling $patchedSdk to $output"); |
59 } | 62 } |
60 | 63 |
61 TranslateUri uriTranslator = | 64 TranslateUri uriTranslator = |
62 await TranslateUri.parse(patchedSdk, c.options.packages); | 65 await TranslateUri.parse(patchedSdk, c.options.packages); |
63 ticker.logMs("Read packages file"); | 66 ticker.logMs("Read packages file"); |
64 | 67 |
65 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); | 68 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); |
66 KernelTarget kernelTarget = | 69 KernelTarget kernelTarget = new KernelTarget( |
67 new KernelTarget(dillTarget, uriTranslator, c.uriToSource); | 70 dillTarget, uriTranslator, c.options.strongMode, c.uriToSource); |
68 | 71 |
69 kernelTarget.read(Uri.parse("dart:core")); | 72 kernelTarget.read(Uri.parse("dart:core")); |
70 await dillTarget.writeOutline(null); | 73 await dillTarget.writeOutline(null); |
71 await kernelTarget.writeOutline(output); | 74 await kernelTarget.writeOutline(output); |
72 | 75 |
73 if (exitCode != 0) return null; | 76 if (exitCode != 0) return null; |
74 await kernelTarget.writeProgram(output, | 77 await kernelTarget.writeProgram(output, |
75 dumpIr: c.options.dumpIr, verify: c.options.verify); | 78 dumpIr: c.options.dumpIr, verify: c.options.verify); |
76 await kernelTarget.writeDepsFile(output, deps); | 79 await kernelTarget.writeDepsFile(output, deps); |
77 } | 80 } |
OLD | NEW |