use of com.android.ide.common.res2.AssetSet in project atlas by alibaba.
the class MergeAwbAssetConfigAction method execute.
@Override
public void execute(MergeSourceSetFolders task) {
final VariantScope scope = variantContext.getScope();
BaseVariantData<? extends BaseVariantOutputData> variantData = scope.getVariantData();
final VariantConfiguration variantConfig = variantData.getVariantConfiguration();
task.setAndroidBuilder(scope.getGlobalScope().getAndroidBuilder());
task.setVariantName(variantConfig.getFullName());
task.setIncrementalFolder(scope.getIncrementalDir(getName()));
ConventionMappingHelper.map(task, "inputDirectorySets", new Callable<List<AssetSet>>() {
@Override
public List<AssetSet> call() throws Exception {
List<AssetSet> assetSets = Lists.newArrayList();
List<? extends AndroidLibrary> bundleDeps = awbBundle.getLibraryDependencies();
// the list of dependency must be reversed to use the right overlay order.
for (int n = bundleDeps.size() - 1; n >= 0; n--) {
AndroidLibrary dependency = bundleDeps.get(n);
File assetFolder = dependency.getAssetsFolder();
if (assetFolder.isDirectory()) {
AssetSet assetSet = new AssetSet(dependency.getFolder().getName());
assetSet.addSource(assetFolder);
assetSets.add(assetSet);
}
}
File awbAssetFolder = awbBundle.getAssetsFolder();
if (awbAssetFolder.isDirectory()) {
AssetSet awbAssetSet = new AssetSet(awbBundle.getFolder().getName());
awbAssetSet.addSource(awbAssetFolder);
assetSets.add(awbAssetSet);
}
return assetSets;
}
});
ConventionMappingHelper.map(task, "outputDir", new Callable<File>() {
@Override
public File call() throws Exception {
GlobalScope globalScope = scope.getGlobalScope();
return variantContext.getMergeAssets(awbBundle);
}
});
// if (variantContext instanceof AppVariantContext) {
// AppVariantContext appVariantContext = (AppVariantContext) variantContext;
// appVariantContext.getAwbMergeAssetTasks().put(awbBundle.getName(), task);
// }
}
Aggregations