Commit 5311dff1 authored by leoylung's avatar leoylung Committed by Todd Volkert

Duplicate assets under data/ to data/componentName (#20534)

parent 452f255e
......@@ -22,6 +22,7 @@ const String _kOptionPackages = 'packages';
const String _kOptionAsset = 'asset-dir';
const String _kOptionManifest = 'manifest';
const String _kOptionAssetManifestOut = 'asset-manifest-out';
const String _kOptionComponentName = 'component-name';
const List<String> _kRequiredOptions = <String>[
_kOptionPackages,
_kOptionAsset,
......@@ -47,7 +48,8 @@ Future<Null> run(List<String> args) async {
..addOption(_kOptionAsset,
help: 'The directory where to put temporary files')
..addOption(_kOptionManifest, help: 'The manifest file')
..addOption(_kOptionAssetManifestOut);
..addOption(_kOptionAssetManifestOut)
..addOption(_kOptionComponentName);
final ArgResults argResults = parser.parse(args);
if (_kRequiredOptions
.any((String option) => !argResults.options.contains(option))) {
......@@ -77,10 +79,10 @@ Future<Null> run(List<String> args) async {
await Future.wait(calls);
final String outputMan = argResults[_kOptionAssetManifestOut];
await writeFuchsiaManifest(assets, argResults[_kOptionAsset], outputMan);
await writeFuchsiaManifest(assets, argResults[_kOptionAsset], outputMan, argResults[_kOptionComponentName]);
}
Future<Null> writeFuchsiaManifest(AssetBundle assets, String outputBase, String fileDest) async {
Future<Null> writeFuchsiaManifest(AssetBundle assets, String outputBase, String fileDest, String componentName) async {
final libfs.File destFile = libfs.fs.file(fileDest);
await destFile.create(recursive: true);
......@@ -88,6 +90,9 @@ Future<Null> writeFuchsiaManifest(AssetBundle assets, String outputBase, String
for (String path in assets.entries.keys) {
outFile.write('data/$path=$outputBase/$path\n');
if (componentName.isNotEmpty) {
outFile.write('data/$componentName/$path=$outputBase/$path\n');
}
}
await outFile.flush();
await outFile.close();
......
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