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

Side by Side Diff: pkg/front_end/lib/src/fasta/fasta.dart

Issue 2895983002: Read SDK and patches from a JSON file. (Closed)
Patch Set: Merged with 1333f97b9a0e3805f991578ef83b0ec4553ecf33 Created 3 years, 7 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library fasta; 5 library fasta;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:convert' show JSON; 9 import 'dart:convert' show JSON;
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return new DillTarget(ticker, uriTranslator, c.options.target); 117 return new DillTarget(ticker, uriTranslator, c.options.target);
118 } 118 }
119 119
120 KernelTarget createKernelTarget( 120 KernelTarget createKernelTarget(
121 DillTarget dillTarget, TranslateUri uriTranslator, bool strongMode) { 121 DillTarget dillTarget, TranslateUri uriTranslator, bool strongMode) {
122 return new KernelTarget( 122 return new KernelTarget(
123 c.fileSystem, dillTarget, uriTranslator, strongMode, c.uriToSource); 123 c.fileSystem, dillTarget, uriTranslator, strongMode, c.uriToSource);
124 } 124 }
125 125
126 Future<KernelTarget> buildOutline([Uri output]) async { 126 Future<KernelTarget> buildOutline([Uri output]) async {
127 TranslateUri uriTranslator = await TranslateUri.parse( 127 TranslateUri uriTranslator = await TranslateUri
128 c.fileSystem, c.options.sdk, c.options.packages); 128 .parse(c.fileSystem, c.options.sdk, packages: c.options.packages);
129 ticker.logMs("Read packages file"); 129 ticker.logMs("Read packages file");
130 DillTarget dillTarget = createDillTarget(uriTranslator); 130 DillTarget dillTarget = createDillTarget(uriTranslator);
131 KernelTarget kernelTarget = 131 KernelTarget kernelTarget =
132 createKernelTarget(dillTarget, uriTranslator, c.options.strongMode); 132 createKernelTarget(dillTarget, uriTranslator, c.options.strongMode);
133 if (c.options.strongMode) { 133 if (c.options.strongMode) {
134 print("Note: strong mode support is preliminary and may not work."); 134 print("Note: strong mode support is preliminary and may not work.");
135 } 135 }
136 Uri platform = c.options.platform; 136 Uri platform = c.options.platform;
137 if (platform != null) { 137 if (platform != null) {
138 _appendDillForUri(dillTarget, platform); 138 _appendDillForUri(dillTarget, platform);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 formatUnexpected(fileName, -1, "No such file.")); 189 formatUnexpected(fileName, -1, "No such file."));
190 } 190 }
191 if (!await new Directory.fromUri(patchedSdk).exists()) { 191 if (!await new Directory.fromUri(patchedSdk).exists()) {
192 return new CompilationResult.error( 192 return new CompilationResult.error(
193 formatUnexpected(patchedSdk, -1, "Patched sdk directory not found.")); 193 formatUnexpected(patchedSdk, -1, "Patched sdk directory not found."));
194 } 194 }
195 195
196 Program program; 196 Program program;
197 try { 197 try {
198 TranslateUri uriTranslator = 198 TranslateUri uriTranslator =
199 await TranslateUri.parse(fileSystem, null, packages); 199 await TranslateUri.parse(fileSystem, patchedSdk, packages: packages);
200 final Ticker ticker = new Ticker(isVerbose: verbose); 200 final Ticker ticker = new Ticker(isVerbose: verbose);
201 final DillTarget dillTarget = 201 final DillTarget dillTarget =
202 new DillTarget(ticker, uriTranslator, backendTarget); 202 new DillTarget(ticker, uriTranslator, backendTarget);
203 _appendDillForUri(dillTarget, patchedSdk.resolve('platform.dill')); 203 _appendDillForUri(dillTarget, patchedSdk.resolve('platform.dill'));
204 final KernelTarget kernelTarget = 204 final KernelTarget kernelTarget =
205 new KernelTarget(fileSystem, dillTarget, uriTranslator, strongMode); 205 new KernelTarget(fileSystem, dillTarget, uriTranslator, strongMode);
206 kernelTarget.read(fileName); 206 kernelTarget.read(fileName);
207 await dillTarget.buildOutlines(); 207 await dillTarget.buildOutlines();
208 await kernelTarget.buildOutlines(); 208 await kernelTarget.buildOutlines();
209 program = await kernelTarget.buildProgram(); 209 program = await kernelTarget.buildProgram();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 c.options.options["--packages"] = packages; 247 c.options.options["--packages"] = packages;
248 if (verbose) { 248 if (verbose) {
249 c.options.options["--verbose"] = true; 249 c.options.options["--verbose"] = true;
250 } 250 }
251 return compilePlatformInternal( 251 return compilePlatformInternal(
252 c, ticker, patchedSdk, fullOutput, outlineOutput); 252 c, ticker, patchedSdk, fullOutput, outlineOutput);
253 }); 253 });
254 } 254 }
255 255
256 Future writeDepsFile(Uri script, Uri depsFile, Uri output, 256 Future writeDepsFile(Uri script, Uri depsFile, Uri output,
257 {Uri packages, 257 {Uri sdk,
258 Uri packages,
258 Uri platform, 259 Uri platform,
259 Iterable<Uri> extraDependencies, 260 Iterable<Uri> extraDependencies,
260 bool verbose: false, 261 bool verbose: false,
261 String backendTarget}) async { 262 String backendTarget}) async {
262 backendTarget ??= "vm"; 263 backendTarget ??= "vm";
263 Ticker ticker = new Ticker(isVerbose: verbose); 264 Ticker ticker = new Ticker(isVerbose: verbose);
264 await CompilerCommandLine.withGlobalOptions("", [""], 265 await CompilerCommandLine.withGlobalOptions("", [""],
265 (CompilerContext c) async { 266 (CompilerContext c) async {
266 c.options.options["--packages"] = packages; 267 c.options.options["--packages"] = packages;
267 if (verbose) { 268 if (verbose) {
268 c.options.options["--verbose"] = true; 269 c.options.options["--verbose"] = true;
269 } 270 }
271 sdk ??= c.options.sdk;
270 272
271 TranslateUri uriTranslator = await TranslateUri.parse( 273 TranslateUri uriTranslator = await TranslateUri.parse(c.fileSystem, sdk,
272 c.fileSystem, c.options.sdk, c.options.packages); 274 packages: c.options.packages);
273 ticker.logMs("Read packages file"); 275 ticker.logMs("Read packages file");
274 DillTarget dillTarget = 276 DillTarget dillTarget =
275 new DillTarget(ticker, uriTranslator, backendTarget); 277 new DillTarget(ticker, uriTranslator, backendTarget);
276 _appendDillForUri(dillTarget, platform); 278 _appendDillForUri(dillTarget, platform);
277 KernelTarget kernelTarget = new KernelTarget(PhysicalFileSystem.instance, 279 KernelTarget kernelTarget = new KernelTarget(PhysicalFileSystem.instance,
278 dillTarget, uriTranslator, false, c.uriToSource); 280 dillTarget, uriTranslator, false, c.uriToSource);
279 281
280 kernelTarget.read(script); 282 kernelTarget.read(script);
281 await dillTarget.buildOutlines(); 283 await dillTarget.buildOutlines();
282 await kernelTarget.loader.buildOutlines(); 284 await kernelTarget.loader.buildOutlines();
(...skipping 16 matching lines...) Expand all
299 final BytesBuilder builder = new BytesBuilder(); 301 final BytesBuilder builder = new BytesBuilder();
300 302
301 void add(List<int> data) { 303 void add(List<int> data) {
302 builder.add(data); 304 builder.add(data);
303 } 305 }
304 306
305 void close() { 307 void close() {
306 // Nothing to do. 308 // Nothing to do.
307 } 309 }
308 } 310 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/dill/dill_target.dart ('k') | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698