OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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:analyzer/src/services/formatter_impl.dart'; | 8 import 'package:analyzer/src/services/formatter_impl.dart'; |
9 import 'package:async_await/async_await.dart' as async_await; | 9 import 'package:async_await/async_await.dart' as async_await; |
10 import 'package:stack_trace/stack_trace.dart'; | 10 import 'package:stack_trace/stack_trace.dart'; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 var relative = | 242 var relative = |
243 p.url.relative(compilerDir, from: p.url.dirname(p.toUri(destPath).toString
())); | 243 p.url.relative(compilerDir, from: p.url.dirname(p.toUri(destPath).toString
())); |
244 return source.replaceAll(_compilerPattern, "import '$relative"); | 244 return source.replaceAll(_compilerPattern, "import '$relative"); |
245 } | 245 } |
246 | 246 |
247 /// Regenerate the pub snapshot from the async/await-compiled output. We do | 247 /// Regenerate the pub snapshot from the async/await-compiled output. We do |
248 /// this here since the tests need it and it's faster than doing a full SDK | 248 /// this here since the tests need it and it's faster than doing a full SDK |
249 /// build. | 249 /// build. |
250 void _generateSnapshot(String buildDir) { | 250 void _generateSnapshot(String buildDir) { |
251 buildDir = p.normalize(buildDir); | 251 buildDir = p.normalize(buildDir); |
252 new Directory(dir).createSync(recursive: true); | 252 new Directory(buildDir).createSync(recursive: true); |
253 | 253 |
254 var entrypoint = p.join(generatedDir, 'bin/pub.dart'); | 254 var entrypoint = p.join(generatedDir, 'bin/pub.dart'); |
255 var packageRoot = p.join(buildDir, 'packages'); | 255 var packageRoot = p.join(buildDir, 'packages'); |
256 var snapshot = p.join(buildDir, 'dart-sdk/bin/snapshots/pub.dart.snapshot'); | 256 var snapshot = p.join(buildDir, 'dart-sdk/bin/snapshots/pub.dart.snapshot'); |
257 | 257 |
258 var result = Process.runSync( | 258 var result = Process.runSync( |
259 Platform.executable, | 259 Platform.executable, |
260 ["--package-root=$packageRoot", "--snapshot=$snapshot", entrypoint]); | 260 ["--package-root=$packageRoot", "--snapshot=$snapshot", entrypoint]); |
261 | 261 |
262 if (result.exitCode != 0) { | 262 if (result.exitCode != 0) { |
(...skipping 22 matching lines...) Expand all Loading... |
285 /// | 285 /// |
286 /// This swallows errors to accommodate multiple compilers running concurrently. | 286 /// This swallows errors to accommodate multiple compilers running concurrently. |
287 /// Since they will produce the same output anyway, a failure of one is fine. | 287 /// Since they will produce the same output anyway, a failure of one is fine. |
288 void _writeFile(String path, String contents) { | 288 void _writeFile(String path, String contents) { |
289 try { | 289 try { |
290 new File(path).writeAsStringSync(contents); | 290 new File(path).writeAsStringSync(contents); |
291 } on IOException catch (ex) { | 291 } on IOException catch (ex) { |
292 // Do nothing. | 292 // Do nothing. |
293 } | 293 } |
294 } | 294 } |
OLD | NEW |