OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// A wrapper on top of the [IncrementalKernelGenerator] that tracks | 5 /// A wrapper on top of the [IncrementalKernelGenerator] that tracks |
6 /// file modifications between subsequent compilation requests and only | 6 /// file modifications between subsequent compilation requests and only |
7 /// invalidates those files that appear to be modified. | 7 /// invalidates those files that appear to be modified. |
8 library front_end.example.incremental_reload.compiler_with_invalidation; | 8 library front_end.example.incremental_reload.compiler_with_invalidation; |
9 | 9 |
10 import 'dart:io'; | 10 import 'dart:io'; |
11 import 'dart:async'; | 11 import 'dart:async'; |
12 | 12 |
13 import 'package:front_end/compiler_options.dart'; | 13 import 'package:front_end/compiler_options.dart'; |
14 import 'package:front_end/incremental_kernel_generator.dart'; | 14 import 'package:front_end/incremental_kernel_generator.dart'; |
15 import 'package:front_end/src/incremental/file_byte_store.dart'; | 15 import 'package:front_end/src/byte_store/file_byte_store.dart'; |
16 import 'package:front_end/src/incremental/byte_store.dart'; | 16 import 'package:front_end/src/byte_store/byte_store.dart'; |
17 import 'package:kernel/ast.dart'; | 17 import 'package:kernel/ast.dart'; |
18 import 'package:kernel/binary/limited_ast_to_binary.dart'; | 18 import 'package:kernel/binary/limited_ast_to_binary.dart'; |
19 | 19 |
20 /// Create an instance of an [IncrementalCompiler] to compile a program whose | 20 /// Create an instance of an [IncrementalCompiler] to compile a program whose |
21 /// main entry point file is [entry]. This uses some default options | 21 /// main entry point file is [entry]. This uses some default options |
22 /// for the location of the sdk and temporary folder to save intermediate | 22 /// for the location of the sdk and temporary folder to save intermediate |
23 /// results. | 23 /// results. |
24 // TODO(sigmund): make this example work outside of the SDK repo. | 24 // TODO(sigmund): make this example work outside of the SDK repo. |
25 Future<IncrementalCompiler> createIncrementalCompiler(String entry, | 25 Future<IncrementalCompiler> createIncrementalCompiler(String entry, |
26 {bool persistent: true}) { | 26 {bool persistent: true}) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 result.errorSeen = true; | 162 result.errorSeen = true; |
163 } | 163 } |
164 | 164 |
165 result.changed = compiler.changed; | 165 result.changed = compiler.changed; |
166 result.totalFiles = compiler.lastModified.length; | 166 result.totalFiles = compiler.lastModified.length; |
167 result.invalidateTime = compiler.invalidateTime; | 167 result.invalidateTime = compiler.invalidateTime; |
168 result.compileTime = compiler.compileTime; | 168 result.compileTime = compiler.compileTime; |
169 result.reloadTime = 0; | 169 result.reloadTime = 0; |
170 return result; | 170 return result; |
171 } | 171 } |
OLD | NEW |