use of com.android.bundle.Config.BundleConfig 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;
}
use of com.android.bundle.Config.BundleConfig in project bundletool by google.
the class DumpManager method printBundleConfig.
void printBundleConfig() {
try (ZipFile zipFile = new ZipFile(bundlePath.toFile())) {
BundleConfig bundleConfig = extractAndParse(zipFile, ZipPath.create("BundleConfig.pb"), BundleConfig::parseFrom);
printStream.println(JsonFormat.printer().print(bundleConfig));
} catch (IOException e) {
throw new UncheckedIOException("Error occurred when reading the bundle.", e);
}
}
use of com.android.bundle.Config.BundleConfig in project bundletool by google.
the class BundleConfigValidator method validateBundle.
@Override
public void validateBundle(AppBundle bundle) {
BundleConfig bundleConfig = bundle.getBundleConfig();
validateVersion(bundleConfig);
validateCompression(bundleConfig.getCompression());
validateOptimizations(bundleConfig.getOptimizations());
validateMasterResources(bundleConfig, bundle);
}
use of com.android.bundle.Config.BundleConfig in project bundletool by google.
the class BundleModulesValidator method validate.
public ImmutableList<BundleModule> validate(ImmutableList<ZipFile> moduleZips, BundleConfig bundleConfig) {
for (ZipFile moduleZip : moduleZips) {
new ValidatorRunner(MODULE_FILE_SUB_VALIDATORS).validateModuleZipFile(moduleZip);
}
ImmutableList<BundleModule> modules = moduleZips.stream().map(module -> toBundleModule(module, bundleConfig)).collect(toImmutableList());
new ValidatorRunner(MODULES_SUB_VALIDATORS).validateBundleModules(modules);
return modules;
}
use of com.android.bundle.Config.BundleConfig in project bundletool by google.
the class BundleModulesValidator method toBundleModule.
private BundleModule toBundleModule(ZipFile moduleZipFile, BundleConfig bundleConfig) {
BundleModule bundleModule = BundleModule.builder().setName(BundleModuleName.create("TEMPORARY_MODULE_NAME")).setBundleConfig(bundleConfig).addEntries(moduleZipFile.stream().filter(not(ZipEntry::isDirectory)).map(zipEntry -> ModuleEntry.builder().setPath(ZipPath.create(zipEntry.getName())).setContent(ZipUtils.asByteSource(moduleZipFile, zipEntry)).build()).collect(toImmutableList())).build();
BundleModuleName actualModuleName = bundleModule.getAndroidManifest().getSplitId().map(BundleModuleName::create).orElse(BundleModuleName.BASE_MODULE_NAME);
return bundleModule.toBuilder().setName(actualModuleName).build();
}
Aggregations