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