use of com.android.tools.build.bundletool.splitters.SplittingPipeline in project bundletool by google.
the class ModuleSplitterForShards method generateSplits.
/**
* Generates a flat list of splits from a bundle module.
*/
public ImmutableList<ModuleSplit> generateSplits(BundleModule module, ImmutableSet<OptimizationDimension> shardingDimensions) {
ImmutableList.Builder<ModuleSplit> rawSplits = ImmutableList.builder();
// Native libraries splits.
SplittingPipeline nativePipeline = createNativeLibrariesSplittingPipeline(shardingDimensions);
rawSplits.addAll(nativePipeline.split(ModuleSplit.forNativeLibraries(module)));
// Resources splits.
SplittingPipeline resourcesPipeline = createResourcesSplittingPipeline(shardingDimensions);
rawSplits.addAll(resourcesPipeline.split(ModuleSplit.forResources(module)));
// Apex images splits.
SplittingPipeline apexPipeline = createApexImagesSplittingPipeline();
rawSplits.addAll(apexPipeline.split(ModuleSplit.forApex(module)));
// Assets splits.
SplittingPipeline assetsPipeline = createAssetsSplittingPipeline(shardingDimensions);
rawSplits.addAll(assetsPipeline.split(ModuleSplit.forAssets(module)));
// Other files.
rawSplits.add(ModuleSplit.forDex(module));
rawSplits.add(ModuleSplit.forRoot(module));
ImmutableList<ModuleSplit> unmergedSplits = rawSplits.build();
// Strip assets for some dimensions (texture compression format).
ImmutableList<ModuleSplit> unmergedStrippedSplits = stripAssetsWithTargeting(unmergedSplits);
// Merge splits with the same targeting and make a single master split.
ImmutableList<ModuleSplit> mergedSplits = new SameTargetingMerger().merge(unmergedStrippedSplits);
// Remove the splitName from any standalone apks, as these are only used for instant apps (L+).
mergedSplits = mergedSplits.stream().map(ModuleSplit::removeSplitName).collect(toImmutableList());
// Check that we have only one master split.
long masterSplitCount = mergedSplits.stream().filter(ModuleSplit::isMasterSplit).count();
checkState(masterSplitCount == 1, "Expected one master split, got %s.", masterSplitCount);
return mergedSplits;
}
use of com.android.tools.build.bundletool.splitters.SplittingPipeline in project bundletool by google.
the class ModuleSplitterForShards method createNativeLibrariesSplittingPipeline.
private static SplittingPipeline createNativeLibrariesSplittingPipeline(ImmutableSet<OptimizationDimension> shardingDimensions) {
ImmutableList.Builder<ModuleSplitSplitter> nativeSplitters = ImmutableList.builder();
if (shardingDimensions.contains(OptimizationDimension.ABI)) {
nativeSplitters.add(new AbiNativeLibrariesSplitter());
}
nativeSplitters.add(new SanitizerNativeLibrariesSplitter());
return new SplittingPipeline(nativeSplitters.build());
}
Aggregations