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

Unified Diff: pkg/front_end/lib/src/fasta/fasta.dart

Issue 2742333006: Move patch file generation to fasta. (Closed)
Patch Set: Extract method. 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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/fasta.dart
diff --git a/pkg/front_end/lib/src/fasta/fasta.dart b/pkg/front_end/lib/src/fasta/fasta.dart
index 02d1891fa443c2ee8edc224ac9f37ac36154a6c7..dd56cebac4f7a01111bfe52720e13e512ae6d52e 100644
--- a/pkg/front_end/lib/src/fasta/fasta.dart
+++ b/pkg/front_end/lib/src/fasta/fasta.dart
@@ -26,6 +26,8 @@ import 'kernel/kernel_target.dart' show KernelTarget;
import 'dill/dill_target.dart' show DillTarget;
+import 'compile_platform.dart' show compilePlatformInternal;
+
import 'ticker.dart' show Ticker;
import 'translate_uri.dart' show TranslateUri;
@@ -196,6 +198,47 @@ Future<CompilationResult> parseScript(
}
}
+Future compilePlatform(Uri patchedSdk, Uri output,
+ {Uri packages, bool verbose: false}) async {
+ Ticker ticker = new Ticker(isVerbose: verbose);
+ await CompilerCommandLine.withGlobalOptions("", [""], (CompilerContext c) {
+ c.options.options["--packages"] = packages;
+ if (verbose) {
+ c.options.options["--verbose"] = true;
+ }
+ return compilePlatformInternal(c, ticker, patchedSdk, output);
+ });
+}
+
+Future writeDepsFile(Uri script, Uri depsFile, Uri output,
+ {Uri packages,
+ Uri platform,
+ Iterable<Uri> extraDependencies,
+ bool verbose: false}) async {
+ Ticker ticker = new Ticker(isVerbose: verbose);
+ await CompilerCommandLine.withGlobalOptions("", [""],
+ (CompilerContext c) async {
+ c.options.options["--packages"] = packages;
+ if (verbose) {
+ c.options.options["--verbose"] = true;
+ }
+
+ TranslateUri uriTranslator =
+ await TranslateUri.parse(c.options.sdk, c.options.packages);
+ ticker.logMs("Read packages file");
+ DillTarget dillTarget = new DillTarget(ticker, uriTranslator)
+ ..read(platform);
+ KernelTarget kernelTarget =
+ new KernelTarget(dillTarget, uriTranslator, c.uriToSource);
+
+ kernelTarget.read(script);
+ await dillTarget.writeOutline(null);
+ await kernelTarget.loader.buildOutlines();
+ await kernelTarget.writeDepsFile(output, depsFile,
+ extraDependencies: extraDependencies);
+ });
+}
+
// TODO(ahe): https://github.com/dart-lang/sdk/issues/28316
class ByteSink implements Sink<List<int>> {
final BytesBuilder builder = new BytesBuilder();
« no previous file with comments | « pkg/front_end/lib/src/fasta/compile_platform.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_target.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698