From 3e9ceec0b1b5e2f64eacd0a5126526851201f25e Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 17 Sep 2015 15:12:15 -0700 Subject: [PATCH] Improve sky_tools build so that it works from sky_engine With this patch, we can switch over to using this command from the build system in the sky_engine repo. --- packages/flutter_tools/lib/src/build.dart | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/flutter_tools/lib/src/build.dart b/packages/flutter_tools/lib/src/build.dart index 84c9a86752..f9368e5585 100644 --- a/packages/flutter_tools/lib/src/build.dart +++ b/packages/flutter_tools/lib/src/build.dart @@ -100,16 +100,24 @@ Future _createFile(String key, String assetBase) async { } Future _compileSnapshot({ + String compilerPath, String mainPath, String packageRoot, String snapshotPath }) async { - File compiler = await artifactStore.getPath(Artifact.FlutterCompiler); - await Process.run(compiler.path, [ + File compiler = compilerPath == null ? + await artifactStore.getPath(Artifact.FlutterCompiler) : + new File(compilerPath); + ProcessResult result = await Process.run(compiler.path, [ mainPath, '--package-root=$packageRoot', '--snapshot=$snapshotPath' ]); + if (result.exitCode != 0) { + print(result.stdout); + print(result.stderr); + exit(result.exitCode); + } } Future _createSnapshotFile(String snapshotPath) async { @@ -125,8 +133,9 @@ class BuildCommandHandler extends CommandHandler { ArgParser parser = new ArgParser(); parser.addFlag('help', abbr: 'h', negatable: false); parser.addOption('asset-base', defaultsTo: 'packages/material_design_icons/icons'); + parser.addOption('compiler'); parser.addOption('main', defaultsTo: 'lib/main.dart'); - parser.addOption('manifest', defaultsTo: 'flutter.yaml'); + parser.addOption('manifest'); parser.addOption('output-file', abbr: 'o', defaultsTo: 'app.flx'); parser.addOption('package-root', defaultsTo: 'packages'); parser.addOption('snapshot', defaultsTo: 'snapshot_blob.bin'); @@ -149,6 +158,7 @@ class BuildCommandHandler extends CommandHandler { String snapshotPath = results['snapshot']; await _compileSnapshot( + compilerPath: results['compiler'], mainPath: results['main'], packageRoot: results['package-root'], snapshotPath: snapshotPath);