From 0fb21eec2f70703bdd49e6d0fc03cabd142e70e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20von=20der=20Ahe=CC=81?= Date: Tue, 19 Dec 2017 15:23:43 +0000 Subject: [PATCH] Tweak and document compile-time constant for enabling Fasta's incremental compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icb45e579233f567319439623d67d2a683fb13514 Reviewed-on: https://dart-review.googlesource.com/30447 Reviewed-by: Jens Johansen Commit-Queue: Peter von der Ahé --- .../incremental_kernel_generator.dart | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart index d2eedd1b4de..aae2ecfe36e 100644 --- a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart +++ b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart @@ -15,6 +15,14 @@ import 'package:front_end/src/fasta/incremental_compiler.dart' import 'compiler_options.dart'; +/// Force using the Fasta incremental compiler [IncrementalCompiler]. This is +/// useful for uploading patches to golem (benchmark service). +const bool _forceFasta = false; + +/// When true, use the Fasta incremental compiler [IncrementalCompiler]. +const bool _useFasta = + const bool.fromEnvironment("ikg-use-fasta", defaultValue: _forceFasta); + /// The type of the function that clients can pass to track used files. /// /// When a file is first used during compilation, this function is called with @@ -143,13 +151,14 @@ abstract class IncrementalKernelGenerator { CompilerOptions options, Uri entryPoint, {WatchUsedFilesFn watch, bool useMinimalGenerator: false}) async { var processedOptions = new ProcessedOptions(options, false, [entryPoint]); + if (_useFasta) { + return new IncrementalCompiler(new CompilerContext(processedOptions)); + } return await CompilerContext.runWithOptions(processedOptions, (compilerContext) async { var uriTranslator = await processedOptions.getUriTranslator(); var sdkOutlineBytes = await processedOptions.loadSdkSummaryBytes(); - if (const String.fromEnvironment("ikg-variant") == "fasta") { - return new IncrementalCompiler(compilerContext); - } else if (useMinimalGenerator) { + if (useMinimalGenerator) { return new MinimalIncrementalKernelGenerator( processedOptions, uriTranslator, sdkOutlineBytes, entryPoint, watch: watch);