[flutter_tools] add flag for sound-null-safety, unify with experiments (#58533)
Also combines experiments into extraGenSnapshot/ExtraFrontEndOptions. Allows providing --no-sound-null-safety to allow out of order migration and running.
This commit is contained in:
@@ -88,7 +88,7 @@ FlutterPlatform installHook({
|
||||
FlutterProject flutterProject,
|
||||
String icudtlPath,
|
||||
PlatformPluginRegistration platformPluginRegistration,
|
||||
@required List<String> dartExperiments,
|
||||
@required List<String> extraFrontEndOptions,
|
||||
}) {
|
||||
assert(testWrapper != null);
|
||||
assert(enableObservatory || (!startPaused && observatoryPort == null));
|
||||
@@ -121,7 +121,7 @@ FlutterPlatform installHook({
|
||||
projectRootDirectory: projectRootDirectory,
|
||||
flutterProject: flutterProject,
|
||||
icudtlPath: icudtlPath,
|
||||
dartExperiments: dartExperiments,
|
||||
extraFrontEndOptions: extraFrontEndOptions,
|
||||
);
|
||||
platformPluginRegistration(platform);
|
||||
return platform;
|
||||
@@ -269,7 +269,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
this.projectRootDirectory,
|
||||
this.flutterProject,
|
||||
this.icudtlPath,
|
||||
@required this.dartExperiments,
|
||||
@required this.extraFrontEndOptions,
|
||||
}) : assert(shellPath != null);
|
||||
|
||||
final String shellPath;
|
||||
@@ -290,7 +290,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
final Uri projectRootDirectory;
|
||||
final FlutterProject flutterProject;
|
||||
final String icudtlPath;
|
||||
final List<String> dartExperiments;
|
||||
final List<String> extraFrontEndOptions;
|
||||
|
||||
Directory fontsDirectory;
|
||||
|
||||
@@ -459,7 +459,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
|
||||
if (precompiledDillPath == null && precompiledDillFiles == null) {
|
||||
// Lazily instantiate compiler so it is built only if it is actually used.
|
||||
compiler ??= TestCompiler(buildMode, trackWidgetCreation, flutterProject, dartExperiments);
|
||||
compiler ??= TestCompiler(buildMode, trackWidgetCreation, flutterProject, extraFrontEndOptions);
|
||||
mainDart = await compiler.compile(globals.fs.file(mainDart).uri);
|
||||
|
||||
if (mainDart == null) {
|
||||
@@ -751,7 +751,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
testConfigFile: findTestConfigFile(globals.fs.file(testUrl)),
|
||||
host: host,
|
||||
updateGoldens: updateGoldens,
|
||||
nullSafety: dartExperiments.contains('non-nullable'),
|
||||
nullSafety: extraFrontEndOptions?.contains('--enable-experiment=non-nullable') ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ abstract class FlutterTestRunner {
|
||||
Directory coverageDirectory,
|
||||
bool web = false,
|
||||
String randomSeed,
|
||||
@required List<String> dartExperiments,
|
||||
@required List<String> extraFrontEndOptions,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
|
||||
Directory coverageDirectory,
|
||||
bool web = false,
|
||||
String randomSeed,
|
||||
@required List<String> dartExperiments,
|
||||
@required List<String> extraFrontEndOptions,
|
||||
}) async {
|
||||
// Configure package:test to use the Flutter engine for child processes.
|
||||
final String shellPath = globals.artifacts.getArtifactPath(Artifact.flutterTester);
|
||||
@@ -177,7 +177,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
|
||||
projectRootDirectory: globals.fs.currentDirectory.uri,
|
||||
flutterProject: flutterProject,
|
||||
icudtlPath: icudtlPath,
|
||||
dartExperiments: dartExperiments,
|
||||
extraFrontEndOptions: extraFrontEndOptions,
|
||||
);
|
||||
|
||||
// Make the global packages path absolute.
|
||||
|
||||
@@ -42,7 +42,7 @@ class TestCompiler {
|
||||
this.buildMode,
|
||||
this.trackWidgetCreation,
|
||||
this.flutterProject,
|
||||
this.dartExperiments,
|
||||
this.extraFrontEndOptions,
|
||||
) : testFilePath = getKernelPathForTransformerOptions(
|
||||
globals.fs.path.join(flutterProject.directory.path, getBuildDirectory(), 'testfile.dill'),
|
||||
trackWidgetCreation: trackWidgetCreation,
|
||||
@@ -66,7 +66,7 @@ class TestCompiler {
|
||||
final BuildMode buildMode;
|
||||
final bool trackWidgetCreation;
|
||||
final String testFilePath;
|
||||
final List<String> dartExperiments;
|
||||
final List<String> extraFrontEndOptions;
|
||||
|
||||
|
||||
ResidentCompiler compiler;
|
||||
@@ -106,7 +106,7 @@ class TestCompiler {
|
||||
unsafePackageSerialization: false,
|
||||
dartDefines: const <String>[],
|
||||
packagesPath: globalPackagesPath,
|
||||
experimentalFlags: dartExperiments,
|
||||
extraFrontEndOptions: extraFrontEndOptions,
|
||||
);
|
||||
if (flutterProject.hasBuilders) {
|
||||
return CodeGeneratingResidentCompiler.create(
|
||||
|
||||
Reference in New Issue
Block a user