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

Side by Side Diff: pkg/front_end/example/incremental_reload/compiler_with_invalidation.dart

Issue 2995913002: Update incremental load example so you can point to different sdk (Closed)
Patch Set: Created 3 years, 4 months 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
OLDNEW
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/byte_store/file_byte_store.dart'; 15 import 'package:front_end/src/byte_store/file_byte_store.dart';
16 import 'package:front_end/src/byte_store/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, Uri argSdkRoot}) {
Siggi Cherem (dart-lang) 2017/08/15 00:37:14 nit: rename to sdkRoot, possibly remove the TODO :
aam 2017/08/15 03:59:49 Done.
27 var entryUri = Uri.base.resolve(entry); 27 var entryUri = Uri.base.resolve(entry);
28 var dartVm = Uri.base.resolve(Platform.resolvedExecutable); 28 var dartVm = Uri.base.resolve(Platform.resolvedExecutable);
29 var sdkRoot = dartVm.resolve("patched_sdk/"); 29 var sdkRoot = argSdkRoot ?? dartVm.resolve("patched_sdk/");
30 var tmpDir = Directory.systemTemp.createTempSync('ikg_cache'); 30 var tmpDir = Directory.systemTemp.createTempSync('ikg_cache');
31 var options = new CompilerOptions() 31 var options = new CompilerOptions()
32 ..sdkRoot = sdkRoot 32 ..sdkRoot = sdkRoot
33 ..packagesFileUri = Uri.base.resolve('.packages') 33 ..packagesFileUri = Uri.base.resolve('.packages')
34 ..strongMode = false 34 ..strongMode = false
35 // Note: we do not report error on the console because the incremental 35 // Note: we do not report error on the console because the incremental
36 // compiler is an ongoing background service that shouldn't polute stdout. 36 // compiler is an ongoing background service that shouldn't polute stdout.
37 // TODO(sigmund): do something with the errors. 37 // TODO(sigmund): do something with the errors.
38 ..onError = (_) {} 38 ..onError = (_) {}
39 ..byteStore = 39 ..byteStore =
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 result.errorSeen = true; 163 result.errorSeen = true;
164 } 164 }
165 165
166 result.changed = compiler.changed; 166 result.changed = compiler.changed;
167 result.totalFiles = compiler.lastModified.length; 167 result.totalFiles = compiler.lastModified.length;
168 result.invalidateTime = compiler.invalidateTime; 168 result.invalidateTime = compiler.invalidateTime;
169 result.compileTime = compiler.compileTime; 169 result.compileTime = compiler.compileTime;
170 result.reloadTime = 0; 170 result.reloadTime = 0;
171 return result; 171 return result;
172 } 172 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/example/incremental_reload/run.dart » ('j') | pkg/front_end/example/incremental_reload/run.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698