| Index: pkg/front_end/example/incremental_reload/compiler_with_invalidation.dart
|
| diff --git a/pkg/front_end/example/incremental_reload/compiler_with_invalidation.dart b/pkg/front_end/example/incremental_reload/compiler_with_invalidation.dart
|
| index 061771c9e54ce775f8b32280931105da699801f4..c5d976027032fa73ea36adf4878edf736f423ab4 100644
|
| --- a/pkg/front_end/example/incremental_reload/compiler_with_invalidation.dart
|
| +++ b/pkg/front_end/example/incremental_reload/compiler_with_invalidation.dart
|
| @@ -9,6 +9,7 @@ library front_end.example.incremental_reload.compiler_with_invalidation;
|
|
|
| import 'dart:io';
|
| import 'dart:async';
|
| +import 'dart:convert' show JSON;
|
|
|
| import 'package:front_end/compiler_options.dart';
|
| import 'package:front_end/incremental_kernel_generator.dart';
|
| @@ -32,6 +33,7 @@ Future<IncrementalCompiler> createIncrementalCompiler(String entry,
|
| ..sdkRoot = sdkRoot
|
| ..packagesFileUri = Uri.base.resolve('.packages')
|
| ..strongMode = false
|
| + ..dartLibraries = loadDartLibraries(sdkRoot)
|
| // Note: we do not report error on the console because the incremental
|
| // compiler is an ongoing background service that shouldn't polute stdout.
|
| // TODO(sigmund): do something with the errors.
|
| @@ -41,6 +43,18 @@ Future<IncrementalCompiler> createIncrementalCompiler(String entry,
|
| return IncrementalCompiler.create(options, entryUri);
|
| }
|
|
|
| +/// Reads the `libraries.json` file for an SDK to provide the location of the
|
| +/// SDK files.
|
| +// TODO(sigmund): this should be handled by package:front_end internally.
|
| +Map<String, Uri> loadDartLibraries(Uri sdkRoot) {
|
| + var libraries = sdkRoot.resolve('lib/libraries.json');
|
| + var map =
|
| + JSON.decode(new File.fromUri(libraries).readAsStringSync())['libraries'];
|
| + var dartLibraries = <String, Uri>{};
|
| + map.forEach((k, v) => dartLibraries[k] = libraries.resolve(v));
|
| + return dartLibraries;
|
| +}
|
| +
|
| /// An incremental compiler that monitors file modifications on disk and
|
| /// invalidates only files that have been modified since the previous time the
|
| /// compiler was invoked.
|
|
|