From 249bbac362a1e2dec133a8772a1b90cacbd06fd9 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Thu, 6 Apr 2017 11:12:12 -0700 Subject: [PATCH] =?UTF-8?q?Support=20for=20placing=20an=20AOT=20dylib=20in?= =?UTF-8?q?=20the=20flx.=20=20Part=20of=20Fuchsia=20AOT=20sup=E2=80=A6=20(?= =?UTF-8?q?#9240)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support for placing an AOT dylib in the flx. Part of Fuchsia AOT support. --- packages/flutter_tools/bin/fuchsia_builder.dart | 8 ++++++-- packages/flutter_tools/lib/src/flx.dart | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/bin/fuchsia_builder.dart b/packages/flutter_tools/bin/fuchsia_builder.dart index 6d9f2374b2..99f08ccb07 100644 --- a/packages/flutter_tools/bin/fuchsia_builder.dart +++ b/packages/flutter_tools/bin/fuchsia_builder.dart @@ -24,6 +24,7 @@ const String _kOptionPackages = 'packages'; const String _kOptionOutput = 'output-file'; const String _kOptionHeader = 'header'; const String _kOptionSnapshot = 'snapshot'; +const String _kOptionDylib = 'dylib'; const String _kOptionWorking = 'working-dir'; const String _kOptionManifest = 'manifest'; const String _kOptionDepFile = 'depfile'; @@ -32,7 +33,6 @@ const List _kRequiredOptions = const [ _kOptionPackages, _kOptionOutput, _kOptionHeader, - _kOptionSnapshot, _kOptionWorking, _kOptionDepFile, _kOptionBuildRoot, @@ -60,6 +60,7 @@ Future run(List args) async { ..addOption(_kOptionPackages, help: 'The .packages file') ..addOption(_kOptionOutput, help: 'The generated flx file') ..addOption(_kOptionHeader, help: 'The header of the flx file') + ..addOption(_kOptionDylib, help: 'The generated AOT dylib file') ..addOption(_kOptionSnapshot, help: 'The generated snapshot file') ..addOption(_kOptionWorking, help: 'The directory where to put temporary files') @@ -75,9 +76,12 @@ Future run(List args) async { Cache.flutterRoot = platform.environment['FLUTTER_ROOT']; final String outputPath = argResults[_kOptionOutput]; try { + final String snapshotPath = argResults[_kOptionSnapshot]; + final String dylibPath = argResults[_kOptionDylib]; final List dependencies = await assemble( outputPath: outputPath, - snapshotFile: fs.file(argResults[_kOptionSnapshot]), + snapshotFile: snapshotPath == null ? null : fs.file(snapshotPath), + dylibFile: dylibPath == null ? null : fs.file(dylibPath), workingDirPath: argResults[_kOptionWorking], packagesPath: argResults[_kOptionPackages], manifestPath: argResults[_kOptionManifest] ?? defaultManifestPath, diff --git a/packages/flutter_tools/lib/src/flx.dart b/packages/flutter_tools/lib/src/flx.dart index 48464db1c9..b4b9114687 100644 --- a/packages/flutter_tools/lib/src/flx.dart +++ b/packages/flutter_tools/lib/src/flx.dart @@ -27,6 +27,7 @@ const String defaultPrivateKeyPath = 'privatekey.der'; const String _kKernelKey = 'kernel_blob.bin'; const String _kSnapshotKey = 'snapshot_blob.bin'; +const String _kDylibKey = 'libapp.so'; Future createSnapshot({ @required String mainPath, @@ -114,6 +115,7 @@ Future> assemble({ String manifestPath, DevFSContent kernelContent, File snapshotFile, + File dylibFile, String outputPath, String privateKeyPath: defaultPrivateKeyPath, String workingDirPath, @@ -151,6 +153,8 @@ Future> assemble({ zipBuilder.entries[_kKernelKey] = kernelContent; if (snapshotFile != null) zipBuilder.entries[_kSnapshotKey] = new DevFSFileContent(snapshotFile); + if (dylibFile != null) + zipBuilder.entries[_kDylibKey] = new DevFSFileContent(dylibFile); ensureDirectoryExists(outputPath);