From 698e1016bb076884c3e99c118efca8edb0b1dc17 Mon Sep 17 00:00:00 2001 From: sjindel-google Date: Fri, 29 Jun 2018 17:01:34 +0200 Subject: [PATCH] Let the Kernel FE know whether it's building for a release VM. (#18876) Fixes #18829 --- packages/flutter_tools/lib/src/base/build.dart | 1 + packages/flutter_tools/lib/src/compile.dart | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart index 445a2ab7c7a..be04e01772b 100644 --- a/packages/flutter_tools/lib/src/base/build.dart +++ b/packages/flutter_tools/lib/src/base/build.dart @@ -391,6 +391,7 @@ class AOTSnapshotter { aot: true, entryPointsJsonFiles: entryPointsJsonFiles, trackWidgetCreation: false, + targetProductVm: buildMode == BuildMode.release, ); // Write path to frontend_server, since things need to be re-generated when that changes. diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index 012373f14b5..22b88546b95 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -84,6 +84,7 @@ class KernelCompiler { String packagesPath, List fileSystemRoots, String fileSystemScheme, + bool targetProductVm = false, }) async { final String frontendServer = artifacts.getArtifactPath( Artifact.frontendServerSnapshotForEngineDartSdk @@ -134,6 +135,9 @@ class KernelCompiler { command.add('--aot'); command.add('--tfa'); } + if (targetProductVm) { + command.add('-Ddart.vm.product=true'); + } if (entryPointsJsonFiles != null) { for (String entryPointsJson in entryPointsJsonFiles) { command.addAll(['--entry-points', entryPointsJson]);