| 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 'kernel/verifier.dart' show verifyProgram; | 9 import 'kernel/verifier.dart' show verifyProgram; |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 exitCode = 1; | 39 exitCode = 1; |
| 40 print(e.format()); | 40 print(e.format()); |
| 41 return null; | 41 return null; |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 Future compilePlatform(CompilerContext c, Ticker ticker) async { | 46 Future compilePlatform(CompilerContext c, Ticker ticker) async { |
| 47 ticker.isVerbose = c.options.verbose; | 47 ticker.isVerbose = c.options.verbose; |
| 48 Uri output = Uri.base.resolveUri(new Uri.file(c.options.arguments[1])); | 48 Uri output = Uri.base.resolveUri(new Uri.file(c.options.arguments[1])); |
| 49 Uri deps = Uri.base.resolveUri(new Uri.file("${c.options.arguments[1]}.d")); |
| 49 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); | 50 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); |
| 50 ticker.logMs("Parsed arguments"); | 51 ticker.logMs("Parsed arguments"); |
| 51 if (ticker.isVerbose) { | 52 if (ticker.isVerbose) { |
| 52 print("Compiling $patchedSdk to $output"); | 53 print("Compiling $patchedSdk to $output"); |
| 53 } | 54 } |
| 54 | 55 |
| 55 TranslateUri uriTranslator = | 56 TranslateUri uriTranslator = |
| 56 await TranslateUri.parse(patchedSdk, c.options.packages); | 57 await TranslateUri.parse(patchedSdk, c.options.packages); |
| 57 ticker.logMs("Read packages file"); | 58 ticker.logMs("Read packages file"); |
| 58 | 59 |
| 59 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); | 60 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); |
| 60 KernelTarget kernelTarget = | 61 KernelTarget kernelTarget = |
| 61 new KernelTarget(dillTarget, uriTranslator, c.uriToSource); | 62 new KernelTarget(dillTarget, uriTranslator, c.uriToSource); |
| 62 | 63 |
| 63 kernelTarget.read(Uri.parse("dart:core")); | 64 kernelTarget.read(Uri.parse("dart:core")); |
| 64 await dillTarget.writeOutline(null); | 65 await dillTarget.writeOutline(null); |
| 65 await kernelTarget.writeOutline(output); | 66 await kernelTarget.writeOutline(output); |
| 66 | 67 |
| 67 if (exitCode != 0) return null; | 68 if (exitCode != 0) return null; |
| 68 await kernelTarget.writeProgram(output); | |
| 69 if (c.options.dumpIr) { | 69 if (c.options.dumpIr) { |
| 70 kernelTarget.dumpIr(); | 70 kernelTarget.dumpIr(); |
| 71 } | 71 } |
| 72 if (c.options.verify) { | 72 if (c.options.verify) { |
| 73 try { | 73 try { |
| 74 verifyProgram(kernelTarget.program); | 74 verifyProgram(kernelTarget.program); |
| 75 ticker.logMs("Verified program"); | 75 ticker.logMs("Verified program"); |
| 76 } catch (e, s) { | 76 } catch (e, s) { |
| 77 exitCode = 1; | 77 exitCode = 1; |
| 78 print("Verification of program failed: $e"); | 78 print("Verification of program failed: $e"); |
| 79 if (s != null && c.options.verbose) { | 79 if (s != null && c.options.verbose) { |
| 80 print(s); | 80 print(s); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 if (exitCode != 0) return null; |
| 85 await kernelTarget.writeProgram(output); |
| 86 await kernelTarget.writeDepsFile(output, deps); |
| 84 } | 87 } |
| OLD | NEW |