Unverified Commit 7c2fe34f authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Run 'flutter test --preview-dart-2' in strong mode (#14188)

* Default to strong for 'flutter test --preview-dart-2' mode

* Remove empty line

* Dont init to null

* Break up line to make it more readable

* Add missing type annotation
parent 733bd049
......@@ -199,17 +199,39 @@ class _FlutterPlatform extends PlatformPlugin {
// Start the engine subprocess.
printTrace('test $ourTestCount: starting shell process${previewDart2? " in preview-dart-2 mode":""}');
final String mainDart = previewDart2
? await compile(
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
incrementalCompilerByteStorePath: '' /* not null is enough */,
mainPath: listenerFile.path,
packagesPath: PackageMap.globalPackagesPath
)
: listenerFile.path;
// bundlePath needs to point to a folder with `platform.dill` file.
final String bundlePath = previewDart2 ? artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath) : null;
String mainDart = listenerFile.path;
String bundlePath;
bool strongMode = false;
if (previewDart2) {
mainDart = await compile(
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
incrementalCompilerByteStorePath: '' /* not null is enough */,
mainPath: listenerFile.path,
packagesPath: PackageMap.globalPackagesPath,
strongMode: true,
);
// bundlePath needs to point to a folder with `platform.dill` file.
final Directory tempBundleDirectory = fs.systemTempDirectory
.createTempSync('flutter_bundle_directory');
finalizers.add(() async {
printTrace('test $ourTestCount: deleting temporary bundle directory');
temporaryDirectory.deleteSync(recursive: true);
});
// copy 'vm_platform_strong.dill' into 'platform.dill'
final File vmPlatformStrongDill = fs.file(
artifacts.getArtifactPath(Artifact.platformKernelStrongDill));
final File platformDill = vmPlatformStrongDill.copySync(
tempBundleDirectory.childFile('platform.dill').path);
if (!platformDill.existsSync()) {
printError('unexpected error copying platform kernel file');
}
bundlePath = tempBundleDirectory.path;
strongMode = true;
}
final Process process = await _startProcess(
shellPath,
......@@ -217,8 +239,9 @@ class _FlutterPlatform extends PlatformPlugin {
packages: PackageMap.globalPackagesPath,
enableObservatory: enableObservatory,
startPaused: startPaused,
observatoryPort: explicitObservatoryPort,
bundlePath: bundlePath,
strongMode: strongMode,
observatoryPort: explicitObservatoryPort,
);
subprocessActive = true;
finalizers.add(() async {
......@@ -489,6 +512,7 @@ void main() {
String bundlePath,
bool enableObservatory: false,
bool startPaused: false,
bool strongMode: false,
int observatoryPort,
}) {
assert(executable != null); // Please provide the path to the shell in the SKY_SHELL environment variable.
......@@ -516,6 +540,9 @@ void main() {
if (bundlePath != null) {
command.add('--flutter-assets-dir=$bundlePath');
}
if (strongMode) {
command.add('--strong');
}
command.addAll(<String>[
'--enable-dart-profiling',
'--non-interactive',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment