Search in sources :

Example 1 with ApkGenerationConfiguration

use of com.android.tools.build.bundletool.splitters.ApkGenerationConfiguration in project bundletool by google.

the class BuildApksManager method getCommonSplitApkGenerationConfiguration.

private ApkGenerationConfiguration.Builder getCommonSplitApkGenerationConfiguration(AppBundle appBundle) {
    BundleConfig bundleConfig = appBundle.getBundleConfig();
    Version bundleToolVersion = Version.of(bundleConfig.getBundletool().getVersion());
    ApkGenerationConfiguration.Builder apkGenerationConfiguration = ApkGenerationConfiguration.builder().setOptimizationDimensions(apkOptimizations.getSplitDimensions());
    apkGenerationConfiguration.setEnableUncompressedNativeLibraries(apkOptimizations.getUncompressNativeLibraries());
    apkGenerationConfiguration.setEnableDexCompressionSplitter(apkOptimizations.getUncompressDexFiles());
    apkGenerationConfiguration.setInstallableOnExternalStorage(appBundle.getBaseModule().getAndroidManifest().getInstallLocationValue().map(installLocation -> installLocation.equals("auto") || installLocation.equals("preferExternal")).orElse(false));
    apkGenerationConfiguration.setMasterPinnedResourceIds(appBundle.getMasterPinnedResourceIds());
    apkGenerationConfiguration.setMasterPinnedResourceNames(appBundle.getMasterPinnedResourceNames());
    apkGenerationConfiguration.setSuffixStrippings(apkOptimizations.getSuffixStrippings());
    command.getMinSdkForAdditionalVariantWithV3Rotation().ifPresent(apkGenerationConfiguration::setMinSdkForAdditionalVariantWithV3Rotation);
    return apkGenerationConfiguration;
}
Also used : ApkGenerationConfiguration(com.android.tools.build.bundletool.splitters.ApkGenerationConfiguration) BundleConfig(com.android.bundle.Config.BundleConfig) Version(com.android.tools.build.bundletool.model.version.Version)

Example 2 with ApkGenerationConfiguration

use of com.android.tools.build.bundletool.splitters.ApkGenerationConfiguration in project bundletool by google.

the class BuildApksManager method generateAssetSlices.

private ImmutableList<ModuleSplit> generateAssetSlices(AppBundle appBundle) {
    ApkGenerationConfiguration assetSlicesGenerationConfiguration = getAssetSliceGenerationConfiguration();
    AssetSlicesGenerator assetSlicesGenerator = new AssetSlicesGenerator(appBundle, assetSlicesGenerationConfiguration, command.getAssetModulesVersionOverride());
    return assetSlicesGenerator.generateAssetSlices();
}
Also used : ApkGenerationConfiguration(com.android.tools.build.bundletool.splitters.ApkGenerationConfiguration) AssetSlicesGenerator(com.android.tools.build.bundletool.splitters.AssetSlicesGenerator)

Example 3 with ApkGenerationConfiguration

use of com.android.tools.build.bundletool.splitters.ApkGenerationConfiguration in project bundletool by google.

the class BuildApksManager method generateInstantApks.

private ImmutableList<ModuleSplit> generateInstantApks(AppBundle appBundle) {
    ImmutableList<BundleModule> allFeatureModules = appBundle.getFeatureModules().values().asList();
    ImmutableList<BundleModule> instantModules = allFeatureModules.stream().filter(BundleModule::isInstantModule).collect(toImmutableList());
    ApkGenerationConfiguration instantApkGenerationConfiguration = getCommonSplitApkGenerationConfiguration(appBundle).setForInstantAppVariants(true).setEnableDexCompressionSplitter(false).build();
    return splitApksGenerator.generateSplits(instantModules, instantApkGenerationConfiguration);
}
Also used : ApkGenerationConfiguration(com.android.tools.build.bundletool.splitters.ApkGenerationConfiguration) BundleModule(com.android.tools.build.bundletool.model.BundleModule)

Aggregations

ApkGenerationConfiguration (com.android.tools.build.bundletool.splitters.ApkGenerationConfiguration)3 BundleConfig (com.android.bundle.Config.BundleConfig)1 BundleModule (com.android.tools.build.bundletool.model.BundleModule)1 Version (com.android.tools.build.bundletool.model.version.Version)1 AssetSlicesGenerator (com.android.tools.build.bundletool.splitters.AssetSlicesGenerator)1