Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: sdk/lib/_internal/pub/bin/async_compile.dart

Issue 766793004: Fix the async compiler, and pub's async compiler test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/test/descriptor/directory_test.dart ('k') | sdk/lib/_internal/pub/test/async_compile_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698