| OLD | NEW |
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:args/args.dart' as args; | 8 import 'package:args/args.dart' as args; |
| 9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 String dillOutput = options["dill-output"]; | 134 String dillOutput = options["dill-output"]; |
| 135 File tempFile = null; | 135 File tempFile = null; |
| 136 if (dillOutput == null) { | 136 if (dillOutput == null) { |
| 137 Directory tmp = await Directory.systemTemp.createTemp(); | 137 Directory tmp = await Directory.systemTemp.createTemp(); |
| 138 Uri uri = tmp.uri.resolve("generated.dill"); | 138 Uri uri = tmp.uri.resolve("generated.dill"); |
| 139 dillOutput = uri.toFilePath(); | 139 dillOutput = uri.toFilePath(); |
| 140 tempFile = new File.fromUri(uri); | 140 tempFile = new File.fromUri(uri); |
| 141 } | 141 } |
| 142 | 142 |
| 143 ProcessResult result = await Process.run(dartkPath, [ | 143 ProcessResult result = await Process.run(dartkPath, [ |
| 144 "--strong", |
| 144 "--sdk=$sdkPath", | 145 "--sdk=$sdkPath", |
| 145 "--target=vmreify", | 146 "--target=vmreify", |
| 146 "--link", | 147 "--link", |
| 147 "--out=$dillOutput", | 148 "--out=$dillOutput", |
| 148 inputFilename, | 149 inputFilename, |
| 149 ]); | 150 ]); |
| 150 if (result.exitCode != 0) { | 151 if (result.exitCode != 0) { |
| 151 tempFile?.parent?.delete(recursive: true); | 152 tempFile?.parent?.delete(recursive: true); |
| 152 stdout.write(result.stdout); | 153 stdout.write(result.stdout); |
| 153 stderr.write(result.stderr); | 154 stderr.write(result.stderr); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 164 | 165 |
| 165 stdout.write(result.stdout); | 166 stdout.write(result.stdout); |
| 166 stderr.write(result.stderr); | 167 stderr.write(result.stderr); |
| 167 tempFile?.parent?.delete(recursive: true); | 168 tempFile?.parent?.delete(recursive: true); |
| 168 if (result.exitCode != 0) { | 169 if (result.exitCode != 0) { |
| 169 stderr.writeln("ERROR: execution of 'dart' failed with exit code " | 170 stderr.writeln("ERROR: execution of 'dart' failed with exit code " |
| 170 "${result.exitCode}"); | 171 "${result.exitCode}"); |
| 171 exit(result.exitCode); | 172 exit(result.exitCode); |
| 172 } | 173 } |
| 173 } | 174 } |
| OLD | NEW |