Expose extra frontend options through build apk/ios/macOS (#53273)
This will allow experimenting with the remove to string transformer before we're ready to turn it on by default. This doesn't work for web yet since we use dart2js instead of the frontend_server for producing kernel
This commit is contained in:
@@ -313,7 +313,7 @@ Future<void> buildGradleApp({
|
||||
command.add('-Ptrack-widget-creation=${buildInfo.trackWidgetCreation}');
|
||||
|
||||
if (buildInfo.extraFrontEndOptions != null) {
|
||||
command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions}');
|
||||
command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions.join(',')}');
|
||||
}
|
||||
if (buildInfo.extraGenSnapshotOptions != null) {
|
||||
command.add('-Pextra-gen-snapshot-options=${buildInfo.extraGenSnapshotOptions}');
|
||||
|
||||
@@ -204,7 +204,10 @@ class KernelSnapshot extends Target {
|
||||
final TargetPlatform targetPlatform = getTargetPlatformForName(environment.defines[kTargetPlatform]);
|
||||
|
||||
// This configuration is all optional.
|
||||
final List<String> extraFrontEndOptions = environment.defines[kExtraFrontEndOptions]?.split(',');
|
||||
final String rawFrontEndOption = environment.defines[kExtraFrontEndOptions];
|
||||
final List<String> extraFrontEndOptions = (rawFrontEndOption?.isNotEmpty ?? false)
|
||||
? rawFrontEndOption?.split(',')
|
||||
: null;
|
||||
final List<String> fileSystemRoots = environment.defines[kFileSystemRoots]?.split(',');
|
||||
final String fileSystemScheme = environment.defines[kFileSystemScheme];
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
|
||||
addBuildModeFlags();
|
||||
usesPubOption();
|
||||
usesDartDefineOption();
|
||||
usesExtraFrontendOptions();
|
||||
argParser
|
||||
..addOption('output-dir', defaultsTo: getAotBuildDirectory())
|
||||
..addOption('target-platform',
|
||||
@@ -33,10 +34,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
|
||||
allowed: DarwinArch.values.map<String>(getNameForDarwinArch),
|
||||
help: 'iOS architectures to build.',
|
||||
)
|
||||
..addMultiOption(FlutterOptions.kExtraFrontEndOptions,
|
||||
splitCommas: true,
|
||||
hide: true,
|
||||
)
|
||||
..addMultiOption(FlutterOptions.kExtraGenSnapshotOptions,
|
||||
splitCommas: true,
|
||||
hide: true,
|
||||
|
||||
@@ -29,6 +29,7 @@ class BuildApkCommand extends BuildSubCommand {
|
||||
addSplitDebugInfoOption();
|
||||
addDartObfuscationOption();
|
||||
usesDartDefineOption();
|
||||
usesExtraFrontendOptions();
|
||||
argParser
|
||||
..addFlag('split-per-abi',
|
||||
negatable: false,
|
||||
|
||||
@@ -27,6 +27,7 @@ class BuildAppBundleCommand extends BuildSubCommand {
|
||||
addSplitDebugInfoOption();
|
||||
addDartObfuscationOption();
|
||||
usesDartDefineOption();
|
||||
usesExtraFrontendOptions();
|
||||
argParser
|
||||
..addFlag('track-widget-creation', negatable: false, hide: !verboseHelp)
|
||||
..addMultiOption('target-platform',
|
||||
|
||||
@@ -21,6 +21,7 @@ class BuildBundleCommand extends BuildSubCommand {
|
||||
usesFilesystemOptions(hide: !verboseHelp);
|
||||
usesBuildNumberOption();
|
||||
addBuildModeFlags(verboseHelp: verboseHelp);
|
||||
usesExtraFrontendOptions();
|
||||
argParser
|
||||
..addFlag(
|
||||
'precompiled',
|
||||
@@ -49,10 +50,6 @@ class BuildBundleCommand extends BuildSubCommand {
|
||||
'windows-x64',
|
||||
],
|
||||
)
|
||||
..addMultiOption(FlutterOptions.kExtraFrontEndOptions,
|
||||
splitCommas: true,
|
||||
hide: true,
|
||||
)
|
||||
..addOption('asset-dir', defaultsTo: getAssetBuildDirectory())
|
||||
..addMultiOption(FlutterOptions.kExtraGenSnapshotOptions,
|
||||
splitCommas: true,
|
||||
|
||||
@@ -28,6 +28,7 @@ class BuildIOSCommand extends BuildSubCommand {
|
||||
usesBuildNameOption();
|
||||
addDartObfuscationOption();
|
||||
usesDartDefineOption();
|
||||
usesExtraFrontendOptions();
|
||||
argParser
|
||||
..addFlag('simulator',
|
||||
help: 'Build for the iOS simulator instead of the device.',
|
||||
|
||||
@@ -51,6 +51,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
|
||||
usesDartDefineOption();
|
||||
addSplitDebugInfoOption();
|
||||
addDartObfuscationOption();
|
||||
usesExtraFrontendOptions();
|
||||
argParser
|
||||
..addFlag('debug',
|
||||
negatable: true,
|
||||
|
||||
@@ -22,6 +22,7 @@ class BuildMacosCommand extends BuildSubCommand {
|
||||
usesTargetOption();
|
||||
addBuildModeFlags();
|
||||
addDartObfuscationOption();
|
||||
usesExtraFrontendOptions();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -239,6 +239,10 @@ List<String> _xcodeBuildSettingsLines({
|
||||
xcodeBuildSettings.add('DART_DEFINES=${jsonEncode(buildInfo.dartDefines)}');
|
||||
}
|
||||
|
||||
if (buildInfo.extraFrontEndOptions?.isNotEmpty ?? false) {
|
||||
xcodeBuildSettings.add('EXTRA_FRONT_END_OPTIONS=${buildInfo.extraFrontEndOptions.join(',')}');
|
||||
}
|
||||
|
||||
return xcodeBuildSettings;
|
||||
}
|
||||
|
||||
|
||||
@@ -429,6 +429,13 @@ abstract class FlutterCommand extends Command<void> {
|
||||
);
|
||||
}
|
||||
|
||||
void usesExtraFrontendOptions() {
|
||||
argParser.addMultiOption(FlutterOptions.kExtraFrontEndOptions,
|
||||
splitCommas: true,
|
||||
hide: true,
|
||||
);
|
||||
}
|
||||
|
||||
void usesFuchsiaOptions({ bool hide = false }) {
|
||||
argParser.addOption(
|
||||
'target-model',
|
||||
|
||||
Reference in New Issue
Block a user