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

This commit is contained in:
Alexander Markov
2018-05-14 09:41:58 -07:00
committed by GitHub
parent ee019c0bca
commit 4fb7c91ee3
3 changed files with 13 additions and 0 deletions

View File

@@ -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 {

View File

@@ -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,

View File

@@ -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'],
);