[cfe] Use generateKernelInternal in expectation tests

Change-Id: I09026eb9cd11d2bcc136a4f7448038ae270df8a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357607
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 180e260..de98251 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -485,14 +485,6 @@
     return _additionalDillComponents!;
   }
 
-  void set loadAdditionalDillsComponents(List<Component> components) {
-    if (_additionalDillComponents != null) {
-      throw new StateError("inputAdditionalDillsComponents already loaded.");
-    }
-    components.forEach(_validateNullSafetyMode);
-    _additionalDillComponents = components;
-  }
-
   /// Helper to load a .dill file from [uri] using the existing [nameRoot].
   Component loadComponent(List<int> bytes, CanonicalName? nameRoot,
       {bool? alwaysCreateNewNamedNodes, Uri? fileUri}) {
diff --git a/pkg/front_end/lib/src/kernel_generator_impl.dart b/pkg/front_end/lib/src/kernel_generator_impl.dart
index 93667f3..810be27 100644
--- a/pkg/front_end/lib/src/kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/kernel_generator_impl.dart
@@ -19,6 +19,7 @@
 import 'api_prototype/front_end.dart' show CompilerOptions, CompilerResult;
 import 'api_prototype/kernel_generator.dart';
 import 'api_prototype/memory_file_system.dart';
+import 'base/instrumentation.dart';
 import 'base/nnbd_mode.dart';
 import 'base/processed_options.dart' show ProcessedOptions;
 import 'fasta/codes/fasta_codes.dart' show LocatedMessage;
@@ -56,14 +57,16 @@
   });
 }
 
-Future<CompilerResult> generateKernelInternal(
+Future<InternalCompilerResult> generateKernelInternal(
     {bool buildSummary = false,
     bool buildComponent = true,
     bool truncateSummary = false,
     bool includeOffsets = true,
-    bool retainDataForTesting = false,
     bool includeHierarchyAndCoreTypes = false,
-    Benchmarker? benchmarker}) async {
+    bool retainDataForTesting = false,
+    Benchmarker? benchmarker,
+    Instrumentation? instrumentation,
+    List<Component>? additionalDillsForTesting}) async {
   ProcessedOptions options = CompilerContext.current.options;
   assert(options.haveBeenValidated, "Options have not been validated");
 
@@ -71,7 +74,7 @@
   FileSystem fs = options.fileSystem;
 
   SourceLoader? sourceLoader;
-  return withCrashReporting<CompilerResult>(() async {
+  return withCrashReporting<InternalCompilerResult>(() async {
     while (true) {
       // TODO(johnniwinther): How much can we reuse between iterations?
       UriTranslator uriTranslator = await options.getUriTranslator();
@@ -90,7 +93,12 @@
       // By using the nameRoot of the summary, we enable sharing the
       // sdkSummary between multiple invocations.
       CanonicalName? nameRoot;
-      if (options.hasAdditionalDills) {
+      if (additionalDillsForTesting != null) {
+        for (Component additionalDill in additionalDillsForTesting) {
+          loadedComponents.add(additionalDill);
+          dillTarget.loader.appendLibraries(additionalDill);
+        }
+      } else if (options.hasAdditionalDills) {
         nameRoot = sdkSummary?.root ?? new CanonicalName.root();
         for (Component additionalDill
             in await options.loadAdditionalDills(nameRoot)) {
@@ -104,6 +112,7 @@
       KernelTarget kernelTarget =
           new KernelTarget(fs, false, dillTarget, uriTranslator);
       sourceLoader = kernelTarget.loader;
+      sourceLoader!.instrumentation = instrumentation;
       kernelTarget.setEntryPoints(options.inputs);
       NeededPrecompilations? neededPrecompilations =
           await kernelTarget.computeNeededPrecompilations();
@@ -136,7 +145,7 @@
           new UriOffset(options.inputs.first, TreeNode.noOffset));
 }
 
-Future<CompilerResult> _buildInternal(
+Future<InternalCompilerResult> _buildInternal(
     {required ProcessedOptions options,
     required KernelTarget kernelTarget,
     required CanonicalName? nameRoot,
diff --git a/pkg/front_end/test/coverage_suite.dart b/pkg/front_end/test/coverage_suite.dart
index e1fe8ca..7f11a5f 100644
--- a/pkg/front_end/test/coverage_suite.dart
+++ b/pkg/front_end/test/coverage_suite.dart
@@ -39,7 +39,7 @@
   "package:front_end/src/api_unstable/dart2js.dart": 0.0,
   "package:front_end/src/api_unstable/util.dart": 37.03703703703704,
   "package:front_end/src/base/instrumentation.dart": 100.0,
-  "package:front_end/src/base/processed_options.dart": 41.36807817589577,
+  "package:front_end/src/base/processed_options.dart": 39.0,
   "package:front_end/src/compute_platform_binaries_location.dart":
       64.1025641025641,
   "package:front_end/src/fasta/builder/builder.dart": 63.63636363636363,
@@ -117,7 +117,7 @@
   "package:front_end/src/fasta/dill/dill_extension_type_member_builder.dart":
       83.76623376623377,
   "package:front_end/src/fasta/dill/dill_library_builder.dart": 78.134110787172,
-  "package:front_end/src/fasta/dill/dill_loader.dart": 85.36585365853658,
+  "package:front_end/src/fasta/dill/dill_loader.dart": 80.0,
   "package:front_end/src/fasta/dill/dill_member_builder.dart":
       86.52173913043478,
   "package:front_end/src/fasta/dill/dill_target.dart": 74.35897435897436,
@@ -233,7 +233,7 @@
       89.29663608562691,
   "package:front_end/src/fasta/source/source_library_builder.dart":
       82.6852338413032,
-  "package:front_end/src/fasta/source/source_loader.dart": 80.74141048824593,
+  "package:front_end/src/fasta/source/source_loader.dart": 79.0,
   "package:front_end/src/fasta/source/source_member_builder.dart":
       40.32258064516129,
   "package:front_end/src/fasta/source/source_procedure_builder.dart":
@@ -242,7 +242,7 @@
       97.63313609467455,
   "package:front_end/src/fasta/source/stack_listener_impl.dart":
       64.44444444444444,
-  "package:front_end/src/fasta/ticker.dart": 100.0,
+  "package:front_end/src/fasta/ticker.dart": 73.0,
   "package:front_end/src/fasta/type_inference/closure_context.dart":
       84.23236514522821,
   "package:front_end/src/fasta/type_inference/delayed_expressions.dart":
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index 75c1085..2351914 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -32,8 +32,6 @@
     show FileSystem, FileSystemEntity, FileSystemException;
 import 'package:front_end/src/api_prototype/incremental_kernel_generator.dart'
     show IncrementalCompilerResult;
-import 'package:front_end/src/api_prototype/standard_file_system.dart'
-    show StandardFileSystem;
 import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
 import 'package:front_end/src/base/processed_options.dart'
     show ProcessedOptions;
@@ -43,7 +41,6 @@
     show LibraryBuilder;
 import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
 import 'package:front_end/src/fasta/crash.dart';
-import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
 import 'package:front_end/src/fasta/incremental_compiler.dart'
     show AdvancedInvalidationResult, IncrementalCompiler;
 import 'package:front_end/src/fasta/kernel/hierarchy/hierarchy_builder.dart'
@@ -51,15 +48,15 @@
 import 'package:front_end/src/fasta/kernel/hierarchy/hierarchy_node.dart'
     show ClassHierarchyNode;
 import 'package:front_end/src/fasta/kernel/kernel_target.dart'
-    show BuildResult, KernelTarget;
+    show KernelTarget;
 import 'package:front_end/src/fasta/kernel/utils.dart' show ByteSink;
 import 'package:front_end/src/fasta/kernel/verifier.dart' show verifyComponent;
 import 'package:front_end/src/fasta/messages.dart' show LocatedMessage;
-import 'package:front_end/src/fasta/ticker.dart' show Ticker;
 import 'package:front_end/src/fasta/uri_translator.dart' show UriTranslator;
 import 'package:front_end/src/fasta/util/parser_ast.dart'
     show IgnoreSomeForCompatibilityAstVisitor, getAST;
 import 'package:front_end/src/fasta/util/parser_ast_helper.dart';
+import 'package:front_end/src/kernel_generator_impl.dart';
 import 'package:kernel/ast.dart'
     show
         BasicLiteral,
@@ -228,10 +225,10 @@
   final bool verify;
   final bool soundNullSafety;
   final Uri platformBinaries;
-  final Map<UriConfiguration, UriTranslator> _uriTranslators = {};
   final Map<Uri, Uri?> _librariesJson = {};
   final SuiteFolderOptions suiteFolderOptions;
   final SuiteTestOptions suiteTestOptions;
+  final CompileMode compileMode;
 
   @override
   final bool updateExpectations;
@@ -270,7 +267,7 @@
       bool updateComments,
       this.skipVm,
       this.semiFuzz,
-      CompileMode compileMode,
+      this.compileMode,
       this.verify,
       this.soundNullSafety)
       : steps = <Step>[
@@ -351,44 +348,6 @@
     }
   }
 
-  Future<UriTranslator> computeUriTranslator(
-      TestDescription description) async {
-    UriConfiguration uriConfiguration = computeUriConfiguration(description);
-    UriTranslator? uriTranslator = _uriTranslators[uriConfiguration];
-    if (uriTranslator == null) {
-      Uri sdk = Uri.base.resolve("sdk/");
-      Uri packages = Uri.base.resolve(".dart_tool/package_config.json");
-      FolderOptions folderOptions =
-          suiteFolderOptions.computeFolderOptions(description);
-      CompilerOptions compilerOptions = new CompilerOptions()
-        ..onDiagnostic = (DiagnosticMessage message) {
-          throw message.plainTextFormatted.join("\n");
-        }
-        ..sdkRoot = sdk
-        ..packagesFileUri = uriConfiguration.packageConfigUri ?? packages
-        ..enableUnscheduledExperiments =
-            folderOptions.enableUnscheduledExperiments ?? false
-        ..environmentDefines = folderOptions.defines
-        ..explicitExperimentalFlags = folderOptions
-            .computeExplicitExperimentalFlags(forcedExperimentalFlags)
-        ..nnbdMode = soundNullSafety
-            ? (folderOptions.nnbdAgnosticMode
-                ? NnbdMode.Agnostic
-                : NnbdMode.Strong)
-            : NnbdMode.Weak
-        ..librariesSpecificationUri =
-            uriConfiguration.librariesSpecificationUri;
-      if (folderOptions.overwriteCurrentSdkVersion != null) {
-        compilerOptions.currentSdkVersion =
-            folderOptions.overwriteCurrentSdkVersion!;
-      }
-      ProcessedOptions options = new ProcessedOptions(options: compilerOptions);
-      uriTranslator = await options.getUriTranslator();
-      _uriTranslators[uriConfiguration] = uriTranslator;
-    }
-    return uriTranslator;
-  }
-
   /// Libraries json for [description].
   Uri? computeLibrariesSpecificationUri(TestDescription description) {
     Directory directory = new File.fromUri(description.uri).parent;
@@ -411,13 +370,6 @@
     return new File.fromUri(packageConfig).existsSync() ? packageConfig : null;
   }
 
-  UriConfiguration computeUriConfiguration(TestDescription description) {
-    Uri? librariesSpecificationUri =
-        computeLibrariesSpecificationUri(description);
-    Uri? packageConfigUri = computePackageConfigUri(description);
-    return new UriConfiguration(librariesSpecificationUri, packageConfigUri);
-  }
-
   Expectation get verificationError => expectationSet["VerificationError"];
 
   Uri _getPlatformUri(Target target, NnbdMode nnbdMode) {
@@ -820,6 +772,8 @@
 
   Uri? librariesSpecificationUri =
       context.computeLibrariesSpecificationUri(description);
+  Uri packagesFileUri = context.computePackageConfigUri(description) ??
+      Uri.base.resolve(".dart_tool/package_config.json");
   TestOptions testOptions =
       context.suiteTestOptions.computeTestOptions(description);
   FolderOptions folderOptions =
@@ -854,7 +808,16 @@
       ..skipPlatformVerification = true
       ..omitPlatform = true
       ..omitOsMessageForTesting = true
-      ..target = createTarget(folderOptions, context);
+      ..packagesFileUri = packagesFileUri
+      ..target = createTarget(folderOptions, context)
+      ..verify =
+          // TODO(johnniwinther): Enable verification in outline and modular
+          //  compilation.
+          (context.compileMode != CompileMode.full || folderOptions.noVerify)
+              ? false
+              : context.verify;
+    compilerOptions.sdkSummary =
+        context._getPlatformUri(compilerOptions.target!, nnbdMode);
     if (folderOptions.overwriteCurrentSdkVersion != null) {
       compilerOptions.currentSdkVersion =
           folderOptions.overwriteCurrentSdkVersion!;
@@ -876,6 +839,8 @@
       testOptions.experimentEnabledVersion,
       testOptions.experimentReleasedVersion);
   ProcessedOptions options = createProcessedOptions(compilerOptions);
+  options.sdkSummaryComponent =
+      context.loadPlatform(options.target, options.nnbdMode);
   return new CompilationSetup(testOptions, folderOptions, compilerOptions,
       options, errors, createCompilerOptions, createProcessedOptions);
 }
@@ -907,9 +872,6 @@
       backendTarget.performModularTransformations = true;
     }
 
-    UriTranslator uriTranslator =
-        await context.computeUriTranslator(result.description);
-
     Component platform =
         context.loadPlatform(backendTarget, compilationSetup.options.nnbdMode);
 
@@ -933,7 +895,6 @@
       Result<ComponentResult>? passResult = await performFileInvalidation(
         compilationSetup,
         platform,
-        uriTranslator,
         context,
         originalCompilationResult: result,
         forceAndCheckRebuildBodiesOnly: false,
@@ -943,7 +904,6 @@
       passResult = await performChunkReordering(
         compilationSetup,
         platform,
-        uriTranslator,
         result,
         context,
       );
@@ -960,7 +920,6 @@
         passResult = await performFileSplitting(
           compilationSetup,
           platform,
-          uriTranslator,
           result,
           context,
         );
@@ -993,7 +952,6 @@
   Future<Result<ComponentResult>?> performFileInvalidation(
       CompilationSetup compilationSetup,
       Component platform,
-      UriTranslator uriTranslator,
       FastaContext context,
       {ComponentResult? originalCompilationResult,
       required bool forceAndCheckRebuildBodiesOnly}) async {
@@ -1012,6 +970,8 @@
           semiFuzzFailure, "Couldn't serialize initial component for fuzzing");
     }
 
+    final UriTranslator uriTranslator =
+        await compilationSetup.options.getUriTranslator();
     final Set<Uri> userLibraries =
         createUserLibrariesImportUriSet(component, uriTranslator);
     final bool expectErrors = compilationSetup.errors.isNotEmpty;
@@ -1193,7 +1153,6 @@
   Future<Result<ComponentResult>?> performChunkReordering(
       CompilationSetup compilationSetup,
       Component platform,
-      UriTranslator uriTranslator,
       ComponentResult result,
       FastaContext context) async {
     compilationSetup.errors.clear();
@@ -1349,7 +1308,6 @@
   Future<Result<ComponentResult>?> performFileSplitting(
       CompilationSetup compilationSetup,
       Component platform,
-      UriTranslator uriTranslator,
       ComponentResult result,
       FastaContext context) async {
     FileSystem orgFileSystem = compilationSetup.options.fileSystem;
@@ -1475,7 +1433,6 @@
     Result<ComponentResult>? passResult = await performFileInvalidation(
       compilationSetup,
       platform,
-      uriTranslator,
       context,
       originalCompilationResult: null,
       forceAndCheckRebuildBodiesOnly: true,
@@ -2001,10 +1958,6 @@
       .toSet();
   // Mark custom "dart:" libraries defined in the test-specific libraries.json
   // file as user libraries.
-  // Note that this method takes a uriTranslator directly because of
-  // inconsistencies with targets (namely that test-specific libraries.json
-  // specifies target 'none' even if the target is 'vm', which works because
-  // the normal testing pipeline use target 'none' for the dill loader).
   userLibraries.addAll(uriTranslator.dartLibraries.allLibraries
       .map((LibraryInfo info) => info.importUri));
   return userLibraries.intersection(knownUris);
@@ -2069,41 +2022,31 @@
                 compilationSetup.testOptions.allowedExperimentalFlags,
                 compilationSetup.testOptions.experimentEnabledVersion,
                 compilationSetup.testOptions.experimentReleasedVersion));
+        linkOptions.sdkSummaryComponent =
+            context.loadPlatform(linkOptions.target, linkOptions.nnbdMode);
       }
       await CompilerContext.runWithOptions(linkOptions, (_) async {
-        KernelTarget sourceTarget = await outlineInitialization(
-            context,
-            description,
-            linkOptions,
-            compilationSetup.testOptions.linkDependencies.toList());
-        if (compilationSetup.testOptions.errors != null) {
-          compilationSetup.errors.addAll(compilationSetup.testOptions.errors!);
-        }
-        BuildResult buildResult = await sourceTarget.buildOutlines();
-        Component p = buildResult.component!;
-        if (compileMode == CompileMode.full) {
-          buildResult = await sourceTarget.buildComponent(
-              macroApplications: buildResult.macroApplications,
-              verify: compilationSetup.folderOptions.noVerify
-                  ? false
-                  : context.verify);
-          p = buildResult.component!;
-        }
-        buildResult.macroApplications?.close();
-
-        // To avoid possible crash in mixin transformation in the transformation
-        // of the user of this linked dependency we have to transform this too.
-        // We do that now.
-        Target backendTarget = sourceTarget.backendTarget;
+        Target backendTarget = linkOptions.target;
         if (backendTarget is TestTarget) {
           backendTarget.performModularTransformations = true;
         }
-        try {
-          sourceTarget.runBuildTransformations();
-        } finally {
-          if (backendTarget is TestTarget) {
-            backendTarget.performModularTransformations = false;
-          }
+        linkOptions.inputs.clear();
+        linkOptions.inputs
+            .addAll(compilationSetup.testOptions.linkDependencies.toList());
+        InternalCompilerResult internalCompilerResult =
+            await generateKernelInternal(
+          buildSummary: compileMode != CompileMode.full,
+          buildComponent: compileMode == CompileMode.full,
+          includeHierarchyAndCoreTypes: true,
+          retainDataForTesting: true,
+        );
+        Component p = internalCompilerResult.component!;
+        internalCompilerResult.kernelTargetForTesting!;
+        if (backendTarget is TestTarget) {
+          backendTarget.performModularTransformations = false;
+        }
+        if (compilationSetup.testOptions.errors != null) {
+          compilationSetup.errors.addAll(compilationSetup.testOptions.errors!);
         }
 
         compilationSetup.testOptions.component = p;
@@ -2135,32 +2078,34 @@
         }
         excludedLibraries ??= const {};
 
-        KernelTarget sourceTarget = await outlineInitialization(context,
-            description, compilationSetup.options, <Uri>[description.uri],
-            alsoAppend: alsoAppend);
         ValidatingInstrumentation instrumentation =
             new ValidatingInstrumentation();
         await instrumentation.loadExpectations(description.uri);
-        sourceTarget.loader.instrumentation = instrumentation;
-        BuildResult buildResult = await sourceTarget.buildOutlines();
-        Component p = buildResult.component!;
+
+        Component p;
+        KernelTarget sourceTarget;
+        compilationSetup.options.inputs.clear();
+        compilationSetup.options.inputs.add(description.uri);
+        InternalCompilerResult internalCompilerResult =
+            await generateKernelInternal(
+          buildSummary: compileMode == CompileMode.outline,
+          buildComponent: compileMode != CompileMode.outline,
+          instrumentation: instrumentation,
+          retainDataForTesting: true,
+          additionalDillsForTesting: alsoAppend != null ? [alsoAppend] : null,
+        );
+        p = internalCompilerResult.component!;
+        sourceTarget = internalCompilerResult.kernelTargetForTesting!;
+
         Set<Uri> userLibraries = createUserLibrariesImportUriSet(
             p, sourceTarget.uriTranslator,
             excludedLibraries: excludedLibraries);
         if (compileMode != CompileMode.outline) {
-          buildResult = await sourceTarget.buildComponent(
-              macroApplications: buildResult.macroApplications,
-              verify: compilationSetup.folderOptions.noVerify
-                  ? false
-                  : context.verify,
-              allowVerificationErrorForTesting: true);
-          p = buildResult.component!;
           instrumentation.finish();
           if (instrumentation.hasProblems) {
             if (updateComments) {
               await instrumentation.fixSource(description.uri, false);
             } else {
-              buildResult.macroApplications?.close();
               return new Result<ComponentResult>(
                   new ComponentResult(description, p, userLibraries,
                       compilationSetup, sourceTarget),
@@ -2171,7 +2116,6 @@
             }
           }
         }
-        buildResult.macroApplications?.close();
         return pass(new ComponentResult(
             description, p, userLibraries, compilationSetup, sourceTarget));
       });
@@ -2179,33 +2123,6 @@
       return reportCrash(e, s);
     }
   }
-
-  Future<KernelTarget> outlineInitialization(
-      FastaContext context,
-      TestDescription description,
-      ProcessedOptions options,
-      List<Uri> entryPoints,
-      {Component? alsoAppend}) async {
-    Component platform = context.loadPlatform(options.target, options.nnbdMode);
-    Ticker ticker = new Ticker();
-    UriTranslator uriTranslator =
-        await context.computeUriTranslator(description);
-    DillTarget dillTarget = new DillTarget(
-      ticker,
-      uriTranslator,
-      options.target,
-    );
-    dillTarget.loader.appendLibraries(platform);
-    if (alsoAppend != null) {
-      dillTarget.loader.appendLibraries(alsoAppend);
-    }
-    KernelTarget sourceTarget = new KernelTarget(
-        StandardFileSystem.instance, false, dillTarget, uriTranslator);
-
-    sourceTarget.setEntryPoints(entryPoints);
-    dillTarget.buildOutlines();
-    return sourceTarget;
-  }
 }
 
 class Transform extends Step<ComponentResult, ComponentResult, FastaContext> {
@@ -2387,25 +2304,6 @@
   }
 }
 
-class UriConfiguration {
-  final Uri? librariesSpecificationUri;
-  final Uri? packageConfigUri;
-
-  UriConfiguration(this.librariesSpecificationUri, this.packageConfigUri);
-
-  @override
-  int get hashCode =>
-      librariesSpecificationUri.hashCode * 13 + packageConfigUri.hashCode * 17;
-
-  @override
-  bool operator ==(Object other) {
-    if (identical(this, other)) return true;
-    return other is UriConfiguration &&
-        librariesSpecificationUri == other.librariesSpecificationUri &&
-        packageConfigUri == other.packageConfigUri;
-  }
-}
-
 class NoneConstantsBackendWithJs extends NoneConstantsBackend {
   const NoneConstantsBackendWithJs({required bool supportsUnevaluatedConstants})
       : super(supportsUnevaluatedConstants: supportsUnevaluatedConstants);
diff --git a/pkg/front_end/test/utils/kernel_chain.dart b/pkg/front_end/test/utils/kernel_chain.dart
index a72415a..1b3946b 100644
--- a/pkg/front_end/test/utils/kernel_chain.dart
+++ b/pkg/front_end/test/utils/kernel_chain.dart
@@ -601,8 +601,8 @@
       actual = _replaceSdkLocation(actual, search, "sdk/");
     } else {
       // We are running from something like out/ReleaseX64/dart
-      actual = _replaceSdkLocation(actual, "sdk/", "sdk/");
     }
+    actual = _replaceSdkLocation(actual, "sdk/", "sdk/");
     actual = actual.replaceAll("$base", "org-dartlang-testcase:///");
     actual = actual.replaceAll("\\n", "\n");
     return context.match<ComponentResult>(suffix, actual, uri, result,
diff --git a/pkg/front_end/testcases/dart2js/tear_off_patch/libraries.json b/pkg/front_end/testcases/dart2js/tear_off_patch/libraries.json
index 6b6fc26..8ac6e58 100644
--- a/pkg/front_end/testcases/dart2js/tear_off_patch/libraries.json
+++ b/pkg/front_end/testcases/dart2js/tear_off_patch/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "dart2js": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/dartdevc/factory_patch/libraries.json b/pkg/front_end/testcases/dartdevc/factory_patch/libraries.json
index 6b6fc26..85204b0 100644
--- a/pkg/front_end/testcases/dartdevc/factory_patch/libraries.json
+++ b/pkg/front_end/testcases/dartdevc/factory_patch/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "dartdevc": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/constructor_patch/libraries.json b/pkg/front_end/testcases/general/constructor_patch/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/constructor_patch/libraries.json
+++ b/pkg/front_end/testcases/general/constructor_patch/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/factory_patch/libraries.json b/pkg/front_end/testcases/general/factory_patch/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/factory_patch/libraries.json
+++ b/pkg/front_end/testcases/general/factory_patch/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/inject_private_patch/libraries.json b/pkg/front_end/testcases/general/inject_private_patch/libraries.json
index 1f01947..13750ab 100644
--- a/pkg/front_end/testcases/general/inject_private_patch/libraries.json
+++ b/pkg/front_end/testcases/general/inject_private_patch/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/inject_public/libraries.json b/pkg/front_end/testcases/general/inject_public/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/inject_public/libraries.json
+++ b/pkg/front_end/testcases/general/inject_public/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/issue45101/libraries.json b/pkg/front_end/testcases/general/issue45101/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/issue45101/libraries.json
+++ b/pkg/front_end/testcases/general/issue45101/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/mixin_from_patch/libraries.json b/pkg/front_end/testcases/general/mixin_from_patch/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/mixin_from_patch/libraries.json
+++ b/pkg/front_end/testcases/general/mixin_from_patch/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/multiple_class_patches/libraries.json b/pkg/front_end/testcases/general/multiple_class_patches/libraries.json
index 1f01947..13750ab 100644
--- a/pkg/front_end/testcases/general/multiple_class_patches/libraries.json
+++ b/pkg/front_end/testcases/general/multiple_class_patches/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/nested_lib_spec/extra_libraries.json b/pkg/front_end/testcases/general/nested_lib_spec/extra_libraries.json
index 4ef762a..e7d4211 100644
--- a/pkg/front_end/testcases/general/nested_lib_spec/extra_libraries.json
+++ b/pkg/front_end/testcases/general/nested_lib_spec/extra_libraries.json
@@ -1,5 +1,5 @@
 {
-  "_none": {
+  "_vm": {
     "include": [
       {
         "path": "subfolder/sub_libraries.json",
diff --git a/pkg/front_end/testcases/general/nested_lib_spec/libraries.json b/pkg/front_end/testcases/general/nested_lib_spec/libraries.json
index d405b29..649dee9 100644
--- a/pkg/front_end/testcases/general/nested_lib_spec/libraries.json
+++ b/pkg/front_end/testcases/general/nested_lib_spec/libraries.json
@@ -1,10 +1,10 @@
 {
   "comment:0": "This adds to the default libraries found in the platform.",
-  "none": {
+  "vm": {
     "include": [
       {
         "path": "extra_libraries.json",
-        "target": "_none"
+        "target": "_vm"
       },
       {
         "target": "common"
diff --git a/pkg/front_end/testcases/general/nested_lib_spec/subfolder/sub_libraries.json b/pkg/front_end/testcases/general/nested_lib_spec/subfolder/sub_libraries.json
index ca8782a..6049e30 100644
--- a/pkg/front_end/testcases/general/nested_lib_spec/subfolder/sub_libraries.json
+++ b/pkg/front_end/testcases/general/nested_lib_spec/subfolder/sub_libraries.json
@@ -3,10 +3,10 @@
     "include": [
       {
         "path": "../super1_libraries.json",
-        "target": "none"
+        "target": "vm"
       },
       { "path": "../../nested_lib_spec/super2_libraries.json",
-        "target": "none"
+        "target": "vm"
       }
     ],
     "libraries": {
diff --git a/pkg/front_end/testcases/general/nested_lib_spec/super1_libraries.json b/pkg/front_end/testcases/general/nested_lib_spec/super1_libraries.json
index 28bd7f2..d9c5ee7 100644
--- a/pkg/front_end/testcases/general/nested_lib_spec/super1_libraries.json
+++ b/pkg/front_end/testcases/general/nested_lib_spec/super1_libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "libraries": {
       "super1": {
         "uri": "super1_lib.dart"
diff --git a/pkg/front_end/testcases/general/nested_lib_spec/super2_libraries.json b/pkg/front_end/testcases/general/nested_lib_spec/super2_libraries.json
index f89a448..b31e460 100644
--- a/pkg/front_end/testcases/general/nested_lib_spec/super2_libraries.json
+++ b/pkg/front_end/testcases/general/nested_lib_spec/super2_libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "libraries": {
       "super2": {
         "uri": "subfolder/super2_lib.dart"
diff --git a/pkg/front_end/testcases/general/patch_annotations/libraries.json b/pkg/front_end/testcases/general/patch_annotations/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/patch_annotations/libraries.json
+++ b/pkg/front_end/testcases/general/patch_annotations/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/patch_conflict/libraries.json b/pkg/front_end/testcases/general/patch_conflict/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/patch_conflict/libraries.json
+++ b/pkg/front_end/testcases/general/patch_conflict/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/patch_extends_implements/libraries.json b/pkg/front_end/testcases/general/patch_extends_implements/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/patch_extends_implements/libraries.json
+++ b/pkg/front_end/testcases/general/patch_extends_implements/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/patch_extension_scope/libraries.json b/pkg/front_end/testcases/general/patch_extension_scope/libraries.json
index 1f01947..13750ab 100644
--- a/pkg/front_end/testcases/general/patch_extension_scope/libraries.json
+++ b/pkg/front_end/testcases/general/patch_extension_scope/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/platform_invalid_uris/libraries.json b/pkg/front_end/testcases/general/platform_invalid_uris/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/platform_invalid_uris/libraries.json
+++ b/pkg/front_end/testcases/general/platform_invalid_uris/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/general/supported_libraries/libraries.json b/pkg/front_end/testcases/general/supported_libraries/libraries.json
index 4f60b67..236dc81 100644
--- a/pkg/front_end/testcases/general/supported_libraries/libraries.json
+++ b/pkg/front_end/testcases/general/supported_libraries/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "supported.by.spec": {
diff --git a/pkg/front_end/testcases/general/tear_off_patch/libraries.json b/pkg/front_end/testcases/general/tear_off_patch/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/general/tear_off_patch/libraries.json
+++ b/pkg/front_end/testcases/general/tear_off_patch/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/late_lowering/injected_late_field_checks/libraries.json b/pkg/front_end/testcases/late_lowering/injected_late_field_checks/libraries.json
index 154c73c..b6f4bee 100644
--- a/pkg/front_end/testcases/late_lowering/injected_late_field_checks/libraries.json
+++ b/pkg/front_end/testcases/late_lowering/injected_late_field_checks/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "libraries": {
       "test": {
         "patches": [
diff --git a/pkg/front_end/testcases/late_lowering/issue41436/libraries.json b/pkg/front_end/testcases/late_lowering/issue41436/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/late_lowering/issue41436/libraries.json
+++ b/pkg/front_end/testcases/late_lowering/issue41436/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/modular.status b/pkg/front_end/testcases/modular.status
index 45e8ea7..fae9ac5 100644
--- a/pkg/front_end/testcases/modular.status
+++ b/pkg/front_end/testcases/modular.status
@@ -71,3 +71,10 @@
 nnbd/issue42603: TypeCheckError
 no_such_method_forwarders/mixin_nsm: TypeCheckError
 runtime_checks_new/mixin_forwarding_stub_getter: TypeCheckError
+
+# outline should not perform modular transformation
+dart2js/flutter_issue94561/main: ExpectationFileMismatch
+dart2js/mixin_super/main: ExpectationFileMismatch
+general/with_dependencies/mixin_from_dill/mixin_from_dill: ExpectationFileMismatch
+nnbd_mixed/hierarchy/in_dill_out_in/in_out_in: ExpectationFileMismatch
+nnbd_mixed/mixin_from_opt_in/main: ExpectationFileMismatch
\ No newline at end of file
diff --git a/pkg/front_end/testcases/nnbd/injected_late_field_checks/libraries.json b/pkg/front_end/testcases/nnbd/injected_late_field_checks/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/nnbd/injected_late_field_checks/libraries.json
+++ b/pkg/front_end/testcases/nnbd/injected_late_field_checks/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/nnbd/platform_definite_assignment/libraries.json b/pkg/front_end/testcases/nnbd/platform_definite_assignment/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/nnbd/platform_definite_assignment/libraries.json
+++ b/pkg/front_end/testcases/nnbd/platform_definite_assignment/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json
index fcc5ecc..f89ef7f 100644
--- a/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json
+++ b/pkg/front_end/testcases/nnbd/platform_nonnullable_fields/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/nnbd/platform_optional_parameters/libraries.json b/pkg/front_end/testcases/nnbd/platform_optional_parameters/libraries.json
index 6b6fc26..79373ad 100644
--- a/pkg/front_end/testcases/nnbd/platform_optional_parameters/libraries.json
+++ b/pkg/front_end/testcases/nnbd/platform_optional_parameters/libraries.json
@@ -1,5 +1,5 @@
 {
-  "none": {
+  "vm": {
     "comment:0": "This adds to the default libraries found in the platform.",
     "libraries": {
       "test": {
diff --git a/pkg/front_end/testcases/outline.status b/pkg/front_end/testcases/outline.status
index 6dd3920..0048a4d 100644
--- a/pkg/front_end/testcases/outline.status
+++ b/pkg/front_end/testcases/outline.status
@@ -69,3 +69,50 @@
 nnbd_mixed/covariant_from_opt_in: TypeCheckError
 no_such_method_forwarders/mixin_nsm: TypeCheckError
 rasta/native_is_illegal: Pass # Issue 29763
+
+# outline should not perform modular transformation
+dart2js/unresolved_dart_library/main: ExpectationFileMismatch
+dartdevc/static_interop_erasure/main: ExpectationFileMismatch
+dartdevc/unresolved_dart_library/main: ExpectationFileMismatch
+general/unresolved_dart_library/main: ExpectationFileMismatch
+
+# outline should not constant evaluate
+agnostic/typedef_tear_off/main: ExpectationFileMismatch
+class_modifiers/mixin/no_modifier_outside_library/main: ExpectationFileMismatch
+class_modifiers/mixin/no_modifier_outside_library_legacy/main: ExpectationFileMismatch
+class_modifiers/mixin/outside_library/main: ExpectationFileMismatch
+class_modifiers/mixin/outside_library_legacy/main: ExpectationFileMismatch
+constructor_tearoffs/lowering/typedef_from_dill/main: ExpectationFileMismatch
+dart2js/flutter_issue94561/main: ExpectationFileMismatch
+dart2js/late_from_dill/main: ExpectationFileMismatch
+dart2js/mixin_default_values/main: ExpectationFileMismatch
+dart2js/mixin_super/main: ExpectationFileMismatch
+dart2js/unresolved_dart_library/main: Pass
+dartdevc/extension_types/issue54008/main: ExpectationFileMismatch
+dartdevc/unresolved_dart_library/main: Pass
+extension_types/issue54008/main: ExpectationFileMismatch
+extensions/export_from_dill/main: ExpectationFileMismatch
+extensions/import_from_dill/main: ExpectationFileMismatch
+general/constants/from_lib/main: ExpectationFileMismatch
+general/error_export_from_dill/main: ExpectationFileMismatch
+general/export_builtin_from_dill/main: ExpectationFileMismatch
+general/instantiate_enum/main: ExpectationFileMismatch
+general/issue41210b/issue41210: ExpectationFileMismatch
+general/issue41210b/issue41210_no_error: ExpectationFileMismatch
+general/issue49697/main: ExpectationFileMismatch
+general/issue49697_2/main: ExpectationFileMismatch
+general/unresolved_dart_library/main: Pass
+general/with_dependencies/abstract_members_from_dill/main: ExpectationFileMismatch
+general/with_dependencies/issue43538/main: ExpectationFileMismatch
+general/with_dependencies/mixin_from_dill/mixin_from_dill: ExpectationFileMismatch
+nnbd/from_agnostic/from_agnostic: ExpectationFileMismatch
+nnbd_mixed/hierarchy/in_dill_out_in/in_out_in: ExpectationFileMismatch
+nnbd_mixed/hierarchy/in_out_dill_in/in_out_in: ExpectationFileMismatch
+nnbd_mixed/hierarchy/mixin_from_dill/main: ExpectationFileMismatch
+nnbd_mixed/issue40512/issue40512: ExpectationFileMismatch
+nnbd_mixed/issue41210a/issue41210: ExpectationFileMismatch
+nnbd_mixed/issue43988/main: ExpectationFileMismatch
+nnbd_mixed/mixin_from_dill2/main: ExpectationFileMismatch
+nnbd_mixed/mixin_from_opt_in/main: ExpectationFileMismatch
+patterns/issue51716/main: ExpectationFileMismatch
+super_parameters/super_key/main: ExpectationFileMismatch
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index 7d395aa..5036ab3 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -81,15 +81,31 @@
 records/nullable_access_extension: semiFuzzFailureOnForceRebuildBodies # unnamed extension
 
 # FUZZ FRAMEWORK FAILURES
-general/issue45101/main: semiFuzzFailureOnForceRebuildBodies # needs custom libraries.json (and platform?) not setup here
-general/mixin_from_patch/main: semiFuzzFailureOnForceRebuildBodies # needs custom libraries.json (and platform?) not setup here
-general/multiple_class_patches/main: semiFuzzFailureOnForceRebuildBodies # needs custom libraries.json (and platform?) not setup here
-general/nested_lib_spec/main: semiFuzzFailureOnForceRebuildBodies # needs custom libraries.json (and platform?) not setup here
-general/patch_annotations/main: semiFuzzFailureOnForceRebuildBodies # 'dart:test' stuff.
 general/script_tag_in_part_file: SemiFuzzFailure # `#!/usr/bin/env dart` goes away
-general/tear_off_patch/main: semiFuzzFailureOnForceRebuildBodies # needs custom libraries.json (and platform?) not setup here
 inference/downwards_inference_on_list_literals_infer_if_value_types_match_context: semiFuzzFailureOnForceRebuildBodies # private field
 inference_update_1/horizontal_inference_extension_method: semiFuzzFailureOnForceRebuildBodies # Errors on split
+# Incremental compiler doesn't see custom dart: libraries as dependencies on recompilation:
+dart2js/tear_off_patch/main: SemiFuzzFailure
+dartdevc/factory_patch/main: SemiFuzzFailure
+general/constructor_patch/main: SemiFuzzFailure
+general/factory_patch/main: SemiFuzzFailure
+general/inject_private_patch/main: SemiFuzzFailure
+general/inject_public/main: SemiFuzzFailure
+general/issue45101/main: SemiFuzzFailure
+general/mixin_from_patch/main: SemiFuzzFailure
+general/multiple_class_patches/main: SemiFuzzFailure
+general/nested_lib_spec/main: SemiFuzzFailure
+general/patch_annotations/main: SemiFuzzFailure
+general/patch_conflict/main: SemiFuzzFailure
+general/patch_extends_implements/main: SemiFuzzFailure
+general/patch_extension_scope/main: SemiFuzzFailure
+general/tear_off_patch/main: SemiFuzzFailure
+late_lowering/injected_late_field_checks/main: SemiFuzzFailure
+late_lowering/issue41436/issue41436: SemiFuzzFailure
+nnbd/injected_late_field_checks/main: SemiFuzzFailure
+nnbd/platform_definite_assignment/main: SemiFuzzFailure
+nnbd/platform_nonnullable_fields/main: SemiFuzzFailure
+nnbd/platform_optional_parameters/main: SemiFuzzFailure
 
 # UNSORTED ONES:
 constructor_tearoffs/explicit_instantiation: SemiFuzzFailure
@@ -291,3 +307,8 @@
 value_class/simple: RuntimeError # Expected
 value_class/value_extends_non_value: RuntimeError # Expected
 value_class/value_implements_non_value: RuntimeError # Expected
+
+# Verifier crashes in semi-fuzzing
+macros/extend_augmented: SemiFuzzCrash
+macros/augment_concrete: SemiFuzzCrash
+macros/multiple_augment_class: SemiFuzzCrash
\ No newline at end of file
diff --git a/pkg/front_end/testcases/weak.status b/pkg/front_end/testcases/weak.status
index 54c8426..bef3200 100644
--- a/pkg/front_end/testcases/weak.status
+++ b/pkg/front_end/testcases/weak.status
@@ -64,6 +64,7 @@
 records/nullable_access_extension: semiFuzzFailureOnForceRebuildBodies # unnamed extension
 
 # FUZZ FRAMEWORK FAILURES
+dart2js/tear_off_patch/main: SemiFuzzFailure # incremental compiler doesn't custom dart: libraries as dependencies on recompilation
 general/script_tag_in_part_file: SemiFuzzFailure # `#!/usr/bin/env dart` goes away
 
 # UNSORTED ONES:
diff --git a/pkg/front_end/tool/_fasta/entry_points.dart b/pkg/front_end/tool/_fasta/entry_points.dart
index de197e7..6a8f2b5 100644
--- a/pkg/front_end/tool/_fasta/entry_points.dart
+++ b/pkg/front_end/tool/_fasta/entry_points.dart
@@ -342,7 +342,7 @@
         print("Building outlines for ${arguments.join(' ')}");
       }
       CompilerResult compilerResult = await generateKernelInternal(
-          buildSummary: true, benchmarker: benchmarker);
+          buildSummary: true, buildComponent: false, benchmarker: benchmarker);
       Component component = compilerResult.component!;
       await _emitComponent(c.options, component,
           benchmarker: benchmarker, message: "Wrote outline to ");