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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 var relative = p.url.relative(compilerDir, | 240 var relative = p.url.relative(compilerDir, |
241 from: p.url.dirname(p.toUri(destPath).toString())); | 241 from: p.url.dirname(p.toUri(destPath).toString())); |
242 return source.replaceAll(_compilerPattern, "import '$relative"); | 242 return source.replaceAll(_compilerPattern, "import '$relative"); |
243 } | 243 } |
244 | 244 |
245 /// Regenerate the pub snapshot from the async/await-compiled output. We do | 245 /// Regenerate the pub snapshot from the async/await-compiled output. We do |
246 /// this here since the tests need it and it's faster than doing a full SDK | 246 /// this here since the tests need it and it's faster than doing a full SDK |
247 /// build. | 247 /// build. |
248 void _generateSnapshot(String buildDir) { | 248 void _generateSnapshot(String buildDir) { |
249 buildDir = p.normalize(buildDir); | 249 buildDir = p.normalize(buildDir); |
250 new Directory(dir).createSync(recursive: true); | 250 new Directory(buildDir).createSync(recursive: true); |
251 | 251 |
252 var entrypoint = p.join(generatedDir, 'bin/pub.dart'); | 252 var entrypoint = p.join(generatedDir, 'bin/pub.dart'); |
253 var packageRoot = p.join(buildDir, 'packages'); | 253 var packageRoot = p.join(buildDir, 'packages'); |
254 var snapshot = p.join(buildDir, 'dart-sdk/bin/snapshots/pub.dart.snapshot'); | 254 var snapshot = p.join(buildDir, 'dart-sdk/bin/snapshots/pub.dart.snapshot'); |
255 | 255 |
256 var result = Process.runSync(Platform.executable, [ | 256 var result = Process.runSync(Platform.executable, [ |
257 "--package-root=$packageRoot", | 257 "--package-root=$packageRoot", |
258 "--snapshot=$snapshot", | 258 "--snapshot=$snapshot", |
259 entrypoint | 259 entrypoint |
260 ]); | 260 ]); |
(...skipping 24 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 |