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 { ...@@ -199,17 +199,39 @@ class _FlutterPlatform extends PlatformPlugin {
// Start the engine subprocess. // Start the engine subprocess.
printTrace('test $ourTestCount: starting shell process${previewDart2? " in preview-dart-2 mode":""}'); printTrace('test $ourTestCount: starting shell process${previewDart2? " in preview-dart-2 mode":""}');
final String mainDart = previewDart2 String mainDart = listenerFile.path;
? await compile( String bundlePath;
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), bool strongMode = false;
incrementalCompilerByteStorePath: '' /* not null is enough */,
mainPath: listenerFile.path, if (previewDart2) {
packagesPath: PackageMap.globalPackagesPath mainDart = await compile(
) sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
: listenerFile.path; incrementalCompilerByteStorePath: '' /* not null is enough */,
mainPath: listenerFile.path,
// bundlePath needs to point to a folder with `platform.dill` file. packagesPath: PackageMap.globalPackagesPath,
final String bundlePath = previewDart2 ? artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath) : null; 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( final Process process = await _startProcess(
shellPath, shellPath,
...@@ -217,8 +239,9 @@ class _FlutterPlatform extends PlatformPlugin { ...@@ -217,8 +239,9 @@ class _FlutterPlatform extends PlatformPlugin {
packages: PackageMap.globalPackagesPath, packages: PackageMap.globalPackagesPath,
enableObservatory: enableObservatory, enableObservatory: enableObservatory,
startPaused: startPaused, startPaused: startPaused,
observatoryPort: explicitObservatoryPort,
bundlePath: bundlePath, bundlePath: bundlePath,
strongMode: strongMode,
observatoryPort: explicitObservatoryPort,
); );
subprocessActive = true; subprocessActive = true;
finalizers.add(() async { finalizers.add(() async {
...@@ -489,6 +512,7 @@ void main() { ...@@ -489,6 +512,7 @@ void main() {
String bundlePath, String bundlePath,
bool enableObservatory: false, bool enableObservatory: false,
bool startPaused: false, bool startPaused: false,
bool strongMode: false,
int observatoryPort, int observatoryPort,
}) { }) {
assert(executable != null); // Please provide the path to the shell in the SKY_SHELL environment variable. assert(executable != null); // Please provide the path to the shell in the SKY_SHELL environment variable.
...@@ -516,6 +540,9 @@ void main() { ...@@ -516,6 +540,9 @@ void main() {
if (bundlePath != null) { if (bundlePath != null) {
command.add('--flutter-assets-dir=$bundlePath'); command.add('--flutter-assets-dir=$bundlePath');
} }
if (strongMode) {
command.add('--strong');
}
command.addAll(<String>[ command.addAll(<String>[
'--enable-dart-profiling', '--enable-dart-profiling',
'--non-interactive', '--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