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

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

Issue 2730743002: Implement deps files in compile_platform.dart. (Closed)
Patch Set: Created 3 years, 9 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.kernel_target; 5 library fasta.kernel_target;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show File, IOSink; 9 import 'dart:io' show File, IOSink;
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 import '../dill/dill_target.dart' show DillTarget; 62 import '../dill/dill_target.dart' show DillTarget;
63 63
64 import '../errors.dart' 64 import '../errors.dart'
65 show InputError, internalError, reportCrash, resetCrashReporting; 65 show InputError, internalError, reportCrash, resetCrashReporting;
66 66
67 import '../util/relativize.dart' show relativizeUri; 67 import '../util/relativize.dart' show relativizeUri;
68 68
69 import '../compiler_context.dart' show CompilerContext; 69 import '../compiler_context.dart' show CompilerContext;
70 70
71 import '../util/relativize.dart' show relativizeUri;
72
71 import 'kernel_builder.dart' 73 import 'kernel_builder.dart'
72 show 74 show
73 Builder, 75 Builder,
74 ClassBuilder, 76 ClassBuilder,
75 DynamicTypeBuilder, 77 DynamicTypeBuilder,
76 InvalidTypeBuilder, 78 InvalidTypeBuilder,
77 KernelClassBuilder, 79 KernelClassBuilder,
78 KernelLibraryBuilder, 80 KernelLibraryBuilder,
79 KernelNamedTypeBuilder, 81 KernelNamedTypeBuilder,
80 KernelProcedureBuilder, 82 KernelProcedureBuilder,
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 program = link(new List<Library>.from(loader.libraries)); 256 program = link(new List<Library>.from(loader.libraries));
255 if (uri == null) return program; 257 if (uri == null) return program;
256 return await writeLinkedProgram(uri, program, isFullProgram: false); 258 return await writeLinkedProgram(uri, program, isFullProgram: false);
257 } on InputError catch (e) { 259 } on InputError catch (e) {
258 return handleInputError(uri, e, isFullProgram: false); 260 return handleInputError(uri, e, isFullProgram: false);
259 } catch (e, s) { 261 } catch (e, s) {
260 return reportCrash(e, s, loader?.currentUriForCrashReporting); 262 return reportCrash(e, s, loader?.currentUriForCrashReporting);
261 } 263 }
262 } 264 }
263 265
266 Future writeDepsFile(Uri output, Uri depsFile) async {
267 if (loader.first == null) return null;
268 StringBuffer sb = new StringBuffer();
269 Uri base = depsFile.resolve(".");
270 sb.write(Uri.parse(relativizeUri(output, base: base)).toFilePath());
271 sb.write(":");
272 for (Uri dependency in loader.getDependencies()) {
273 sb.write(" ");
274 sb.write(Uri.parse(relativizeUri(dependency, base: base)).toFilePath());
275 }
276 sb.writeln();
277 await new File.fromUri(depsFile).writeAsString("$sb");
278 }
279
264 Program erroneousProgram(bool isFullProgram) { 280 Program erroneousProgram(bool isFullProgram) {
265 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); 281 Uri uri = loader.first?.uri ?? Uri.parse("error:error");
266 Uri fileUri = loader.first?.fileUri ?? uri; 282 Uri fileUri = loader.first?.fileUri ?? uri;
267 KernelLibraryBuilder library = 283 KernelLibraryBuilder library =
268 new KernelLibraryBuilder(uri, fileUri, loader); 284 new KernelLibraryBuilder(uri, fileUri, loader);
269 loader.first = library; 285 loader.first = library;
270 if (isFullProgram) { 286 if (isFullProgram) {
271 // If this is an outline, we shouldn't add an executable main 287 // If this is an outline, we shouldn't add an executable main
272 // method. Similarly considerations apply to separate compilation. It 288 // method. Similarly considerations apply to separate compilation. It
273 // could also make sense to add a way to mark .dill files as having 289 // could also make sense to add a way to mark .dill files as having
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 609 }
594 for (Constructor constructor in superclass.constructors) { 610 for (Constructor constructor in superclass.constructors) {
595 if (constructor.name.name.isEmpty) { 611 if (constructor.name.name.isEmpty) {
596 return constructor.function.requiredParameterCount == 0 612 return constructor.function.requiredParameterCount == 0
597 ? constructor 613 ? constructor
598 : null; 614 : null;
599 } 615 }
600 } 616 }
601 return null; 617 return null;
602 } 618 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/compile_platform.dart ('k') | pkg/front_end/lib/src/fasta/source/source_loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698