| Index: sdk/lib/_internal/pub_generated/lib/src/dart.dart
|
| diff --git a/sdk/lib/_internal/pub_generated/lib/src/dart.dart b/sdk/lib/_internal/pub_generated/lib/src/dart.dart
|
| index f5cf58255e18eb085ae048ed504d355f6ac17dcf..38eaf07f48bac3004743cc14ecdddd085313c7c9 100644
|
| --- a/sdk/lib/_internal/pub_generated/lib/src/dart.dart
|
| +++ b/sdk/lib/_internal/pub_generated/lib/src/dart.dart
|
| @@ -1,5 +1,6 @@
|
| library pub.dart;
|
| import 'dart:async';
|
| +import 'dart:io';
|
| import 'dart:isolate';
|
| import 'package:analyzer/analyzer.dart';
|
| import 'package:path/path.dart' as path;
|
| @@ -8,6 +9,7 @@ import '../../../compiler/compiler.dart' as compiler;
|
| import '../../../compiler/implementation/filenames.dart' show appendSlash;
|
| import '../../asset/dart/serialize.dart';
|
| import 'io.dart';
|
| +import 'log.dart' as log;
|
| import 'utils.dart';
|
| abstract class CompilerProvider {
|
| Uri get libraryRoot;
|
| @@ -72,7 +74,11 @@ class _DirectiveCollector extends GeneralizingAstVisitor {
|
| final directives = <UriBasedDirective>[];
|
| visitUriBasedDirective(UriBasedDirective node) => directives.add(node);
|
| }
|
| -Future runInIsolate(String code, message) {
|
| +Future runInIsolate(String code, message, {String snapshot}) {
|
| + if (snapshot != null && fileExists(snapshot)) {
|
| + log.fine("Spawning isolate from $snapshot.");
|
| + return Chain.track(Isolate.spawnUri(path.toUri(snapshot), [], message));
|
| + }
|
| return withTempDir((dir) {
|
| var dartPath = path.join(dir, 'runInIsolate.dart');
|
| writeTextFile(dartPath, code, dontLogContents: true);
|
| @@ -87,6 +93,17 @@ Future runInIsolate(String code, message) {
|
| return new Future.error(
|
| new CrossIsolateException.deserialize(response['error']),
|
| new Chain.current());
|
| + }).then((_) {
|
| + if (snapshot == null) return null;
|
| + ensureDir(path.dirname(snapshot));
|
| + return runProcess(
|
| + Platform.executable,
|
| + ['--snapshot=$snapshot', dartPath]).then((result) {
|
| + if (result.success) return;
|
| + log.warning(
|
| + "Failed to compile a snapshot to " "${path.relative(snapshot)}:\n" +
|
| + result.stderr.join("\n"));
|
| + });
|
| });
|
| });
|
| }
|
|
|