Merge pull request #2578 from jason-simmons/flx_working_dir
Add an option to specify a working directory for the FLX builder
This commit is contained in:
commit
3b5fba4022
@ -24,6 +24,7 @@ class BuildCommand extends FlutterCommand {
|
|||||||
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);
|
argParser.addOption('depfile', defaultsTo: defaultDepfilePath);
|
||||||
|
argParser.addOption('working-dir', defaultsTo: defaultWorkingDirPath);
|
||||||
addTargetOption();
|
addTargetOption();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ class BuildCommand extends FlutterCommand {
|
|||||||
snapshotPath: argResults['snapshot'],
|
snapshotPath: argResults['snapshot'],
|
||||||
depfilePath: argResults['depfile'],
|
depfilePath: argResults['depfile'],
|
||||||
privateKeyPath: argResults['private-key'],
|
privateKeyPath: argResults['private-key'],
|
||||||
|
workingDirPath: argResults['working-dir'],
|
||||||
precompiledSnapshot: argResults['precompiled']
|
precompiledSnapshot: argResults['precompiled']
|
||||||
).then((int result) {
|
).then((int result) {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
|
@ -24,6 +24,7 @@ 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 defaultDepfilePath = 'build/snapshot_blob.bin.d';
|
||||||
const String defaultPrivateKeyPath = 'privatekey.der';
|
const String defaultPrivateKeyPath = 'privatekey.der';
|
||||||
|
const String defaultWorkingDirPath = 'build/flx';
|
||||||
|
|
||||||
const String _kSnapshotKey = 'snapshot_blob.bin';
|
const String _kSnapshotKey = 'snapshot_blob.bin';
|
||||||
|
|
||||||
@ -163,6 +164,7 @@ Future<int> build(
|
|||||||
String snapshotPath: defaultSnapshotPath,
|
String snapshotPath: defaultSnapshotPath,
|
||||||
String depfilePath: defaultDepfilePath,
|
String depfilePath: defaultDepfilePath,
|
||||||
String privateKeyPath: defaultPrivateKeyPath,
|
String privateKeyPath: defaultPrivateKeyPath,
|
||||||
|
String workingDirPath: defaultWorkingDirPath,
|
||||||
bool precompiledSnapshot: false
|
bool precompiledSnapshot: false
|
||||||
}) async {
|
}) async {
|
||||||
Map manifestDescriptor = _loadManifest(manifestPath);
|
Map manifestDescriptor = _loadManifest(manifestPath);
|
||||||
@ -189,7 +191,8 @@ Future<int> build(
|
|||||||
snapshotFile: snapshotFile,
|
snapshotFile: snapshotFile,
|
||||||
assetBasePath: assetBasePath,
|
assetBasePath: assetBasePath,
|
||||||
outputPath: outputPath,
|
outputPath: outputPath,
|
||||||
privateKeyPath: privateKeyPath
|
privateKeyPath: privateKeyPath,
|
||||||
|
workingDirPath: workingDirPath
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +201,8 @@ Future<int> assemble({
|
|||||||
File snapshotFile,
|
File snapshotFile,
|
||||||
String assetBasePath: defaultAssetBasePath,
|
String assetBasePath: defaultAssetBasePath,
|
||||||
String outputPath: defaultFlxOutputPath,
|
String outputPath: defaultFlxOutputPath,
|
||||||
String privateKeyPath: defaultPrivateKeyPath
|
String privateKeyPath: defaultPrivateKeyPath,
|
||||||
|
String workingDirPath: defaultWorkingDirPath
|
||||||
}) async {
|
}) async {
|
||||||
printTrace('Building $outputPath');
|
printTrace('Building $outputPath');
|
||||||
|
|
||||||
@ -250,7 +254,7 @@ Future<int> assemble({
|
|||||||
|
|
||||||
File zipFile = new File(outputPath.substring(0, outputPath.length - 4) + '.zip');
|
File zipFile = new File(outputPath.substring(0, outputPath.length - 4) + '.zip');
|
||||||
printTrace('Encoding zip file to ${zipFile.path}');
|
printTrace('Encoding zip file to ${zipFile.path}');
|
||||||
zipBuilder.createZip(zipFile, new Directory('build/flx'));
|
zipBuilder.createZip(zipFile, new Directory(workingDirPath));
|
||||||
List<int> zipBytes = zipFile.readAsBytesSync();
|
List<int> zipBytes = zipFile.readAsBytesSync();
|
||||||
|
|
||||||
ensureDirectoryExists(outputPath);
|
ensureDirectoryExists(outputPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user