mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
parent
c60337404a
commit
b8d64ffe68
@ -23,6 +23,7 @@ class BuildCommand extends FlutterCommand {
|
|||||||
argParser.addOption('private-key', defaultsTo: defaultPrivateKeyPath);
|
argParser.addOption('private-key', defaultsTo: defaultPrivateKeyPath);
|
||||||
argParser.addOption('output-file', abbr: 'o', defaultsTo: defaultFlxOutputPath);
|
argParser.addOption('output-file', abbr: 'o', defaultsTo: defaultFlxOutputPath);
|
||||||
argParser.addOption('snapshot', defaultsTo: defaultSnapshotPath);
|
argParser.addOption('snapshot', defaultsTo: defaultSnapshotPath);
|
||||||
|
argParser.addOption('depfile', defaultsTo: defaultDepfilePath);
|
||||||
addTargetOption();
|
addTargetOption();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +43,7 @@ class BuildCommand extends FlutterCommand {
|
|||||||
manifestPath: argResults['manifest'],
|
manifestPath: argResults['manifest'],
|
||||||
outputPath: outputPath,
|
outputPath: outputPath,
|
||||||
snapshotPath: argResults['snapshot'],
|
snapshotPath: argResults['snapshot'],
|
||||||
|
depfilePath: argResults['depfile'],
|
||||||
privateKeyPath: argResults['private-key'],
|
privateKeyPath: argResults['private-key'],
|
||||||
precompiledSnapshot: argResults['precompiled']
|
precompiledSnapshot: argResults['precompiled']
|
||||||
).then((int result) {
|
).then((int result) {
|
||||||
|
@ -22,6 +22,7 @@ const String defaultAssetBasePath = '.';
|
|||||||
const String defaultManifestPath = 'flutter.yaml';
|
const String defaultManifestPath = 'flutter.yaml';
|
||||||
const String defaultFlxOutputPath = 'build/app.flx';
|
const String defaultFlxOutputPath = 'build/app.flx';
|
||||||
const String defaultSnapshotPath = 'build/snapshot_blob.bin';
|
const String defaultSnapshotPath = 'build/snapshot_blob.bin';
|
||||||
|
const String defaultDepfilePath = 'build/snapshot_blob.bin.d';
|
||||||
const String defaultPrivateKeyPath = 'privatekey.der';
|
const String defaultPrivateKeyPath = 'privatekey.der';
|
||||||
|
|
||||||
const String _kSnapshotKey = 'snapshot_blob.bin';
|
const String _kSnapshotKey = 'snapshot_blob.bin';
|
||||||
@ -160,6 +161,7 @@ Future<int> build(
|
|||||||
String manifestPath: defaultManifestPath,
|
String manifestPath: defaultManifestPath,
|
||||||
String outputPath: defaultFlxOutputPath,
|
String outputPath: defaultFlxOutputPath,
|
||||||
String snapshotPath: defaultSnapshotPath,
|
String snapshotPath: defaultSnapshotPath,
|
||||||
|
String depfilePath: defaultDepfilePath,
|
||||||
String privateKeyPath: defaultPrivateKeyPath,
|
String privateKeyPath: defaultPrivateKeyPath,
|
||||||
bool precompiledSnapshot: false
|
bool precompiledSnapshot: false
|
||||||
}) async {
|
}) async {
|
||||||
@ -173,7 +175,7 @@ Future<int> build(
|
|||||||
|
|
||||||
// In a precompiled snapshot, the instruction buffer contains script
|
// In a precompiled snapshot, the instruction buffer contains script
|
||||||
// content equivalents
|
// content equivalents
|
||||||
int result = await toolchain.compiler.compile(mainPath: mainPath, snapshotPath: snapshotPath);
|
int result = await toolchain.compiler.compile(mainPath: mainPath, snapshotPath: snapshotPath, depfilePath: depfilePath, buildOutputPath: outputPath);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
printError('Failed to run the Flutter compiler. Exit code: $result');
|
printError('Failed to run the Flutter compiler. Exit code: $result');
|
||||||
return result;
|
return result;
|
||||||
|
@ -18,14 +18,23 @@ class Compiler {
|
|||||||
|
|
||||||
Future<int> compile({
|
Future<int> compile({
|
||||||
String mainPath,
|
String mainPath,
|
||||||
String snapshotPath
|
String snapshotPath,
|
||||||
|
String depfilePath,
|
||||||
|
String buildOutputPath
|
||||||
}) {
|
}) {
|
||||||
return runCommandAndStreamOutput([
|
final List<String> args = [
|
||||||
_path,
|
_path,
|
||||||
mainPath,
|
mainPath,
|
||||||
'--package-root=${ArtifactStore.packageRoot}',
|
'--package-root=${ArtifactStore.packageRoot}',
|
||||||
'--snapshot=$snapshotPath'
|
'--snapshot=$snapshotPath'
|
||||||
]);
|
];
|
||||||
|
if (depfilePath != null) {
|
||||||
|
args.add('--depfile=$depfilePath');
|
||||||
|
}
|
||||||
|
if (buildOutputPath != null) {
|
||||||
|
args.add('--build-output=$buildOutputPath');
|
||||||
|
}
|
||||||
|
return runCommandAndStreamOutput(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user