Unverified Commit b07d986f authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Eliminate snapshot, depfile opts from bundle cmd (#22495)

Eliminates the --snapshot and --depfile parameters from the flutter
bundle command. The snapshot parameter is unused in Dart 2 -- code is
built to kernel .dill files and for profile/release builds, then AOT
compiled.

While depfiles are still used in Dart 2 (e.g. by the kernel compiler),
there are enough assumptions in the code that they lie in the default
location (e.g. in the Gradle build) and no reasons to support
user-cusomisation that it makes sense to eliminate the --depfile option
as well, and always use the default location.

This commit also renames 'depFilePath' to 'depfilePath' for consistency
across the codebase.
parent a7303e04
...@@ -308,7 +308,7 @@ class AOTSnapshotter { ...@@ -308,7 +308,7 @@ class AOTSnapshotter {
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
mainPath: mainPath, mainPath: mainPath,
outputFilePath: fs.path.join(outputPath, 'app.dill'), outputFilePath: fs.path.join(outputPath, 'app.dill'),
depFilePath: depfilePath, depfilePath: depfilePath,
extraFrontEndOptions: extraFrontEndOptions, extraFrontEndOptions: extraFrontEndOptions,
linkPlatformKernelIn: true, linkPlatformKernelIn: true,
aot: true, aot: true,
......
...@@ -35,9 +35,7 @@ Future<void> build({ ...@@ -35,9 +35,7 @@ Future<void> build({
BuildMode buildMode, BuildMode buildMode,
String mainPath = defaultMainPath, String mainPath = defaultMainPath,
String manifestPath = defaultManifestPath, String manifestPath = defaultManifestPath,
String snapshotPath,
String applicationKernelFilePath, String applicationKernelFilePath,
String depfilePath,
String privateKeyPath = defaultPrivateKeyPath, String privateKeyPath = defaultPrivateKeyPath,
String assetDirPath, String assetDirPath,
String packagesPath, String packagesPath,
...@@ -51,8 +49,6 @@ Future<void> build({ ...@@ -51,8 +49,6 @@ Future<void> build({
List<String> fileSystemRoots, List<String> fileSystemRoots,
String fileSystemScheme, String fileSystemScheme,
}) async { }) async {
snapshotPath ??= defaultSnapshotPath;
depfilePath ??= defaultDepfilePath;
assetDirPath ??= getAssetBuildDirectory(); assetDirPath ??= getAssetBuildDirectory();
packagesPath ??= fs.path.absolute(PackageMap.globalPackagesPath); packagesPath ??= fs.path.absolute(PackageMap.globalPackagesPath);
applicationKernelFilePath ??= defaultApplicationKernelPath; applicationKernelFilePath ??= defaultApplicationKernelPath;
...@@ -68,7 +64,7 @@ Future<void> build({ ...@@ -68,7 +64,7 @@ Future<void> build({
fs.path.absolute(getIncrementalCompilerByteStoreDirectory()), fs.path.absolute(getIncrementalCompilerByteStoreDirectory()),
mainPath: fs.file(mainPath).absolute.path, mainPath: fs.file(mainPath).absolute.path,
outputFilePath: applicationKernelFilePath, outputFilePath: applicationKernelFilePath,
depFilePath: depfilePath, depfilePath: defaultDepfilePath,
trackWidgetCreation: trackWidgetCreation, trackWidgetCreation: trackWidgetCreation,
extraFrontEndOptions: extraFrontEndOptions, extraFrontEndOptions: extraFrontEndOptions,
fileSystemRoots: fileSystemRoots, fileSystemRoots: fileSystemRoots,
......
...@@ -22,8 +22,6 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -22,8 +22,6 @@ class BuildBundleCommand extends BuildSubCommand {
..addOption('asset-base', help: 'Ignored. Will be removed.', hide: !verboseHelp) ..addOption('asset-base', help: 'Ignored. Will be removed.', hide: !verboseHelp)
..addOption('manifest', defaultsTo: defaultManifestPath) ..addOption('manifest', defaultsTo: defaultManifestPath)
..addOption('private-key', defaultsTo: defaultPrivateKeyPath) ..addOption('private-key', defaultsTo: defaultPrivateKeyPath)
..addOption('snapshot', defaultsTo: defaultSnapshotPath)
..addOption('depfile', defaultsTo: defaultDepfilePath)
..addOption('kernel-file', defaultsTo: defaultApplicationKernelPath) ..addOption('kernel-file', defaultsTo: defaultApplicationKernelPath)
..addOption('target-platform', ..addOption('target-platform',
defaultsTo: 'android-arm', defaultsTo: 'android-arm',
...@@ -93,9 +91,7 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -93,9 +91,7 @@ class BuildBundleCommand extends BuildSubCommand {
buildMode: buildMode, buildMode: buildMode,
mainPath: targetFile, mainPath: targetFile,
manifestPath: argResults['manifest'], manifestPath: argResults['manifest'],
snapshotPath: argResults['snapshot'],
applicationKernelFilePath: argResults['kernel-file'], applicationKernelFilePath: argResults['kernel-file'],
depfilePath: argResults['depfile'],
privateKeyPath: argResults['private-key'], privateKeyPath: argResults['private-key'],
assetDirPath: argResults['asset-dir'], assetDirPath: argResults['asset-dir'],
precompiledSnapshot: argResults['precompiled'], precompiledSnapshot: argResults['precompiled'],
......
...@@ -81,7 +81,7 @@ class KernelCompiler { ...@@ -81,7 +81,7 @@ class KernelCompiler {
String sdkRoot, String sdkRoot,
String mainPath, String mainPath,
String outputFilePath, String outputFilePath,
String depFilePath, String depfilePath,
bool linkPlatformKernelIn = false, bool linkPlatformKernelIn = false,
bool aot = false, bool aot = false,
bool trackWidgetCreation = false, bool trackWidgetCreation = false,
...@@ -100,16 +100,16 @@ class KernelCompiler { ...@@ -100,16 +100,16 @@ class KernelCompiler {
// Currently the compiler emits buildbot paths for the core libs in the // Currently the compiler emits buildbot paths for the core libs in the
// depfile. None of these are available on the local host. // depfile. None of these are available on the local host.
Fingerprinter fingerprinter; Fingerprinter fingerprinter;
if (depFilePath != null) { if (depfilePath != null) {
fingerprinter = Fingerprinter( fingerprinter = Fingerprinter(
fingerprintPath: '$depFilePath.fingerprint', fingerprintPath: '$depfilePath.fingerprint',
paths: <String>[mainPath], paths: <String>[mainPath],
properties: <String, String>{ properties: <String, String>{
'entryPoint': mainPath, 'entryPoint': mainPath,
'trackWidgetCreation': trackWidgetCreation.toString(), 'trackWidgetCreation': trackWidgetCreation.toString(),
'linkPlatformKernelIn': linkPlatformKernelIn.toString(), 'linkPlatformKernelIn': linkPlatformKernelIn.toString(),
}, },
depfilePaths: <String>[depFilePath], depfilePaths: <String>[depfilePath],
pathFilter: (String path) => !path.startsWith('/b/build/slave/'), pathFilter: (String path) => !path.startsWith('/b/build/slave/'),
); );
...@@ -154,8 +154,8 @@ class KernelCompiler { ...@@ -154,8 +154,8 @@ class KernelCompiler {
if (outputFilePath != null) { if (outputFilePath != null) {
command.addAll(<String>['--output-dill', outputFilePath]); command.addAll(<String>['--output-dill', outputFilePath]);
} }
if (depFilePath != null && (fileSystemRoots == null || fileSystemRoots.isEmpty)) { if (depfilePath != null && (fileSystemRoots == null || fileSystemRoots.isEmpty)) {
command.addAll(<String>['--depfile', depFilePath]); command.addAll(<String>['--depfile', depfilePath]);
} }
if (fileSystemRoots != null) { if (fileSystemRoots != null) {
for (String root in fileSystemRoots) { for (String root in fileSystemRoots) {
......
...@@ -169,7 +169,7 @@ Hello! ...@@ -169,7 +169,7 @@ Hello!
incrementalCompilerByteStorePath: anyNamed('incrementalCompilerByteStorePath'), incrementalCompilerByteStorePath: anyNamed('incrementalCompilerByteStorePath'),
mainPath: anyNamed('mainPath'), mainPath: anyNamed('mainPath'),
outputFilePath: anyNamed('outputFilePath'), outputFilePath: anyNamed('outputFilePath'),
depFilePath: anyNamed('depFilePath'), depfilePath: anyNamed('depfilePath'),
trackWidgetCreation: anyNamed('trackWidgetCreation'), trackWidgetCreation: anyNamed('trackWidgetCreation'),
extraFrontEndOptions: anyNamed('extraFrontEndOptions'), extraFrontEndOptions: anyNamed('extraFrontEndOptions'),
fileSystemRoots: anyNamed('fileSystemRoots'), fileSystemRoots: anyNamed('fileSystemRoots'),
......
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