[flutter_tools] reduce build bundle API (#70514)

This commit is contained in:
Jonah Williams 2020-11-17 11:55:20 -08:00 committed by GitHub
parent a228a17c57
commit fa41afa82e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 33 deletions

View file

@ -82,8 +82,6 @@ class BundleBuilder {
String applicationKernelFilePath,
String depfilePath,
String assetDirPath,
bool precompiledSnapshot = false,
bool reportLicensedPackages = false,
bool trackWidgetCreation = false,
List<String> extraFrontEndOptions = const <String>[],
List<String> extraGenSnapshotOptions = const <String>[],
@ -102,7 +100,6 @@ class BundleBuilder {
flutterProject: flutterProject,
outputDir: assetDirPath,
depfilePath: depfilePath,
precompiled: precompiledSnapshot,
trackWidgetCreation: trackWidgetCreation,
treeShakeIcons: treeShakeIcons,
dartDefines: buildInfo.dartDefines,
@ -128,13 +125,11 @@ Future<void> buildWithAssemble({
@required String mainPath,
@required String outputDir,
@required String depfilePath,
@required bool precompiled,
bool trackWidgetCreation,
@required bool treeShakeIcons,
List<String> dartDefines,
}) async {
// If the precompiled flag was not passed, force us into debug mode.
buildMode = precompiled ? buildMode : BuildMode.debug;
final Environment environment = Environment(
projectDir: flutterProject.directory,
outputDir: globals.fs.directory(outputDir),

View file

@ -18,22 +18,9 @@ class BuildBundleCommand extends BuildSubCommand {
usesTargetOption();
usesFilesystemOptions(hide: !verboseHelp);
usesBuildNumberOption();
addBuildModeFlags(verboseHelp: verboseHelp);
addBuildModeFlags(verboseHelp: verboseHelp, defaultToRelease: false);
usesExtraDartFlagOptions();
argParser
..addFlag(
'precompiled',
negatable: false,
help:
'If not provided, then '
'a debug build is always provided, regardless of build mode. If provided '
'then release is the default mode.',
)
// This option is still referenced by the iOS build scripts. We should
// remove it once we've updated those build scripts.
..addOption('asset-base', help: 'Ignored. Will be removed.', hide: !verboseHelp)
..addOption('manifest', defaultsTo: defaultManifestPath)
..addOption('private-key', defaultsTo: defaultPrivateKeyPath)
..addOption('depfile', defaultsTo: defaultDepfilePath)
..addOption('target-platform',
defaultsTo: 'android-arm',
@ -48,11 +35,7 @@ class BuildBundleCommand extends BuildSubCommand {
'windows-x64',
],
)
..addOption('asset-dir', defaultsTo: getAssetBuildDirectory())
..addFlag('report-licensed-packages',
help: 'Whether to report the names of all the packages that are included '
"in the application's LICENSE file.",
defaultsTo: false);
..addOption('asset-dir', defaultsTo: getAssetBuildDirectory());
usesPubOption();
usesTrackWidgetCreation(verboseHelp: verboseHelp);
@ -119,11 +102,9 @@ class BuildBundleCommand extends BuildSubCommand {
platform: platform,
buildInfo: buildInfo,
mainPath: targetFile,
manifestPath: stringArg('manifest'),
manifestPath: defaultManifestPath,
depfilePath: stringArg('depfile'),
assetDirPath: stringArg('asset-dir'),
precompiledSnapshot: boolArg('precompiled'),
reportLicensedPackages: boolArg('report-licensed-packages'),
trackWidgetCreation: boolArg('track-widget-creation'),
extraFrontEndOptions: buildInfo.extraFrontEndOptions,
extraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions,

View file

@ -158,9 +158,7 @@ class FlutterTesterDevice extends Device {
await BundleBuilder().build(
buildInfo: buildInfo,
mainPath: mainPath,
assetDirPath: assetDirPath,
applicationKernelFilePath: applicationKernelFilePath,
precompiledSnapshot: false,
trackWidgetCreation: buildInfo.trackWidgetCreation,
platform: getTargetPlatformForName(getNameForHostPlatform(getCurrentHostPlatform())),
treeShakeIcons: buildInfo.treeShakeIcons,

View file

@ -39,8 +39,6 @@ void main() {
applicationKernelFilePath: anyNamed('applicationKernelFilePath'),
depfilePath: anyNamed('depfilePath'),
assetDirPath: anyNamed('assetDirPath'),
precompiledSnapshot: anyNamed('precompiledSnapshot'),
reportLicensedPackages: anyNamed('reportLicensedPackages'),
trackWidgetCreation: anyNamed('trackWidgetCreation'),
extraFrontEndOptions: anyNamed('extraFrontEndOptions'),
extraGenSnapshotOptions: anyNamed('extraGenSnapshotOptions'),

View file

@ -38,7 +38,6 @@ void main() {
outputDir: 'example',
targetPlatform: TargetPlatform.ios,
depfilePath: 'example.d',
precompiled: false,
treeShakeIcons: false,
);
expect(globals.fs.file(globals.fs.path.join('example', 'kernel_blob.bin')).existsSync(), true);
@ -61,7 +60,6 @@ void main() {
outputDir: 'example',
targetPlatform: TargetPlatform.linux_x64,
depfilePath: 'example.d',
precompiled: false,
treeShakeIcons: false,
), throwsToolExit());
}));