From 224f91e386c375f1b0feffe516789048fb15cf88 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Mon, 1 Oct 2018 10:49:39 -0700 Subject: [PATCH] Revert "Eliminate snapshot, depfile opts from bundle cmd (#22495)" (#22519) This reverts commit b07d986f66f840603c8d411425eafc7621f2539a. --- packages/flutter_tools/lib/src/base/build.dart | 2 +- packages/flutter_tools/lib/src/bundle.dart | 6 +++++- .../flutter_tools/lib/src/commands/build_bundle.dart | 4 ++++ packages/flutter_tools/lib/src/compile.dart | 12 ++++++------ .../test/tester/flutter_tester_test.dart | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart index 06728cb71f..1f85fd031f 100644 --- a/packages/flutter_tools/lib/src/base/build.dart +++ b/packages/flutter_tools/lib/src/base/build.dart @@ -308,7 +308,7 @@ class AOTSnapshotter { sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), mainPath: mainPath, outputFilePath: fs.path.join(outputPath, 'app.dill'), - depfilePath: depfilePath, + depFilePath: depfilePath, extraFrontEndOptions: extraFrontEndOptions, linkPlatformKernelIn: true, aot: true, diff --git a/packages/flutter_tools/lib/src/bundle.dart b/packages/flutter_tools/lib/src/bundle.dart index 2a1a529698..db1b56945e 100644 --- a/packages/flutter_tools/lib/src/bundle.dart +++ b/packages/flutter_tools/lib/src/bundle.dart @@ -35,7 +35,9 @@ Future build({ BuildMode buildMode, String mainPath = defaultMainPath, String manifestPath = defaultManifestPath, + String snapshotPath, String applicationKernelFilePath, + String depfilePath, String privateKeyPath = defaultPrivateKeyPath, String assetDirPath, String packagesPath, @@ -49,6 +51,8 @@ Future build({ List fileSystemRoots, String fileSystemScheme, }) async { + snapshotPath ??= defaultSnapshotPath; + depfilePath ??= defaultDepfilePath; assetDirPath ??= getAssetBuildDirectory(); packagesPath ??= fs.path.absolute(PackageMap.globalPackagesPath); applicationKernelFilePath ??= defaultApplicationKernelPath; @@ -64,7 +68,7 @@ Future build({ fs.path.absolute(getIncrementalCompilerByteStoreDirectory()), mainPath: fs.file(mainPath).absolute.path, outputFilePath: applicationKernelFilePath, - depfilePath: defaultDepfilePath, + depFilePath: depfilePath, trackWidgetCreation: trackWidgetCreation, extraFrontEndOptions: extraFrontEndOptions, fileSystemRoots: fileSystemRoots, diff --git a/packages/flutter_tools/lib/src/commands/build_bundle.dart b/packages/flutter_tools/lib/src/commands/build_bundle.dart index 3a4d6b62b9..c46d6b5600 100644 --- a/packages/flutter_tools/lib/src/commands/build_bundle.dart +++ b/packages/flutter_tools/lib/src/commands/build_bundle.dart @@ -22,6 +22,8 @@ class BuildBundleCommand extends BuildSubCommand { ..addOption('asset-base', help: 'Ignored. Will be removed.', hide: !verboseHelp) ..addOption('manifest', defaultsTo: defaultManifestPath) ..addOption('private-key', defaultsTo: defaultPrivateKeyPath) + ..addOption('snapshot', defaultsTo: defaultSnapshotPath) + ..addOption('depfile', defaultsTo: defaultDepfilePath) ..addOption('kernel-file', defaultsTo: defaultApplicationKernelPath) ..addOption('target-platform', defaultsTo: 'android-arm', @@ -91,7 +93,9 @@ class BuildBundleCommand extends BuildSubCommand { buildMode: buildMode, mainPath: targetFile, manifestPath: argResults['manifest'], + snapshotPath: argResults['snapshot'], applicationKernelFilePath: argResults['kernel-file'], + depfilePath: argResults['depfile'], privateKeyPath: argResults['private-key'], assetDirPath: argResults['asset-dir'], precompiledSnapshot: argResults['precompiled'], diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index e5938cb9a1..c2b0352b03 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -81,7 +81,7 @@ class KernelCompiler { String sdkRoot, String mainPath, String outputFilePath, - String depfilePath, + String depFilePath, bool linkPlatformKernelIn = false, bool aot = false, bool trackWidgetCreation = false, @@ -100,16 +100,16 @@ class KernelCompiler { // Currently the compiler emits buildbot paths for the core libs in the // depfile. None of these are available on the local host. Fingerprinter fingerprinter; - if (depfilePath != null) { + if (depFilePath != null) { fingerprinter = Fingerprinter( - fingerprintPath: '$depfilePath.fingerprint', + fingerprintPath: '$depFilePath.fingerprint', paths: [mainPath], properties: { 'entryPoint': mainPath, 'trackWidgetCreation': trackWidgetCreation.toString(), 'linkPlatformKernelIn': linkPlatformKernelIn.toString(), }, - depfilePaths: [depfilePath], + depfilePaths: [depFilePath], pathFilter: (String path) => !path.startsWith('/b/build/slave/'), ); @@ -154,8 +154,8 @@ class KernelCompiler { if (outputFilePath != null) { command.addAll(['--output-dill', outputFilePath]); } - if (depfilePath != null && (fileSystemRoots == null || fileSystemRoots.isEmpty)) { - command.addAll(['--depfile', depfilePath]); + if (depFilePath != null && (fileSystemRoots == null || fileSystemRoots.isEmpty)) { + command.addAll(['--depfile', depFilePath]); } if (fileSystemRoots != null) { for (String root in fileSystemRoots) { diff --git a/packages/flutter_tools/test/tester/flutter_tester_test.dart b/packages/flutter_tools/test/tester/flutter_tester_test.dart index 33222da487..5b7aa26d8c 100644 --- a/packages/flutter_tools/test/tester/flutter_tester_test.dart +++ b/packages/flutter_tools/test/tester/flutter_tester_test.dart @@ -169,7 +169,7 @@ Hello! incrementalCompilerByteStorePath: anyNamed('incrementalCompilerByteStorePath'), mainPath: anyNamed('mainPath'), outputFilePath: anyNamed('outputFilePath'), - depfilePath: anyNamed('depfilePath'), + depFilePath: anyNamed('depFilePath'), trackWidgetCreation: anyNamed('trackWidgetCreation'), extraFrontEndOptions: anyNamed('extraFrontEndOptions'), fileSystemRoots: anyNamed('fileSystemRoots'),