Unverified Commit 4fb7c91e authored by Alexander Markov's avatar Alexander Markov Committed by GitHub

Plumb --extra-front-end-options in flutter build bundle (#17404)

parent ee019c0b
...@@ -458,6 +458,9 @@ abstract class BaseFlutterTask extends DefaultTask { ...@@ -458,6 +458,9 @@ abstract class BaseFlutterTask extends DefaultTask {
if (trackWidgetCreation) { if (trackWidgetCreation) {
args "--track-widget-creation" args "--track-widget-creation"
} }
if (extraFrontEndOptions != null) {
args "--extra-front-end-options", "${extraFrontEndOptions}"
}
if (buildMode != "debug") { if (buildMode != "debug") {
args "--precompiled" args "--precompiled"
} else { } else {
......
...@@ -41,6 +41,7 @@ Future<void> build({ ...@@ -41,6 +41,7 @@ Future<void> build({
bool precompiledSnapshot: false, bool precompiledSnapshot: false,
bool reportLicensedPackages: false, bool reportLicensedPackages: false,
bool trackWidgetCreation: false, bool trackWidgetCreation: false,
List<String> extraFrontEndOptions: const <String>[],
List<String> fileSystemRoots, List<String> fileSystemRoots,
String fileSystemScheme, String fileSystemScheme,
}) async { }) async {
...@@ -70,6 +71,8 @@ Future<void> build({ ...@@ -70,6 +71,8 @@ Future<void> build({
DevFSContent kernelContent; DevFSContent kernelContent;
if (!precompiledSnapshot && previewDart2) { if (!precompiledSnapshot && previewDart2) {
if ((extraFrontEndOptions != null) && extraFrontEndOptions.isNotEmpty)
printTrace('Extra front-end options: $extraFrontEndOptions');
ensureDirectoryExists(applicationKernelFilePath); ensureDirectoryExists(applicationKernelFilePath);
final CompilerOutput compilerOutput = await kernelCompiler.compile( final CompilerOutput compilerOutput = await kernelCompiler.compile(
sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath), sdkRoot: artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
...@@ -78,6 +81,7 @@ Future<void> build({ ...@@ -78,6 +81,7 @@ Future<void> build({
outputFilePath: applicationKernelFilePath, outputFilePath: applicationKernelFilePath,
depFilePath: depfilePath, depFilePath: depfilePath,
trackWidgetCreation: trackWidgetCreation, trackWidgetCreation: trackWidgetCreation,
extraFrontEndOptions: extraFrontEndOptions,
fileSystemRoots: fileSystemRoots, fileSystemRoots: fileSystemRoots,
fileSystemScheme: fileSystemScheme, fileSystemScheme: fileSystemScheme,
packagesPath: packagesPath, packagesPath: packagesPath,
......
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import '../build_info.dart'; import '../build_info.dart';
import '../bundle.dart'; import '../bundle.dart';
import '../runner/flutter_command.dart' show FlutterOptions;
import 'build.dart'; import 'build.dart';
class BuildBundleCommand extends BuildSubCommand { class BuildBundleCommand extends BuildSubCommand {
...@@ -30,6 +31,10 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -30,6 +31,10 @@ class BuildBundleCommand extends BuildSubCommand {
hide: !verboseHelp, hide: !verboseHelp,
help: 'Track widget creation locations. Requires Dart 2.0 functionality.', help: 'Track widget creation locations. Requires Dart 2.0 functionality.',
) )
..addMultiOption(FlutterOptions.kExtraFrontEndOptions,
splitCommas: true,
hide: true,
)
..addOption('asset-dir', defaultsTo: getAssetBuildDirectory()) ..addOption('asset-dir', defaultsTo: getAssetBuildDirectory())
..addFlag('report-licensed-packages', ..addFlag('report-licensed-packages',
help: 'Whether to report the names of all the packages that are included ' help: 'Whether to report the names of all the packages that are included '
...@@ -76,6 +81,7 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -76,6 +81,7 @@ class BuildBundleCommand extends BuildSubCommand {
precompiledSnapshot: argResults['precompiled'], precompiledSnapshot: argResults['precompiled'],
reportLicensedPackages: argResults['report-licensed-packages'], reportLicensedPackages: argResults['report-licensed-packages'],
trackWidgetCreation: argResults['track-widget-creation'], trackWidgetCreation: argResults['track-widget-creation'],
extraFrontEndOptions: argResults[FlutterOptions.kExtraFrontEndOptions],
fileSystemScheme: argResults['filesystem-scheme'], fileSystemScheme: argResults['filesystem-scheme'],
fileSystemRoots: argResults['filesystem-root'], fileSystemRoots: argResults['filesystem-root'],
); );
......
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