mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
[flutter_tools] reduce build bundle API (#70514)
This commit is contained in:
parent
a228a17c57
commit
fa41afa82e
|
@ -82,8 +82,6 @@ class BundleBuilder {
|
||||||
String applicationKernelFilePath,
|
String applicationKernelFilePath,
|
||||||
String depfilePath,
|
String depfilePath,
|
||||||
String assetDirPath,
|
String assetDirPath,
|
||||||
bool precompiledSnapshot = false,
|
|
||||||
bool reportLicensedPackages = false,
|
|
||||||
bool trackWidgetCreation = false,
|
bool trackWidgetCreation = false,
|
||||||
List<String> extraFrontEndOptions = const <String>[],
|
List<String> extraFrontEndOptions = const <String>[],
|
||||||
List<String> extraGenSnapshotOptions = const <String>[],
|
List<String> extraGenSnapshotOptions = const <String>[],
|
||||||
|
@ -102,7 +100,6 @@ class BundleBuilder {
|
||||||
flutterProject: flutterProject,
|
flutterProject: flutterProject,
|
||||||
outputDir: assetDirPath,
|
outputDir: assetDirPath,
|
||||||
depfilePath: depfilePath,
|
depfilePath: depfilePath,
|
||||||
precompiled: precompiledSnapshot,
|
|
||||||
trackWidgetCreation: trackWidgetCreation,
|
trackWidgetCreation: trackWidgetCreation,
|
||||||
treeShakeIcons: treeShakeIcons,
|
treeShakeIcons: treeShakeIcons,
|
||||||
dartDefines: buildInfo.dartDefines,
|
dartDefines: buildInfo.dartDefines,
|
||||||
|
@ -128,13 +125,11 @@ Future<void> buildWithAssemble({
|
||||||
@required String mainPath,
|
@required String mainPath,
|
||||||
@required String outputDir,
|
@required String outputDir,
|
||||||
@required String depfilePath,
|
@required String depfilePath,
|
||||||
@required bool precompiled,
|
|
||||||
bool trackWidgetCreation,
|
bool trackWidgetCreation,
|
||||||
@required bool treeShakeIcons,
|
@required bool treeShakeIcons,
|
||||||
List<String> dartDefines,
|
List<String> dartDefines,
|
||||||
}) async {
|
}) async {
|
||||||
// If the precompiled flag was not passed, force us into debug mode.
|
// If the precompiled flag was not passed, force us into debug mode.
|
||||||
buildMode = precompiled ? buildMode : BuildMode.debug;
|
|
||||||
final Environment environment = Environment(
|
final Environment environment = Environment(
|
||||||
projectDir: flutterProject.directory,
|
projectDir: flutterProject.directory,
|
||||||
outputDir: globals.fs.directory(outputDir),
|
outputDir: globals.fs.directory(outputDir),
|
||||||
|
|
|
@ -18,22 +18,9 @@ class BuildBundleCommand extends BuildSubCommand {
|
||||||
usesTargetOption();
|
usesTargetOption();
|
||||||
usesFilesystemOptions(hide: !verboseHelp);
|
usesFilesystemOptions(hide: !verboseHelp);
|
||||||
usesBuildNumberOption();
|
usesBuildNumberOption();
|
||||||
addBuildModeFlags(verboseHelp: verboseHelp);
|
addBuildModeFlags(verboseHelp: verboseHelp, defaultToRelease: false);
|
||||||
usesExtraDartFlagOptions();
|
usesExtraDartFlagOptions();
|
||||||
argParser
|
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('depfile', defaultsTo: defaultDepfilePath)
|
||||||
..addOption('target-platform',
|
..addOption('target-platform',
|
||||||
defaultsTo: 'android-arm',
|
defaultsTo: 'android-arm',
|
||||||
|
@ -48,11 +35,7 @@ class BuildBundleCommand extends BuildSubCommand {
|
||||||
'windows-x64',
|
'windows-x64',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
..addOption('asset-dir', defaultsTo: getAssetBuildDirectory())
|
..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);
|
|
||||||
usesPubOption();
|
usesPubOption();
|
||||||
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
||||||
|
|
||||||
|
@ -119,11 +102,9 @@ class BuildBundleCommand extends BuildSubCommand {
|
||||||
platform: platform,
|
platform: platform,
|
||||||
buildInfo: buildInfo,
|
buildInfo: buildInfo,
|
||||||
mainPath: targetFile,
|
mainPath: targetFile,
|
||||||
manifestPath: stringArg('manifest'),
|
manifestPath: defaultManifestPath,
|
||||||
depfilePath: stringArg('depfile'),
|
depfilePath: stringArg('depfile'),
|
||||||
assetDirPath: stringArg('asset-dir'),
|
assetDirPath: stringArg('asset-dir'),
|
||||||
precompiledSnapshot: boolArg('precompiled'),
|
|
||||||
reportLicensedPackages: boolArg('report-licensed-packages'),
|
|
||||||
trackWidgetCreation: boolArg('track-widget-creation'),
|
trackWidgetCreation: boolArg('track-widget-creation'),
|
||||||
extraFrontEndOptions: buildInfo.extraFrontEndOptions,
|
extraFrontEndOptions: buildInfo.extraFrontEndOptions,
|
||||||
extraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions,
|
extraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions,
|
||||||
|
|
|
@ -158,9 +158,7 @@ class FlutterTesterDevice extends Device {
|
||||||
await BundleBuilder().build(
|
await BundleBuilder().build(
|
||||||
buildInfo: buildInfo,
|
buildInfo: buildInfo,
|
||||||
mainPath: mainPath,
|
mainPath: mainPath,
|
||||||
assetDirPath: assetDirPath,
|
|
||||||
applicationKernelFilePath: applicationKernelFilePath,
|
applicationKernelFilePath: applicationKernelFilePath,
|
||||||
precompiledSnapshot: false,
|
|
||||||
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||||
platform: getTargetPlatformForName(getNameForHostPlatform(getCurrentHostPlatform())),
|
platform: getTargetPlatformForName(getNameForHostPlatform(getCurrentHostPlatform())),
|
||||||
treeShakeIcons: buildInfo.treeShakeIcons,
|
treeShakeIcons: buildInfo.treeShakeIcons,
|
||||||
|
|
|
@ -39,8 +39,6 @@ void main() {
|
||||||
applicationKernelFilePath: anyNamed('applicationKernelFilePath'),
|
applicationKernelFilePath: anyNamed('applicationKernelFilePath'),
|
||||||
depfilePath: anyNamed('depfilePath'),
|
depfilePath: anyNamed('depfilePath'),
|
||||||
assetDirPath: anyNamed('assetDirPath'),
|
assetDirPath: anyNamed('assetDirPath'),
|
||||||
precompiledSnapshot: anyNamed('precompiledSnapshot'),
|
|
||||||
reportLicensedPackages: anyNamed('reportLicensedPackages'),
|
|
||||||
trackWidgetCreation: anyNamed('trackWidgetCreation'),
|
trackWidgetCreation: anyNamed('trackWidgetCreation'),
|
||||||
extraFrontEndOptions: anyNamed('extraFrontEndOptions'),
|
extraFrontEndOptions: anyNamed('extraFrontEndOptions'),
|
||||||
extraGenSnapshotOptions: anyNamed('extraGenSnapshotOptions'),
|
extraGenSnapshotOptions: anyNamed('extraGenSnapshotOptions'),
|
||||||
|
|
|
@ -38,7 +38,6 @@ void main() {
|
||||||
outputDir: 'example',
|
outputDir: 'example',
|
||||||
targetPlatform: TargetPlatform.ios,
|
targetPlatform: TargetPlatform.ios,
|
||||||
depfilePath: 'example.d',
|
depfilePath: 'example.d',
|
||||||
precompiled: false,
|
|
||||||
treeShakeIcons: false,
|
treeShakeIcons: false,
|
||||||
);
|
);
|
||||||
expect(globals.fs.file(globals.fs.path.join('example', 'kernel_blob.bin')).existsSync(), true);
|
expect(globals.fs.file(globals.fs.path.join('example', 'kernel_blob.bin')).existsSync(), true);
|
||||||
|
@ -61,7 +60,6 @@ void main() {
|
||||||
outputDir: 'example',
|
outputDir: 'example',
|
||||||
targetPlatform: TargetPlatform.linux_x64,
|
targetPlatform: TargetPlatform.linux_x64,
|
||||||
depfilePath: 'example.d',
|
depfilePath: 'example.d',
|
||||||
precompiled: false,
|
|
||||||
treeShakeIcons: false,
|
treeShakeIcons: false,
|
||||||
), throwsToolExit());
|
), throwsToolExit());
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue