Commit 249bbac3 authored by Ryan Macnak's avatar Ryan Macnak Committed by GitHub

Support for placing an AOT dylib in the flx. Part of Fuchsia AOT sup… (#9240)

Support for placing an AOT dylib in the flx.  Part of Fuchsia AOT support.
parent 57ca2b5c
...@@ -24,6 +24,7 @@ const String _kOptionPackages = 'packages'; ...@@ -24,6 +24,7 @@ const String _kOptionPackages = 'packages';
const String _kOptionOutput = 'output-file'; const String _kOptionOutput = 'output-file';
const String _kOptionHeader = 'header'; const String _kOptionHeader = 'header';
const String _kOptionSnapshot = 'snapshot'; const String _kOptionSnapshot = 'snapshot';
const String _kOptionDylib = 'dylib';
const String _kOptionWorking = 'working-dir'; const String _kOptionWorking = 'working-dir';
const String _kOptionManifest = 'manifest'; const String _kOptionManifest = 'manifest';
const String _kOptionDepFile = 'depfile'; const String _kOptionDepFile = 'depfile';
...@@ -32,7 +33,6 @@ const List<String> _kRequiredOptions = const <String>[ ...@@ -32,7 +33,6 @@ const List<String> _kRequiredOptions = const <String>[
_kOptionPackages, _kOptionPackages,
_kOptionOutput, _kOptionOutput,
_kOptionHeader, _kOptionHeader,
_kOptionSnapshot,
_kOptionWorking, _kOptionWorking,
_kOptionDepFile, _kOptionDepFile,
_kOptionBuildRoot, _kOptionBuildRoot,
...@@ -60,6 +60,7 @@ Future<Null> run(List<String> args) async { ...@@ -60,6 +60,7 @@ Future<Null> run(List<String> args) async {
..addOption(_kOptionPackages, help: 'The .packages file') ..addOption(_kOptionPackages, help: 'The .packages file')
..addOption(_kOptionOutput, help: 'The generated flx file') ..addOption(_kOptionOutput, help: 'The generated flx file')
..addOption(_kOptionHeader, help: 'The header of the 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(_kOptionSnapshot, help: 'The generated snapshot file')
..addOption(_kOptionWorking, ..addOption(_kOptionWorking,
help: 'The directory where to put temporary files') help: 'The directory where to put temporary files')
...@@ -75,9 +76,12 @@ Future<Null> run(List<String> args) async { ...@@ -75,9 +76,12 @@ Future<Null> run(List<String> args) async {
Cache.flutterRoot = platform.environment['FLUTTER_ROOT']; Cache.flutterRoot = platform.environment['FLUTTER_ROOT'];
final String outputPath = argResults[_kOptionOutput]; final String outputPath = argResults[_kOptionOutput];
try { try {
final String snapshotPath = argResults[_kOptionSnapshot];
final String dylibPath = argResults[_kOptionDylib];
final List<String> dependencies = await assemble( final List<String> dependencies = await assemble(
outputPath: outputPath, outputPath: outputPath,
snapshotFile: fs.file(argResults[_kOptionSnapshot]), snapshotFile: snapshotPath == null ? null : fs.file(snapshotPath),
dylibFile: dylibPath == null ? null : fs.file(dylibPath),
workingDirPath: argResults[_kOptionWorking], workingDirPath: argResults[_kOptionWorking],
packagesPath: argResults[_kOptionPackages], packagesPath: argResults[_kOptionPackages],
manifestPath: argResults[_kOptionManifest] ?? defaultManifestPath, manifestPath: argResults[_kOptionManifest] ?? defaultManifestPath,
......
...@@ -27,6 +27,7 @@ const String defaultPrivateKeyPath = 'privatekey.der'; ...@@ -27,6 +27,7 @@ const String defaultPrivateKeyPath = 'privatekey.der';
const String _kKernelKey = 'kernel_blob.bin'; const String _kKernelKey = 'kernel_blob.bin';
const String _kSnapshotKey = 'snapshot_blob.bin'; const String _kSnapshotKey = 'snapshot_blob.bin';
const String _kDylibKey = 'libapp.so';
Future<int> createSnapshot({ Future<int> createSnapshot({
@required String mainPath, @required String mainPath,
...@@ -114,6 +115,7 @@ Future<List<String>> assemble({ ...@@ -114,6 +115,7 @@ Future<List<String>> assemble({
String manifestPath, String manifestPath,
DevFSContent kernelContent, DevFSContent kernelContent,
File snapshotFile, File snapshotFile,
File dylibFile,
String outputPath, String outputPath,
String privateKeyPath: defaultPrivateKeyPath, String privateKeyPath: defaultPrivateKeyPath,
String workingDirPath, String workingDirPath,
...@@ -151,6 +153,8 @@ Future<List<String>> assemble({ ...@@ -151,6 +153,8 @@ Future<List<String>> assemble({
zipBuilder.entries[_kKernelKey] = kernelContent; zipBuilder.entries[_kKernelKey] = kernelContent;
if (snapshotFile != null) if (snapshotFile != null)
zipBuilder.entries[_kSnapshotKey] = new DevFSFileContent(snapshotFile); zipBuilder.entries[_kSnapshotKey] = new DevFSFileContent(snapshotFile);
if (dylibFile != null)
zipBuilder.entries[_kDylibKey] = new DevFSFileContent(dylibFile);
ensureDirectoryExists(outputPath); ensureDirectoryExists(outputPath);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment