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

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: 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 formatUnexpected(fileName, -1, "No such file.")); 187 formatUnexpected(fileName, -1, "No such file."));
188 } 188 }
189 if (!await new Directory.fromUri(patchedSdk).exists()) { 189 if (!await new Directory.fromUri(patchedSdk).exists()) {
190 return new CompilationResult.error( 190 return new CompilationResult.error(
191 formatUnexpected(patchedSdk, -1, "Patched sdk directory not found.")); 191 formatUnexpected(patchedSdk, -1, "Patched sdk directory not found."));
192 } 192 }
193 193
194 Program program; 194 Program program;
195 try { 195 try {
196 TranslateUri uriTranslator = 196 TranslateUri uriTranslator =
197 await TranslateUri.parse(fileSystem, null, packages); 197 await TranslateUri.parse(fileSystem, null, packages: packages);
198 final Ticker ticker = new Ticker(isVerbose: verbose); 198 final Ticker ticker = new Ticker(isVerbose: verbose);
199 final DillTarget dillTarget = 199 final DillTarget dillTarget =
200 new DillTarget(ticker, uriTranslator, backendTarget); 200 new DillTarget(ticker, uriTranslator, backendTarget);
201 _appendDillForUri(dillTarget, patchedSdk.resolve('platform.dill')); 201 _appendDillForUri(dillTarget, patchedSdk.resolve('platform.dill'));
202 final KernelTarget kernelTarget = 202 final KernelTarget kernelTarget =
203 new KernelTarget(fileSystem, dillTarget, uriTranslator, strongMode); 203 new KernelTarget(fileSystem, dillTarget, uriTranslator, strongMode);
204 kernelTarget.read(fileName); 204 kernelTarget.read(fileName);
205 await dillTarget.buildOutlines(); 205 await dillTarget.buildOutlines();
206 await kernelTarget.buildOutlines(); 206 await kernelTarget.buildOutlines();
207 program = await kernelTarget.buildProgram(); 207 program = await kernelTarget.buildProgram();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 c.options.options["--packages"] = packages; 245 c.options.options["--packages"] = packages;
246 if (verbose) { 246 if (verbose) {
247 c.options.options["--verbose"] = true; 247 c.options.options["--verbose"] = true;
248 } 248 }
249 return compilePlatformInternal( 249 return compilePlatformInternal(
250 c, ticker, patchedSdk, fullOutput, outlineOutput); 250 c, ticker, patchedSdk, fullOutput, outlineOutput);
251 }); 251 });
252 } 252 }
253 253
254 Future writeDepsFile(Uri script, Uri depsFile, Uri output, 254 Future writeDepsFile(Uri script, Uri depsFile, Uri output,
255 {Uri packages, 255 {Uri sdk,
256 Uri packages,
256 Uri platform, 257 Uri platform,
257 Iterable<Uri> extraDependencies, 258 Iterable<Uri> extraDependencies,
258 bool verbose: false, 259 bool verbose: false,
259 String backendTarget}) async { 260 String backendTarget}) async {
260 backendTarget ??= "vm"; 261 backendTarget ??= "vm";
261 Ticker ticker = new Ticker(isVerbose: verbose); 262 Ticker ticker = new Ticker(isVerbose: verbose);
262 await CompilerCommandLine.withGlobalOptions("", [""], 263 await CompilerCommandLine.withGlobalOptions("", [""],
263 (CompilerContext c) async { 264 (CompilerContext c) async {
264 c.options.options["--packages"] = packages; 265 c.options.options["--packages"] = packages;
265 if (verbose) { 266 if (verbose) {
266 c.options.options["--verbose"] = true; 267 c.options.options["--verbose"] = true;
267 } 268 }
269 sdk ??= c.options.sdk;
268 270
269 TranslateUri uriTranslator = await TranslateUri.parse( 271 TranslateUri uriTranslator = await TranslateUri.parse(c.fileSystem, sdk,
270 c.fileSystem, c.options.sdk, c.options.packages); 272 packages: c.options.packages);
271 ticker.logMs("Read packages file"); 273 ticker.logMs("Read packages file");
272 DillTarget dillTarget = 274 DillTarget dillTarget =
273 new DillTarget(ticker, uriTranslator, backendTarget); 275 new DillTarget(ticker, uriTranslator, backendTarget);
274 _appendDillForUri(dillTarget, platform); 276 _appendDillForUri(dillTarget, platform);
275 KernelTarget kernelTarget = new KernelTarget(PhysicalFileSystem.instance, 277 KernelTarget kernelTarget = new KernelTarget(PhysicalFileSystem.instance,
276 dillTarget, uriTranslator, false, c.uriToSource); 278 dillTarget, uriTranslator, false, c.uriToSource);
277 279
278 kernelTarget.read(script); 280 kernelTarget.read(script);
279 await dillTarget.buildOutlines(); 281 await dillTarget.buildOutlines();
280 await kernelTarget.loader.buildOutlines(); 282 await kernelTarget.loader.buildOutlines();
(...skipping 16 matching lines...) Expand all
297 final BytesBuilder builder = new BytesBuilder(); 299 final BytesBuilder builder = new BytesBuilder();
298 300
299 void add(List<int> data) { 301 void add(List<int> data) {
300 builder.add(data); 302 builder.add(data);
301 } 303 }
302 304
303 void close() { 305 void close() {
304 // Nothing to do. 306 // Nothing to do.
305 } 307 }
306 } 308 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698