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

Side by Side Diff: pkg/front_end/test/src/incremental/hot_reload_e2e_test.dart

Issue 2986303003: Switch FE to use the libraries.json format. (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 /// Integration test that runs the incremental compiler, runs the compiled 5 /// Integration test that runs the incremental compiler, runs the compiled
6 /// program, incrementally rebuild portions of the app, and triggers a hot 6 /// program, incrementally rebuild portions of the app, and triggers a hot
7 /// reload on the running program. 7 /// reload on the running program.
8 library front_end.incremental.hot_reload_e2e_test; 8 library front_end.incremental.hot_reload_e2e_test;
9 9
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 169
170 var dartVm = Uri.base.resolve(Platform.resolvedExecutable); 170 var dartVm = Uri.base.resolve(Platform.resolvedExecutable);
171 var sdkRoot = dartVm.resolve("patched_sdk/"); 171 var sdkRoot = dartVm.resolve("patched_sdk/");
172 172
173 Future<IncrementalKernelGenerator> createIncrementalCompiler( 173 Future<IncrementalKernelGenerator> createIncrementalCompiler(
174 String entry, FileSystem fs) { 174 String entry, FileSystem fs) {
175 var entryUri = Uri.base.resolve(entry); 175 var entryUri = Uri.base.resolve(entry);
176 var options = new CompilerOptions() 176 var options = new CompilerOptions()
177 ..sdkRoot = sdkRoot 177 ..sdkRoot = sdkRoot
178 ..sdkSummary = sdkRoot.resolve('outline.dill')
179 ..packagesFileUri = Uri.parse('file:///.packages') 178 ..packagesFileUri = Uri.parse('file:///.packages')
180 ..strongMode = false 179 ..strongMode = false
181 ..dartLibraries = loadDartLibraries() 180 ..compileSdk = true // the incremental generator requires the sdk sources
182 ..fileSystem = fs 181 ..fileSystem = fs
183 ..byteStore = new MemoryByteStore(); 182 ..byteStore = new MemoryByteStore();
184 return IncrementalKernelGenerator.newInstance(options, entryUri); 183 return IncrementalKernelGenerator.newInstance(options, entryUri);
185 } 184 }
186 185
187 Map<String, Uri> loadDartLibraries() {
188 var libraries = sdkRoot.resolve('lib/libraries.json');
189 var map =
190 JSON.decode(new File.fromUri(libraries).readAsStringSync())['libraries'];
191 var dartLibraries = <String, Uri>{};
192 map.forEach((k, v) => dartLibraries[k] = libraries.resolve(v));
193 return dartLibraries;
194 }
195
196 Future<bool> rebuild(IncrementalKernelGenerator compiler, Uri outputUri) async { 186 Future<bool> rebuild(IncrementalKernelGenerator compiler, Uri outputUri) async {
197 compiler.invalidate(Uri.parse("file:///a.dart")); 187 compiler.invalidate(Uri.parse("file:///a.dart"));
198 compiler.invalidate(Uri.parse("file:///b.dart")); 188 compiler.invalidate(Uri.parse("file:///b.dart"));
199 var program = (await compiler.computeDelta()).newProgram; 189 var program = (await compiler.computeDelta()).newProgram;
200 if (program != null && !program.libraries.isEmpty) { 190 if (program != null && !program.libraries.isEmpty) {
201 await writeProgram(program, outputUri); 191 await writeProgram(program, outputUri);
202 return true; 192 return true;
203 } 193 }
204 return false; 194 return false;
205 } 195 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 239
250 f() => "$line part2"; 240 f() => "$line part2";
251 '''; 241 ''';
252 242
253 const sourceB = r''' 243 const sourceB = r'''
254 get line => "part1"; 244 get line => "part1";
255 '''; 245 ''';
256 246
257 RegExp observatoryPortRegExp = 247 RegExp observatoryPortRegExp =
258 new RegExp("Observatory listening on http://127.0.0.1:\([0-9]*\)/"); 248 new RegExp("Observatory listening on http://127.0.0.1:\([0-9]*\)/");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698