public ImmutableList<ModuleSplit> generateSystemSplits( ImmutableList<BundleModule> modules, BundleMetadata bundleMetadata, ApkOptimizations apkOptimizations, Optional<DeviceSpec> deviceSpec) { return generateSplitsInternal(modules, bundleMetadata, apkOptimizations, deviceSpec); }
public ImmutableList<ModuleSplit> generateApexSplits(ImmutableList<BundleModule> modules) { BundleSharder bundleSharder = new BundleSharder(tempDir, bundleVersion, generate64BitShards); ImmutableList<ModuleSplit> shardedApexApks = bundleSharder.shardApexBundle(getOnlyElement(modules)); return setVariantTargetingAndSplitType(shardedApexApks, splitType); }
private ImmutableList<ModuleSplit> generateModuleSplits( ImmutableList<BundleModule> bundleModule, SplitType standaloneSplitType, boolean generate64BitShards) { if (standaloneSplitType.equals(SplitType.STANDALONE)) { return new ShardedApksGenerator( tmpDir, BUNDLETOOL_VERSION, standaloneSplitType, generate64BitShards) .generateSplits(bundleModule, DEFAULT_METADATA, DEFAULT_APK_OPTIMIZATIONS); } else { return new ShardedApksGenerator( tmpDir, BUNDLETOOL_VERSION, standaloneSplitType, generate64BitShards) .generateSystemSplits( bundleModule, DEFAULT_METADATA, DEFAULT_APK_OPTIMIZATIONS, Optional.empty()); } }
new ShardedApksGenerator( tempDir, bundleVersion, ? shardedApksGenerator.generateApexSplits(modulesToFuse(allFeatureModules)) : shardedApksGenerator.generateSplits( modulesToFuse(allFeatureModules), appBundle.getBundleMetadata(), new ShardedApksGenerator(tempDir, bundleVersion) .generateSplits( modulesToFuse(allFeatureModules), appBundle.getBundleMetadata(), new ShardedApksGenerator( tempDir, bundleVersion, SplitType.SYSTEM, .generateSystemSplits( modulesToFuse(allFeatureModules), appBundle.getBundleMetadata(),
new ShardedApksGenerator( tmpDir, BUNDLETOOL_VERSION, SplitType.SYSTEM, /* generate64BitShards= */ false) .generateSystemSplits( bundleModule, DEFAULT_METADATA,
private static ImmutableList<ModuleSplit> setVariantTargetingAndSplitType( ImmutableList<ModuleSplit> standaloneApks, SplitType splitType) { return standaloneApks.stream() .map( moduleSplit -> moduleSplit .toBuilder() .setVariantTargeting(standaloneApkVariantTargeting(moduleSplit)) .setSplitType(splitType) .build()) .collect(toImmutableList()); }
private static VariantTargeting standaloneApkVariantTargeting(ModuleSplit standaloneApk) { ApkTargeting apkTargeting = standaloneApk.getApkTargeting(); VariantTargeting.Builder variantTargeting = VariantTargeting.newBuilder(); if (apkTargeting.hasAbiTargeting()) { variantTargeting.setAbiTargeting(apkTargeting.getAbiTargeting()); } if (apkTargeting.hasScreenDensityTargeting()) { variantTargeting.setScreenDensityTargeting(apkTargeting.getScreenDensityTargeting()); } if (apkTargeting.hasMultiAbiTargeting()) { variantTargeting.setMultiAbiTargeting(apkTargeting.getMultiAbiTargeting()); } variantTargeting.setSdkVersionTargeting(sdkVersionTargeting(standaloneApk)); return variantTargeting.build(); }
public ImmutableList<ModuleSplit> generateSplits( ImmutableList<BundleModule> modules, BundleMetadata bundleMetadata, ApkOptimizations apkOptimizations) { return generateSplitsInternal(modules, bundleMetadata, apkOptimizations, Optional.empty()); }
private ImmutableList<ModuleSplit> generateSplitsInternal( ImmutableList<BundleModule> modules, BundleMetadata bundleMetadata, ApkOptimizations apkOptimizations, Optional<DeviceSpec> deviceSpec) { BundleSharder bundleSharder = new BundleSharder(tempDir, bundleVersion, generate64BitShards, deviceSpec); ImmutableList<ModuleSplit> shardedApks = bundleSharder.shardBundle(modules, apkOptimizations.getSplitDimensions(), bundleMetadata); return setVariantTargetingAndSplitType(shardedApks, splitType); }