Search in sources :

Example 1 with ABI

use of com.android.tools.build.bundletool.model.OptimizationDimension.ABI in project bundletool by google.

the class BuildApksManagerTest method buildApksCommand_standalone_mixedTargeting.

@Test
public void buildApksCommand_standalone_mixedTargeting() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.setManifest(androidManifest("com.test.app")).setResourceTable(resourceTableWithTestLabel("Test feature"))).addModule("feature_abi_lib", builder -> builder.addFile("lib/x86/libfeature.so").addFile("lib/x86_64/libfeature.so").setNativeConfig(nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(X86)), targetedNativeDirectory("lib/x86_64", nativeDirectoryTargeting(X86_64)))).setManifest(androidManifestForFeature("com.test.app", withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).addModule("feature_lang_assets", builder -> builder.addFile("assets/strings#lang_en/trans.txt").addFile("assets/strings#lang_fr/trans.txt").setAssetsConfig(assets(targetedAssetsDirectory("assets/strings#lang_en", assetsDirectoryTargeting(languageTargeting("en"))), targetedAssetsDirectory("assets/strings#lang_fr", assetsDirectoryTargeting(languageTargeting("fr"))))).setManifest(androidManifestForFeature("com.test.app", withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).addModule("feature_tcf_assets", builder -> builder.addFile("assets/textures#tcf_atc/texture.dat").addFile("assets/textures#tcf_etc1/texture.dat").setAssetsConfig(assets(targetedAssetsDirectory("assets/textures#tcf_atc", assetsDirectoryTargeting(textureCompressionTargeting(ATC))), targetedAssetsDirectory("assets/textures#tcf_etc1", assetsDirectoryTargeting(textureCompressionTargeting(ETC1_RGB8))))).setManifest(androidManifestForFeature("com.test.app", withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).build();
    TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputFilePath).withOptimizationDimensions(ABI).build());
    buildApksManager.execute();
    ZipFile apkSetFile = openZipFile(outputFilePath.toFile());
    BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir);
    ImmutableMap<Abi, ApkDescription> standaloneApksByAbi = Maps.uniqueIndex(apkDescriptions(standaloneApkVariants(result)), apkDesc -> getOnlyElement(apkDesc.getTargeting().getAbiTargeting().getValueList()));
    assertThat(standaloneApksByAbi.keySet()).containsExactly(toAbi(X86), toAbi(X86_64));
    File x86ApkFile = extractFromApkSetFile(apkSetFile, standaloneApksByAbi.get(toAbi(X86)).getPath(), outputDir);
    try (ZipFile x86Zip = new ZipFile(x86ApkFile)) {
        // ABI-specific files.
        assertThat(x86Zip).hasFile("lib/x86/libfeature.so");
        assertThat(x86Zip).doesNotHaveFile("lib/x86_64/libfeature.so");
        // Included in each standalone APK.
        assertThat(x86Zip).hasFile("assets/strings#lang_en/trans.txt");
        assertThat(x86Zip).hasFile("assets/strings#lang_fr/trans.txt");
        assertThat(x86Zip).hasFile("assets/textures#tcf_atc/texture.dat");
        assertThat(x86Zip).hasFile("assets/textures#tcf_etc1/texture.dat");
    }
    File x64ApkFile = extractFromApkSetFile(apkSetFile, standaloneApksByAbi.get(toAbi(X86_64)).getPath(), outputDir);
    try (ZipFile x64Zip = new ZipFile(x64ApkFile)) {
        // ABI-specific files.
        assertThat(x64Zip).hasFile("lib/x86_64/libfeature.so");
        assertThat(x64Zip).doesNotHaveFile("lib/x86/libfeature.so");
        // Included in each standalone APK.
        assertThat(x64Zip).hasFile("assets/strings#lang_en/trans.txt");
        assertThat(x64Zip).hasFile("assets/strings#lang_fr/trans.txt");
        assertThat(x64Zip).hasFile("assets/textures#tcf_atc/texture.dat");
        assertThat(x64Zip).hasFile("assets/textures#tcf_etc1/texture.dat");
    }
}
Also used : TEST_LABEL_RESOURCE_ID(com.android.tools.build.bundletool.testing.ResourcesTableFactory.TEST_LABEL_RESOURCE_ID) SYSTEM(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.SYSTEM) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ApkSetUtils.parseTocFromFile(com.android.tools.build.bundletool.testing.ApkSetUtils.parseTocFromFile) TargetingUtils.alternativeLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeLanguageTargeting) Bundletool(com.android.bundle.Config.Bundletool) ARM64_V8A(com.android.bundle.Targeting.Abi.AbiAlias.ARM64_V8A) AssetModulesConfig(com.android.bundle.Config.AssetModulesConfig) Map(java.util.Map) DensityAlias(com.android.bundle.Targeting.ScreenDensity.DensityAlias) TestUtils.filesUnderPath(com.android.tools.build.bundletool.testing.TestUtils.filesUnderPath) Path(java.nio.file.Path) SourceStamp(com.android.tools.build.bundletool.model.SourceStamp) ManifestProtoUtils.withTitle(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withTitle) TargetingUtils.nativeDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.nativeDirectoryTargeting) ASSETS_DIRECTORY(com.android.tools.build.bundletool.model.BundleModule.ASSETS_DIRECTORY) DIRECTORY(com.android.tools.build.bundletool.commands.BuildApksCommand.OutputFormat.DIRECTORY) DeviceFactory.sdkVersion(com.android.tools.build.bundletool.testing.DeviceFactory.sdkVersion) ApkSet(com.android.bundle.Commands.ApkSet) BundleConfig(com.android.bundle.Config.BundleConfig) TextureCompressionFormatTargeting(com.android.bundle.Targeting.TextureCompressionFormatTargeting) TargetingUtils.variantAbiTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantAbiTargeting) SystemApkOption(com.android.tools.build.bundletool.commands.BuildApksCommand.SystemApkOption) ManifestProtoUtils.androidManifestForFeature(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifestForFeature) TargetingUtils.assetsDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.assetsDirectoryTargeting) CodeTransparency(com.android.bundle.CodeTransparencyOuterClass.CodeTransparency) SystemApkMetadata(com.android.bundle.Commands.SystemApkMetadata) STAMP_SOURCE_METADATA_KEY(com.android.tools.build.bundletool.model.SourceStamp.STAMP_SOURCE_METADATA_KEY) MDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.MDPI) ApexManifest(com.android.apex.ApexManifestProto.ApexManifest) ZipPath(com.android.tools.build.bundletool.model.ZipPath) ManifestProtoUtils.withInstantOnDemandDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstantOnDemandDelivery) RunWith(org.junit.runner.RunWith) MDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.MDPI_VALUE) SdkVersion(com.android.bundle.Targeting.SdkVersion) TEXTURE_COMPRESSION_FORMAT(com.android.tools.build.bundletool.model.OptimizationDimension.TEXTURE_COMPRESSION_FORMAT) DeviceFactory.mergeSpecs(com.android.tools.build.bundletool.testing.DeviceFactory.mergeSpecs) StandaloneApkMetadata(com.android.bundle.Commands.StandaloneApkMetadata) SigningConfiguration(com.android.tools.build.bundletool.model.SigningConfiguration) Theories(org.junit.experimental.theories.Theories) ResultUtils.instantApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.instantApkVariants) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) ApkDescription(com.android.bundle.Commands.ApkDescription) Before(org.junit.Before) X86(com.android.bundle.Targeting.Abi.AbiAlias.X86) USER_PACKAGE_OFFSET(com.android.tools.build.bundletool.testing.ResourcesTableFactory.USER_PACKAGE_OFFSET) AssetSliceSet(com.android.bundle.Commands.AssetSliceSet) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) IOException(java.io.IOException) Test(org.junit.Test) Correspondence(com.google.common.truth.Correspondence) ALL_MODULES_SHORTCUT(com.android.tools.build.bundletool.commands.ExtractApksCommand.ALL_MODULES_SHORTCUT) ResultUtils.apexApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.apexApkVariants) AppBundle(com.android.tools.build.bundletool.model.AppBundle) CodeRelatedFile(com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile) X509Certificate(java.security.cert.X509Certificate) ManifestProtoUtils.withNativeActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withNativeActivity) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) Maps.transformValues(com.google.common.collect.Maps.transformValues) ManifestProtoUtils.withInstallLocation(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstallLocation) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) AssetsDirectoryTargeting(com.android.bundle.Targeting.AssetsDirectoryTargeting) TargetingUtils.languageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.languageTargeting) ManifestProtoUtils.withOnDemandDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withOnDemandDelivery) ZipFile(java.util.zip.ZipFile) ZipEntry(java.util.zip.ZipEntry) PERSISTENT(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.PERSISTENT) ImmutableSet(com.google.common.collect.ImmutableSet) Collection(java.util.Collection) KeyStore(java.security.KeyStore) InstantMetadata(com.android.bundle.Commands.InstantMetadata) Collectors(java.util.stream.Collectors) ScreenDensity(com.android.bundle.Targeting.ScreenDensity) InvalidVersionCodeException(com.android.tools.build.bundletool.model.exceptions.InvalidVersionCodeException) DefaultTargetingValue(com.android.bundle.Commands.DefaultTargetingValue) ManifestProtoUtils.withOnDemandAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withOnDemandAttribute) CertificateHelper(com.android.tools.build.bundletool.model.utils.CertificateHelper) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ApkSetUtils(com.android.tools.build.bundletool.testing.ApkSetUtils) PermanentlyFusedModule(com.android.bundle.Commands.PermanentlyFusedModule) FilePreconditions(com.android.tools.build.bundletool.model.utils.files.FilePreconditions) ManifestProtoUtils.withMaxSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMaxSdkVersion) BundleType(com.android.bundle.Config.BundleConfig.BundleType) DeviceFactory.locales(com.android.tools.build.bundletool.testing.DeviceFactory.locales) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) TargetingUtils.alternativeTextureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeTextureCompressionTargeting) TargetingUtils.variantSdkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantSdkTargeting) ResultUtils.standaloneApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.standaloneApkVariants) ApkModifier(com.android.tools.build.bundletool.model.ApkModifier) BundleConfigBuilder(com.android.tools.build.bundletool.testing.BundleConfigBuilder) Hashing(com.google.common.hash.Hashing) TargetingUtils.moduleDeviceGroupsTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.moduleDeviceGroupsTargeting) ManifestProtoUtils.withDeviceGroupsCondition(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withDeviceGroupsCondition) TargetingUtils.toAbi(com.android.tools.build.bundletool.testing.TargetingUtils.toAbi) Inject(javax.inject.Inject) ModuleMetadata(com.android.bundle.Commands.ModuleMetadata) ImmutableList(com.google.common.collect.ImmutableList) Charset(java.nio.charset.Charset) ManifestProtoUtils.withSplitNameService(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withSplitNameService) CharSource(com.google.common.io.CharSource) Truth8.assertThat(com.google.common.truth.Truth8.assertThat) LDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.LDPI) CertificateFactory(com.android.tools.build.bundletool.testing.CertificateFactory) TargetingUtils.sdkVersionFrom(com.android.tools.build.bundletool.testing.TargetingUtils.sdkVersionFrom) TestData(com.android.tools.build.bundletool.TestData) Truth.assertThat(com.google.common.truth.Truth.assertThat) FileUtils(com.android.tools.build.bundletool.testing.FileUtils) TargetingUtils.nativeLibraries(com.android.tools.build.bundletool.testing.TargetingUtils.nativeLibraries) Ignore(org.junit.Ignore) InvalidCommandException(com.android.tools.build.bundletool.model.exceptions.InvalidCommandException) ApkVerifier(com.android.apksig.ApkVerifier) Configuration(com.android.aapt.ConfigurationOuterClass.Configuration) KeyPair(java.security.KeyPair) Value(com.android.bundle.Config.SplitDimension.Value) UNIVERSAL(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.UNIVERSAL) ResourcesTableFactory.locale(com.android.tools.build.bundletool.testing.ResourcesTableFactory.locale) TargetingUtils.textureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionTargeting) DeviceFactory.abis(com.android.tools.build.bundletool.testing.DeviceFactory.abis) TargetingUtils.variantMultiAbiTargetingFromAllTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantMultiAbiTargetingFromAllTargeting) DeliveryType(com.android.bundle.Commands.DeliveryType) ManifestProtoUtils.withUsesSplit(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withUsesSplit) ResourcesTableFactory.resourceTableWithTestLabel(com.android.tools.build.bundletool.testing.ResourcesTableFactory.resourceTableWithTestLabel) Version(com.android.tools.build.bundletool.model.version.Version) TruthZip(com.android.tools.build.bundletool.testing.truth.zip.TruthZip) Theory(org.junit.experimental.theories.Theory) KeyPairGenerator(java.security.KeyPairGenerator) ImmutableMultiset.toImmutableMultiset(com.google.common.collect.ImmutableMultiset.toImmutableMultiset) BundleToolVersion(com.android.tools.build.bundletool.model.version.BundleToolVersion) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Set(java.util.Set) ARMEABI_V7A(com.android.bundle.Targeting.Abi.AbiAlias.ARMEABI_V7A) LanguageTargeting(com.android.bundle.Targeting.LanguageTargeting) ManifestProtoUtils.withInstallTimeRemovableElement(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstallTimeRemovableElement) Executors(java.util.concurrent.Executors) ManifestProtoUtils.withMinSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMinSdkVersion) ApexImages(com.android.bundle.Files.ApexImages) TargetingUtils.apexImageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apexImageTargeting) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) DeviceFactory.density(com.android.tools.build.bundletool.testing.DeviceFactory.density) TextureCompressionFormat(com.android.bundle.Targeting.TextureCompressionFormat) PrivateKey(java.security.PrivateKey) ByteStreams(com.google.common.io.ByteStreams) ManifestProtoUtils.withInstallTimeDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstallTimeDelivery) ResultUtils.systemApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.systemApkVariants) DEVELOPMENT_SDK_VERSION(com.android.tools.build.bundletool.model.AndroidManifest.DEVELOPMENT_SDK_VERSION) TargetingUtils.targetedApexImage(com.android.tools.build.bundletool.testing.TargetingUtils.targetedApexImage) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) TruthZip.assertThat(com.android.tools.build.bundletool.testing.truth.zip.TruthZip.assertThat) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Iterables(com.google.common.collect.Iterables) Optimizations(com.android.bundle.Config.Optimizations) ATC(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ATC) TargetingUtils.textureCompressionFormat(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionFormat) Component(dagger.Component) LANGUAGE(com.android.tools.build.bundletool.model.OptimizationDimension.LANGUAGE) ApkSetUtils.extractTocFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractTocFromApkSetFile) Closer(com.google.common.io.Closer) ImmutableMultiset(com.google.common.collect.ImmutableMultiset) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ResultUtils.splitApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.splitApkVariants) SplitApkMetadata(com.android.bundle.Commands.SplitApkMetadata) ANDROID_P_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_P_API_VERSION) ByteSource(com.google.common.io.ByteSource) CodeTransparencyTestUtils.createJwsToken(com.android.tools.build.bundletool.testing.CodeTransparencyTestUtils.createJwsToken) ANDROID_Q_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_Q_API_VERSION) VariantTargeting(com.android.bundle.Targeting.VariantTargeting) AdbServer(com.android.tools.build.bundletool.device.AdbServer) StandaloneConfig(com.android.bundle.Config.StandaloneConfig) Int32Value(com.google.protobuf.Int32Value) DeviceFactory.deviceTier(com.android.tools.build.bundletool.testing.DeviceFactory.deviceTier) Files(java.nio.file.Files) ANDROID_N_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_N_API_VERSION) TargetingUtils.targetedNativeDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedNativeDirectory) TestCase.fail(junit.framework.TestCase.fail) FileOutputStream(java.io.FileOutputStream) X86_64(com.android.bundle.Targeting.Abi.AbiAlias.X86_64) BundleMetadata(com.android.tools.build.bundletool.model.BundleMetadata) ANDROID_M_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_M_API_VERSION) TargetingUtils.assets(com.android.tools.build.bundletool.testing.TargetingUtils.assets) File(java.io.File) ApkSetUtils.extractFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractFromApkSetFile) ResultUtils.archivedApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.archivedApkVariants) Paths(java.nio.file.Paths) FakeAdbServer(com.android.tools.build.bundletool.testing.FakeAdbServer) Abi(com.android.bundle.Targeting.Abi) TargetingUtils.sdkVersionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.sdkVersionTargeting) ManifestProtoUtils.withAppIcon(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withAppIcon) Variant(com.android.bundle.Commands.Variant) TestUtils.extractAndroidManifest(com.android.tools.build.bundletool.testing.TestUtils.extractAndroidManifest) MoreCollectors.onlyElement(com.google.common.collect.MoreCollectors.onlyElement) ManifestProtoUtils.androidManifestForAssetModule(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifestForAssetModule) TargetingUtils.mergeVariantTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeVariantTargeting) ManifestProtoUtils.withDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withDelivery) TargetingUtils.deviceTierTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.deviceTierTargeting) TargetingUtils.targetedAssetsDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedAssetsDirectory) After(org.junit.After) ManifestProtoUtils.withTargetSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withTargetSdkVersion) ImmutableMap(com.google.common.collect.ImmutableMap) FromDataPoints(org.junit.experimental.theories.FromDataPoints) List(java.util.List) Certificate(java.security.cert.Certificate) INSTANT(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.INSTANT) DataPoints(org.junit.experimental.theories.DataPoints) ABI(com.android.tools.build.bundletool.model.OptimizationDimension.ABI) ManifestProtoUtils.withCustomThemeActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withCustomThemeActivity) TargetingUtils.apkLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkLanguageTargeting) TestModule(com.android.tools.build.bundletool.testing.TestModule) BeforeClass(org.junit.BeforeClass) TargetingUtils.apexImages(com.android.tools.build.bundletool.testing.TargetingUtils.apexImages) BuildApksResult(com.android.bundle.Commands.BuildApksResult) DeviceTierTargeting(com.android.bundle.Targeting.DeviceTierTargeting) SdkVersionTargeting(com.android.bundle.Targeting.SdkVersionTargeting) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) MIPS(com.android.bundle.Targeting.Abi.AbiAlias.MIPS) ManifestProtoUtils.withInstant(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstant) ARCHIVE(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.ARCHIVE) Assert.assertNotNull(org.junit.Assert.assertNotNull) InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) ManifestProtoUtils.withFusingAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withFusingAttribute) TargetingUtils.apkMultiAbiTargetingFromAllTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkMultiAbiTargetingFromAllTargeting) ETC1_RGB8(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ETC1_RGB8) AssetModulesInfo(com.android.bundle.Commands.AssetModulesInfo) Maps(com.google.common.collect.Maps) AbiAlias(com.android.bundle.Targeting.Abi.AbiAlias) Rule(org.junit.Rule) Collections(java.util.Collections) TemporaryFolder(org.junit.rules.TemporaryFolder) AppBundle(com.android.tools.build.bundletool.model.AppBundle) ApkDescription(com.android.bundle.Commands.ApkDescription) ZipFile(java.util.zip.ZipFile) BuildApksResult(com.android.bundle.Commands.BuildApksResult) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) TargetingUtils.toAbi(com.android.tools.build.bundletool.testing.TargetingUtils.toAbi) Abi(com.android.bundle.Targeting.Abi) ApkSetUtils.parseTocFromFile(com.android.tools.build.bundletool.testing.ApkSetUtils.parseTocFromFile) CodeRelatedFile(com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile) ZipFile(java.util.zip.ZipFile) ApkSetUtils.extractTocFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractTocFromApkSetFile) File(java.io.File) ApkSetUtils.extractFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractFromApkSetFile) Test(org.junit.Test)

Example 2 with ABI

use of com.android.tools.build.bundletool.model.OptimizationDimension.ABI in project bundletool by google.

the class ModuleSplitterTest method nativeSplits_lPlusTargeting_withAbiAndUncompressNativeLibsSplitter.

@Test
public void nativeSplits_lPlusTargeting_withAbiAndUncompressNativeLibsSplitter() throws Exception {
    NativeLibraries nativeConfig = nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting("x86")));
    BundleModule testModule = new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).setNativeConfig(nativeConfig).addFile("lib/x86/liba.so").build();
    ModuleSplitter moduleSplitter = ModuleSplitter.createNoStamp(testModule, BUNDLETOOL_VERSION, APP_BUNDLE, ApkGenerationConfiguration.builder().setOptimizationDimensions(ImmutableSet.of(ABI)).setEnableUncompressedNativeLibraries(true).build(), lPlusVariantTargeting(), ImmutableSet.of("testModule"));
    List<ModuleSplit> splits = moduleSplitter.splitModule();
    // Base + X86 Split
    assertThat(splits).hasSize(2);
    assertThat(splits.stream().map(ModuleSplit::getSplitType).distinct().collect(toImmutableSet())).containsExactly(SplitType.SPLIT);
    assertThat(splits.stream().map(split -> split.getVariantTargeting()).collect(toImmutableSet())).containsExactly(variantMinSdkTargeting(ANDROID_L_API_VERSION));
    ModuleSplit master = splits.stream().filter(ModuleSplit::isMasterSplit).collect(onlyElement());
    ModuleSplit abi = splits.stream().filter(not(ModuleSplit::isMasterSplit)).collect(onlyElement());
    assertThat(master.getAndroidManifest().getExtractNativeLibsValue()).hasValue(true);
    assertThat(abi.findEntry("lib/x86/liba.so").get().getForceUncompressed()).isFalse();
}
Also used : ManifestProtoUtils.withSplitNameActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withSplitNameActivity) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ResourcesTableFactory.locale(com.android.tools.build.bundletool.testing.ResourcesTableFactory.locale) TargetingUtils.textureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionTargeting) TargetingUtils.alternativeLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeLanguageTargeting) SCREEN_DENSITY(com.android.tools.build.bundletool.model.OptimizationDimension.SCREEN_DENSITY) Predicates.not(com.google.common.base.Predicates.not) ResourceId(com.android.tools.build.bundletool.model.ResourceId) Map(java.util.Map) DEVICE_TIER(com.android.tools.build.bundletool.model.OptimizationDimension.DEVICE_TIER) TargetingUtils.lPlusVariantTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.lPlusVariantTargeting) ManifestMutator.withExtractNativeLibs(com.android.tools.build.bundletool.model.ManifestMutator.withExtractNativeLibs) DensityAlias(com.android.bundle.Targeting.ScreenDensity.DensityAlias) Version(com.android.tools.build.bundletool.model.version.Version) ResourcesTableFactory.type(com.android.tools.build.bundletool.testing.ResourcesTableFactory.type) ResourceTable(com.android.aapt.Resources.ResourceTable) SPLIT_NAME_RESOURCE_ID(com.android.tools.build.bundletool.model.AndroidManifest.SPLIT_NAME_RESOURCE_ID) ModuleSplitUtils.applyManifestMutators(com.android.tools.build.bundletool.testing.ModuleSplitUtils.applyManifestMutators) BundleToolVersion(com.android.tools.build.bundletool.model.version.BundleToolVersion) TargetingUtils.nativeDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.nativeDirectoryTargeting) ConfigValue(com.android.aapt.Resources.ConfigValue) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) StampType(com.android.tools.build.bundletool.model.SourceStamp.StampType) ManifestProtoUtils.withMinSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMinSdkVersion) ModuleEntry(com.android.tools.build.bundletool.model.ModuleEntry) Assets(com.android.bundle.Files.Assets) TargetingUtils.assetsDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.assetsDirectoryTargeting) STAMP_TYPE_METADATA_KEY(com.android.tools.build.bundletool.model.SourceStamp.STAMP_TYPE_METADATA_KEY) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Iterables(com.google.common.collect.Iterables) STAMP_SOURCE_METADATA_KEY(com.android.tools.build.bundletool.model.SourceStamp.STAMP_SOURCE_METADATA_KEY) TargetingUtils.variantMinSdkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantMinSdkTargeting) ZipPath(com.android.tools.build.bundletool.model.ZipPath) OptimizationDimension(com.android.tools.build.bundletool.model.OptimizationDimension) ATC(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ATC) RunWith(org.junit.runner.RunWith) TargetingUtils.apkMinSdkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkMinSdkTargeting) TEXTURE_COMPRESSION_FORMAT(com.android.tools.build.bundletool.model.OptimizationDimension.TEXTURE_COMPRESSION_FORMAT) TargetingUtils.getSplitsWithTargetingEqualTo(com.android.tools.build.bundletool.testing.TargetingUtils.getSplitsWithTargetingEqualTo) TruthResourceTable.assertThat(com.android.tools.build.bundletool.testing.truth.resources.TruthResourceTable.assertThat) ANDROID_R_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_R_API_VERSION) LANGUAGE(com.android.tools.build.bundletool.model.OptimizationDimension.LANGUAGE) ManifestProtoUtils.withMetadataResource(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMetadataResource) ResourcesTableFactory.mergeConfigs(com.android.tools.build.bundletool.testing.ResourcesTableFactory.mergeConfigs) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) XmlProtoElement(com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElement) ResourcesTableFactory.pkg(com.android.tools.build.bundletool.testing.ResourcesTableFactory.pkg) ANDROID_Q_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_Q_API_VERSION) VariantTargeting(com.android.bundle.Targeting.VariantTargeting) SuffixStripping(com.android.bundle.Config.SuffixStripping) ManifestProtoUtils.clearApplication(com.android.tools.build.bundletool.testing.ManifestProtoUtils.clearApplication) USER_PACKAGE_OFFSET(com.android.tools.build.bundletool.testing.ResourcesTableFactory.USER_PACKAGE_OFFSET) HDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.HDPI) TargetingUtils.targetedNativeDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedNativeDirectory) TestCase.fail(junit.framework.TestCase.fail) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) Test(org.junit.Test) ANDROID_L_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_L_API_VERSION) ANDROID_M_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_M_API_VERSION) TargetingUtils.assets(com.android.tools.build.bundletool.testing.TargetingUtils.assets) TargetingUtils.apkDensityTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkDensityTargeting) XmlNode(com.android.aapt.Resources.XmlNode) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) ManifestProtoUtils.withMainActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMainActivity) ModuleSplitUtils.createModuleSplitBuilder(com.android.tools.build.bundletool.testing.ModuleSplitUtils.createModuleSplitBuilder) AppBundle(com.android.tools.build.bundletool.model.AppBundle) BundleModule(com.android.tools.build.bundletool.model.BundleModule) TargetingUtils.apkDeviceTierTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkDeviceTierTargeting) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) ManifestProtoUtils.xmlAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.xmlAttribute) MoreCollectors.onlyElement(com.google.common.collect.MoreCollectors.onlyElement) ANDROID_NAMESPACE_URI(com.android.tools.build.bundletool.model.AndroidManifest.ANDROID_NAMESPACE_URI) TargetingUtils.deviceTierTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.deviceTierTargeting) TargetingUtils.targetedAssetsDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedAssetsDirectory) NAME_RESOURCE_ID(com.android.tools.build.bundletool.model.AndroidManifest.NAME_RESOURCE_ID) ResourcesTableFactory.entry(com.android.tools.build.bundletool.testing.ResourcesTableFactory.entry) TargetingUtils.languageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.languageTargeting) ImmutableSet(com.google.common.collect.ImmutableSet) ResourcesTableFactory.value(com.android.tools.build.bundletool.testing.ResourcesTableFactory.value) TargetingUtils.apkTextureTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkTextureTargeting) ImmutableMap(com.google.common.collect.ImmutableMap) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) SplitType(com.android.tools.build.bundletool.model.ModuleSplit.SplitType) Sets(com.google.common.collect.Sets) Preconditions.checkState(com.google.common.base.Preconditions.checkState) NativeLibraries(com.android.bundle.Files.NativeLibraries) List(java.util.List) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) Optional(java.util.Optional) ABI(com.android.tools.build.bundletool.model.OptimizationDimension.ABI) TargetingUtils.apkLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkLanguageTargeting) ManifestProtoUtils.withMaxSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMaxSdkVersion) TargetingUtils.apkAbiTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkAbiTargeting) BundleModuleName(com.android.tools.build.bundletool.model.BundleModuleName) TestUtils.extractPaths(com.android.tools.build.bundletool.testing.TestUtils.extractPaths) ResourcesTableFactory.resourceTable(com.android.tools.build.bundletool.testing.ResourcesTableFactory.resourceTable) TargetingUtils.toAbi(com.android.tools.build.bundletool.testing.TargetingUtils.toAbi) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) ImmutableList(com.google.common.collect.ImmutableList) ACTIVITY_ELEMENT_NAME(com.android.tools.build.bundletool.model.AndroidManifest.ACTIVITY_ELEMENT_NAME) S3TC(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.S3TC) Truth8.assertThat(com.google.common.truth.Truth8.assertThat) ManifestProtoUtils.withInstant(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstant) APPLICATION_ELEMENT_NAME(com.android.tools.build.bundletool.model.AndroidManifest.APPLICATION_ELEMENT_NAME) JUnit4(org.junit.runners.JUnit4) XHDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.XHDPI) Truth.assertThat(com.google.common.truth.Truth.assertThat) ETC1_RGB8(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ETC1_RGB8) Maps(com.google.common.collect.Maps) ResourcesTableFactory.fileReference(com.android.tools.build.bundletool.testing.ResourcesTableFactory.fileReference) TargetingUtils.nativeLibraries(com.android.tools.build.bundletool.testing.TargetingUtils.nativeLibraries) AbiAlias(com.android.bundle.Targeting.Abi.AbiAlias) Ignore(org.junit.Ignore) TargetingUtils.apkAlternativeLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkAlternativeLanguageTargeting) XmlElement(com.android.aapt.Resources.XmlElement) Versions(com.android.tools.build.bundletool.model.utils.Versions) Configuration(com.android.aapt.ConfigurationOuterClass.Configuration) NativeLibraries(com.android.bundle.Files.NativeLibraries) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 3 with ABI

use of com.android.tools.build.bundletool.model.OptimizationDimension.ABI in project bundletool by google.

the class ModuleSplitterTest method nativeSplits_mPlusTargeting_withAbiAndUncompressNativeLibsSplitter.

@Test
public void nativeSplits_mPlusTargeting_withAbiAndUncompressNativeLibsSplitter() throws Exception {
    NativeLibraries nativeConfig = nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting("x86")));
    BundleModule testModule = new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).setNativeConfig(nativeConfig).addFile("lib/x86/liba.so").build();
    ModuleSplitter moduleSplitter = ModuleSplitter.createNoStamp(testModule, BUNDLETOOL_VERSION, APP_BUNDLE, ApkGenerationConfiguration.builder().setOptimizationDimensions(ImmutableSet.of(ABI)).setEnableUncompressedNativeLibraries(true).build(), variantMinSdkTargeting(ANDROID_M_API_VERSION), ImmutableSet.of("testModule"));
    List<ModuleSplit> splits = moduleSplitter.splitModule();
    // Base + X86 Split
    assertThat(splits).hasSize(2);
    assertThat(splits.stream().map(ModuleSplit::getSplitType).distinct().collect(toImmutableSet())).containsExactly(SplitType.SPLIT);
    assertThat(splits.stream().map(split -> split.getVariantTargeting()).collect(toImmutableSet())).containsExactly(variantMinSdkTargeting(ANDROID_M_API_VERSION));
    ModuleSplit master = splits.stream().filter(ModuleSplit::isMasterSplit).collect(onlyElement());
    ModuleSplit abi = splits.stream().filter(not(ModuleSplit::isMasterSplit)).collect(onlyElement());
    assertThat(master.getAndroidManifest().getExtractNativeLibsValue()).hasValue(false);
    assertThat(abi.findEntry("lib/x86/liba.so").get().getForceUncompressed()).isTrue();
}
Also used : ManifestProtoUtils.withSplitNameActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withSplitNameActivity) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ResourcesTableFactory.locale(com.android.tools.build.bundletool.testing.ResourcesTableFactory.locale) TargetingUtils.textureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionTargeting) TargetingUtils.alternativeLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeLanguageTargeting) SCREEN_DENSITY(com.android.tools.build.bundletool.model.OptimizationDimension.SCREEN_DENSITY) Predicates.not(com.google.common.base.Predicates.not) ResourceId(com.android.tools.build.bundletool.model.ResourceId) Map(java.util.Map) DEVICE_TIER(com.android.tools.build.bundletool.model.OptimizationDimension.DEVICE_TIER) TargetingUtils.lPlusVariantTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.lPlusVariantTargeting) ManifestMutator.withExtractNativeLibs(com.android.tools.build.bundletool.model.ManifestMutator.withExtractNativeLibs) DensityAlias(com.android.bundle.Targeting.ScreenDensity.DensityAlias) Version(com.android.tools.build.bundletool.model.version.Version) ResourcesTableFactory.type(com.android.tools.build.bundletool.testing.ResourcesTableFactory.type) ResourceTable(com.android.aapt.Resources.ResourceTable) SPLIT_NAME_RESOURCE_ID(com.android.tools.build.bundletool.model.AndroidManifest.SPLIT_NAME_RESOURCE_ID) ModuleSplitUtils.applyManifestMutators(com.android.tools.build.bundletool.testing.ModuleSplitUtils.applyManifestMutators) BundleToolVersion(com.android.tools.build.bundletool.model.version.BundleToolVersion) TargetingUtils.nativeDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.nativeDirectoryTargeting) ConfigValue(com.android.aapt.Resources.ConfigValue) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) StampType(com.android.tools.build.bundletool.model.SourceStamp.StampType) ManifestProtoUtils.withMinSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMinSdkVersion) ModuleEntry(com.android.tools.build.bundletool.model.ModuleEntry) Assets(com.android.bundle.Files.Assets) TargetingUtils.assetsDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.assetsDirectoryTargeting) STAMP_TYPE_METADATA_KEY(com.android.tools.build.bundletool.model.SourceStamp.STAMP_TYPE_METADATA_KEY) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Iterables(com.google.common.collect.Iterables) STAMP_SOURCE_METADATA_KEY(com.android.tools.build.bundletool.model.SourceStamp.STAMP_SOURCE_METADATA_KEY) TargetingUtils.variantMinSdkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantMinSdkTargeting) ZipPath(com.android.tools.build.bundletool.model.ZipPath) OptimizationDimension(com.android.tools.build.bundletool.model.OptimizationDimension) ATC(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ATC) RunWith(org.junit.runner.RunWith) TargetingUtils.apkMinSdkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkMinSdkTargeting) TEXTURE_COMPRESSION_FORMAT(com.android.tools.build.bundletool.model.OptimizationDimension.TEXTURE_COMPRESSION_FORMAT) TargetingUtils.getSplitsWithTargetingEqualTo(com.android.tools.build.bundletool.testing.TargetingUtils.getSplitsWithTargetingEqualTo) TruthResourceTable.assertThat(com.android.tools.build.bundletool.testing.truth.resources.TruthResourceTable.assertThat) ANDROID_R_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_R_API_VERSION) LANGUAGE(com.android.tools.build.bundletool.model.OptimizationDimension.LANGUAGE) ManifestProtoUtils.withMetadataResource(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMetadataResource) ResourcesTableFactory.mergeConfigs(com.android.tools.build.bundletool.testing.ResourcesTableFactory.mergeConfigs) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) XmlProtoElement(com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElement) ResourcesTableFactory.pkg(com.android.tools.build.bundletool.testing.ResourcesTableFactory.pkg) ANDROID_Q_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_Q_API_VERSION) VariantTargeting(com.android.bundle.Targeting.VariantTargeting) SuffixStripping(com.android.bundle.Config.SuffixStripping) ManifestProtoUtils.clearApplication(com.android.tools.build.bundletool.testing.ManifestProtoUtils.clearApplication) USER_PACKAGE_OFFSET(com.android.tools.build.bundletool.testing.ResourcesTableFactory.USER_PACKAGE_OFFSET) HDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.HDPI) TargetingUtils.targetedNativeDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedNativeDirectory) TestCase.fail(junit.framework.TestCase.fail) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) Test(org.junit.Test) ANDROID_L_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_L_API_VERSION) ANDROID_M_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_M_API_VERSION) TargetingUtils.assets(com.android.tools.build.bundletool.testing.TargetingUtils.assets) TargetingUtils.apkDensityTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkDensityTargeting) XmlNode(com.android.aapt.Resources.XmlNode) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) ManifestProtoUtils.withMainActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMainActivity) ModuleSplitUtils.createModuleSplitBuilder(com.android.tools.build.bundletool.testing.ModuleSplitUtils.createModuleSplitBuilder) AppBundle(com.android.tools.build.bundletool.model.AppBundle) BundleModule(com.android.tools.build.bundletool.model.BundleModule) TargetingUtils.apkDeviceTierTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkDeviceTierTargeting) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) ManifestProtoUtils.xmlAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.xmlAttribute) MoreCollectors.onlyElement(com.google.common.collect.MoreCollectors.onlyElement) ANDROID_NAMESPACE_URI(com.android.tools.build.bundletool.model.AndroidManifest.ANDROID_NAMESPACE_URI) TargetingUtils.deviceTierTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.deviceTierTargeting) TargetingUtils.targetedAssetsDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedAssetsDirectory) NAME_RESOURCE_ID(com.android.tools.build.bundletool.model.AndroidManifest.NAME_RESOURCE_ID) ResourcesTableFactory.entry(com.android.tools.build.bundletool.testing.ResourcesTableFactory.entry) TargetingUtils.languageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.languageTargeting) ImmutableSet(com.google.common.collect.ImmutableSet) ResourcesTableFactory.value(com.android.tools.build.bundletool.testing.ResourcesTableFactory.value) TargetingUtils.apkTextureTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkTextureTargeting) ImmutableMap(com.google.common.collect.ImmutableMap) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) SplitType(com.android.tools.build.bundletool.model.ModuleSplit.SplitType) Sets(com.google.common.collect.Sets) Preconditions.checkState(com.google.common.base.Preconditions.checkState) NativeLibraries(com.android.bundle.Files.NativeLibraries) List(java.util.List) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) Optional(java.util.Optional) ABI(com.android.tools.build.bundletool.model.OptimizationDimension.ABI) TargetingUtils.apkLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkLanguageTargeting) ManifestProtoUtils.withMaxSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMaxSdkVersion) TargetingUtils.apkAbiTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkAbiTargeting) BundleModuleName(com.android.tools.build.bundletool.model.BundleModuleName) TestUtils.extractPaths(com.android.tools.build.bundletool.testing.TestUtils.extractPaths) ResourcesTableFactory.resourceTable(com.android.tools.build.bundletool.testing.ResourcesTableFactory.resourceTable) TargetingUtils.toAbi(com.android.tools.build.bundletool.testing.TargetingUtils.toAbi) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) ImmutableList(com.google.common.collect.ImmutableList) ACTIVITY_ELEMENT_NAME(com.android.tools.build.bundletool.model.AndroidManifest.ACTIVITY_ELEMENT_NAME) S3TC(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.S3TC) Truth8.assertThat(com.google.common.truth.Truth8.assertThat) ManifestProtoUtils.withInstant(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstant) APPLICATION_ELEMENT_NAME(com.android.tools.build.bundletool.model.AndroidManifest.APPLICATION_ELEMENT_NAME) JUnit4(org.junit.runners.JUnit4) XHDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.XHDPI) Truth.assertThat(com.google.common.truth.Truth.assertThat) ETC1_RGB8(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ETC1_RGB8) Maps(com.google.common.collect.Maps) ResourcesTableFactory.fileReference(com.android.tools.build.bundletool.testing.ResourcesTableFactory.fileReference) TargetingUtils.nativeLibraries(com.android.tools.build.bundletool.testing.TargetingUtils.nativeLibraries) AbiAlias(com.android.bundle.Targeting.Abi.AbiAlias) Ignore(org.junit.Ignore) TargetingUtils.apkAlternativeLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkAlternativeLanguageTargeting) XmlElement(com.android.aapt.Resources.XmlElement) Versions(com.android.tools.build.bundletool.model.utils.Versions) Configuration(com.android.aapt.ConfigurationOuterClass.Configuration) NativeLibraries(com.android.bundle.Files.NativeLibraries) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 4 with ABI

use of com.android.tools.build.bundletool.model.OptimizationDimension.ABI in project bundletool by google.

the class BuildApksManagerTest method extractApkSet_outputApksWithoutArchive.

@Test
public void extractApkSet_outputApksWithoutArchive() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.addFile("assets/file.txt").addFile("dex/classes.dex").setManifest(androidManifest("com.test.app")).setResourceTable(resourceTableWithTestLabel("test_label"))).addModule("abi_feature", builder -> builder.addFile("lib/x86/libsome.so").addFile("lib/x86_64/libsome.so").setNativeConfig(nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(X86)), targetedNativeDirectory("lib/x86_64", nativeDirectoryTargeting(X86_64)))).setManifest(androidManifestForFeature("com.test.app", withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).addModule("language_feature", builder -> builder.addFile("res/drawable/image.jpg").addFile("res/drawable-cz/image.jpg").addFile("res/drawable-fr/image.jpg").addFile("res/drawable-pl/image.jpg").setResourceTable(new ResourceTableBuilder().addPackage("com.test.app", USER_PACKAGE_OFFSET - 1).addFileResourceForMultipleConfigs("drawable", "image", ImmutableMap.of(Configuration.getDefaultInstance(), "res/drawable/image.jpg", locale("cz"), "res/drawable-cz/image.jpg", locale("fr"), "res/drawable-fr/image.jpg", locale("pl"), "res/drawable-pl/image.jpg")).build()).setManifest(androidManifestForFeature("com.test.app", withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).build();
    TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputDir).withOptimizationDimensions(ABI, LANGUAGE).withCustomBuildApksCommandSetter(command -> command.setOutputFormat(DIRECTORY)).build());
    buildApksManager.execute();
    assertThat(command.getOutputFile()).isEqualTo(outputDir);
    BuildApksResult result = parseTocFromFile(outputDir.resolve("toc.pb").toFile());
    // Validate all APKs were created.
    verifyApksExist(apkDescriptions(result.getVariantList()), outputDir);
}
Also used : TEST_LABEL_RESOURCE_ID(com.android.tools.build.bundletool.testing.ResourcesTableFactory.TEST_LABEL_RESOURCE_ID) SYSTEM(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.SYSTEM) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ApkSetUtils.parseTocFromFile(com.android.tools.build.bundletool.testing.ApkSetUtils.parseTocFromFile) TargetingUtils.alternativeLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeLanguageTargeting) Bundletool(com.android.bundle.Config.Bundletool) ARM64_V8A(com.android.bundle.Targeting.Abi.AbiAlias.ARM64_V8A) AssetModulesConfig(com.android.bundle.Config.AssetModulesConfig) Map(java.util.Map) DensityAlias(com.android.bundle.Targeting.ScreenDensity.DensityAlias) TestUtils.filesUnderPath(com.android.tools.build.bundletool.testing.TestUtils.filesUnderPath) Path(java.nio.file.Path) SourceStamp(com.android.tools.build.bundletool.model.SourceStamp) ManifestProtoUtils.withTitle(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withTitle) TargetingUtils.nativeDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.nativeDirectoryTargeting) ASSETS_DIRECTORY(com.android.tools.build.bundletool.model.BundleModule.ASSETS_DIRECTORY) DIRECTORY(com.android.tools.build.bundletool.commands.BuildApksCommand.OutputFormat.DIRECTORY) DeviceFactory.sdkVersion(com.android.tools.build.bundletool.testing.DeviceFactory.sdkVersion) ApkSet(com.android.bundle.Commands.ApkSet) BundleConfig(com.android.bundle.Config.BundleConfig) TextureCompressionFormatTargeting(com.android.bundle.Targeting.TextureCompressionFormatTargeting) TargetingUtils.variantAbiTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantAbiTargeting) SystemApkOption(com.android.tools.build.bundletool.commands.BuildApksCommand.SystemApkOption) ManifestProtoUtils.androidManifestForFeature(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifestForFeature) TargetingUtils.assetsDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.assetsDirectoryTargeting) CodeTransparency(com.android.bundle.CodeTransparencyOuterClass.CodeTransparency) SystemApkMetadata(com.android.bundle.Commands.SystemApkMetadata) STAMP_SOURCE_METADATA_KEY(com.android.tools.build.bundletool.model.SourceStamp.STAMP_SOURCE_METADATA_KEY) MDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.MDPI) ApexManifest(com.android.apex.ApexManifestProto.ApexManifest) ZipPath(com.android.tools.build.bundletool.model.ZipPath) ManifestProtoUtils.withInstantOnDemandDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstantOnDemandDelivery) RunWith(org.junit.runner.RunWith) MDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.MDPI_VALUE) SdkVersion(com.android.bundle.Targeting.SdkVersion) TEXTURE_COMPRESSION_FORMAT(com.android.tools.build.bundletool.model.OptimizationDimension.TEXTURE_COMPRESSION_FORMAT) DeviceFactory.mergeSpecs(com.android.tools.build.bundletool.testing.DeviceFactory.mergeSpecs) StandaloneApkMetadata(com.android.bundle.Commands.StandaloneApkMetadata) SigningConfiguration(com.android.tools.build.bundletool.model.SigningConfiguration) Theories(org.junit.experimental.theories.Theories) ResultUtils.instantApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.instantApkVariants) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) ApkDescription(com.android.bundle.Commands.ApkDescription) Before(org.junit.Before) X86(com.android.bundle.Targeting.Abi.AbiAlias.X86) USER_PACKAGE_OFFSET(com.android.tools.build.bundletool.testing.ResourcesTableFactory.USER_PACKAGE_OFFSET) AssetSliceSet(com.android.bundle.Commands.AssetSliceSet) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) IOException(java.io.IOException) Test(org.junit.Test) Correspondence(com.google.common.truth.Correspondence) ALL_MODULES_SHORTCUT(com.android.tools.build.bundletool.commands.ExtractApksCommand.ALL_MODULES_SHORTCUT) ResultUtils.apexApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.apexApkVariants) AppBundle(com.android.tools.build.bundletool.model.AppBundle) CodeRelatedFile(com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile) X509Certificate(java.security.cert.X509Certificate) ManifestProtoUtils.withNativeActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withNativeActivity) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) Maps.transformValues(com.google.common.collect.Maps.transformValues) ManifestProtoUtils.withInstallLocation(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstallLocation) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) AssetsDirectoryTargeting(com.android.bundle.Targeting.AssetsDirectoryTargeting) TargetingUtils.languageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.languageTargeting) ManifestProtoUtils.withOnDemandDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withOnDemandDelivery) ZipFile(java.util.zip.ZipFile) ZipEntry(java.util.zip.ZipEntry) PERSISTENT(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.PERSISTENT) ImmutableSet(com.google.common.collect.ImmutableSet) Collection(java.util.Collection) KeyStore(java.security.KeyStore) InstantMetadata(com.android.bundle.Commands.InstantMetadata) Collectors(java.util.stream.Collectors) ScreenDensity(com.android.bundle.Targeting.ScreenDensity) InvalidVersionCodeException(com.android.tools.build.bundletool.model.exceptions.InvalidVersionCodeException) DefaultTargetingValue(com.android.bundle.Commands.DefaultTargetingValue) ManifestProtoUtils.withOnDemandAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withOnDemandAttribute) CertificateHelper(com.android.tools.build.bundletool.model.utils.CertificateHelper) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ApkSetUtils(com.android.tools.build.bundletool.testing.ApkSetUtils) PermanentlyFusedModule(com.android.bundle.Commands.PermanentlyFusedModule) FilePreconditions(com.android.tools.build.bundletool.model.utils.files.FilePreconditions) ManifestProtoUtils.withMaxSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMaxSdkVersion) BundleType(com.android.bundle.Config.BundleConfig.BundleType) DeviceFactory.locales(com.android.tools.build.bundletool.testing.DeviceFactory.locales) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) TargetingUtils.alternativeTextureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeTextureCompressionTargeting) TargetingUtils.variantSdkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantSdkTargeting) ResultUtils.standaloneApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.standaloneApkVariants) ApkModifier(com.android.tools.build.bundletool.model.ApkModifier) BundleConfigBuilder(com.android.tools.build.bundletool.testing.BundleConfigBuilder) Hashing(com.google.common.hash.Hashing) TargetingUtils.moduleDeviceGroupsTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.moduleDeviceGroupsTargeting) ManifestProtoUtils.withDeviceGroupsCondition(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withDeviceGroupsCondition) TargetingUtils.toAbi(com.android.tools.build.bundletool.testing.TargetingUtils.toAbi) Inject(javax.inject.Inject) ModuleMetadata(com.android.bundle.Commands.ModuleMetadata) ImmutableList(com.google.common.collect.ImmutableList) Charset(java.nio.charset.Charset) ManifestProtoUtils.withSplitNameService(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withSplitNameService) CharSource(com.google.common.io.CharSource) Truth8.assertThat(com.google.common.truth.Truth8.assertThat) LDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.LDPI) CertificateFactory(com.android.tools.build.bundletool.testing.CertificateFactory) TargetingUtils.sdkVersionFrom(com.android.tools.build.bundletool.testing.TargetingUtils.sdkVersionFrom) TestData(com.android.tools.build.bundletool.TestData) Truth.assertThat(com.google.common.truth.Truth.assertThat) FileUtils(com.android.tools.build.bundletool.testing.FileUtils) TargetingUtils.nativeLibraries(com.android.tools.build.bundletool.testing.TargetingUtils.nativeLibraries) Ignore(org.junit.Ignore) InvalidCommandException(com.android.tools.build.bundletool.model.exceptions.InvalidCommandException) ApkVerifier(com.android.apksig.ApkVerifier) Configuration(com.android.aapt.ConfigurationOuterClass.Configuration) KeyPair(java.security.KeyPair) Value(com.android.bundle.Config.SplitDimension.Value) UNIVERSAL(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.UNIVERSAL) ResourcesTableFactory.locale(com.android.tools.build.bundletool.testing.ResourcesTableFactory.locale) TargetingUtils.textureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionTargeting) DeviceFactory.abis(com.android.tools.build.bundletool.testing.DeviceFactory.abis) TargetingUtils.variantMultiAbiTargetingFromAllTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantMultiAbiTargetingFromAllTargeting) DeliveryType(com.android.bundle.Commands.DeliveryType) ManifestProtoUtils.withUsesSplit(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withUsesSplit) ResourcesTableFactory.resourceTableWithTestLabel(com.android.tools.build.bundletool.testing.ResourcesTableFactory.resourceTableWithTestLabel) Version(com.android.tools.build.bundletool.model.version.Version) TruthZip(com.android.tools.build.bundletool.testing.truth.zip.TruthZip) Theory(org.junit.experimental.theories.Theory) KeyPairGenerator(java.security.KeyPairGenerator) ImmutableMultiset.toImmutableMultiset(com.google.common.collect.ImmutableMultiset.toImmutableMultiset) BundleToolVersion(com.android.tools.build.bundletool.model.version.BundleToolVersion) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Set(java.util.Set) ARMEABI_V7A(com.android.bundle.Targeting.Abi.AbiAlias.ARMEABI_V7A) LanguageTargeting(com.android.bundle.Targeting.LanguageTargeting) ManifestProtoUtils.withInstallTimeRemovableElement(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstallTimeRemovableElement) Executors(java.util.concurrent.Executors) ManifestProtoUtils.withMinSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMinSdkVersion) ApexImages(com.android.bundle.Files.ApexImages) TargetingUtils.apexImageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apexImageTargeting) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) DeviceFactory.density(com.android.tools.build.bundletool.testing.DeviceFactory.density) TextureCompressionFormat(com.android.bundle.Targeting.TextureCompressionFormat) PrivateKey(java.security.PrivateKey) ByteStreams(com.google.common.io.ByteStreams) ManifestProtoUtils.withInstallTimeDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstallTimeDelivery) ResultUtils.systemApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.systemApkVariants) DEVELOPMENT_SDK_VERSION(com.android.tools.build.bundletool.model.AndroidManifest.DEVELOPMENT_SDK_VERSION) TargetingUtils.targetedApexImage(com.android.tools.build.bundletool.testing.TargetingUtils.targetedApexImage) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) TruthZip.assertThat(com.android.tools.build.bundletool.testing.truth.zip.TruthZip.assertThat) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Iterables(com.google.common.collect.Iterables) Optimizations(com.android.bundle.Config.Optimizations) ATC(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ATC) TargetingUtils.textureCompressionFormat(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionFormat) Component(dagger.Component) LANGUAGE(com.android.tools.build.bundletool.model.OptimizationDimension.LANGUAGE) ApkSetUtils.extractTocFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractTocFromApkSetFile) Closer(com.google.common.io.Closer) ImmutableMultiset(com.google.common.collect.ImmutableMultiset) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ResultUtils.splitApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.splitApkVariants) SplitApkMetadata(com.android.bundle.Commands.SplitApkMetadata) ANDROID_P_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_P_API_VERSION) ByteSource(com.google.common.io.ByteSource) CodeTransparencyTestUtils.createJwsToken(com.android.tools.build.bundletool.testing.CodeTransparencyTestUtils.createJwsToken) ANDROID_Q_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_Q_API_VERSION) VariantTargeting(com.android.bundle.Targeting.VariantTargeting) AdbServer(com.android.tools.build.bundletool.device.AdbServer) StandaloneConfig(com.android.bundle.Config.StandaloneConfig) Int32Value(com.google.protobuf.Int32Value) DeviceFactory.deviceTier(com.android.tools.build.bundletool.testing.DeviceFactory.deviceTier) Files(java.nio.file.Files) ANDROID_N_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_N_API_VERSION) TargetingUtils.targetedNativeDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedNativeDirectory) TestCase.fail(junit.framework.TestCase.fail) FileOutputStream(java.io.FileOutputStream) X86_64(com.android.bundle.Targeting.Abi.AbiAlias.X86_64) BundleMetadata(com.android.tools.build.bundletool.model.BundleMetadata) ANDROID_M_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_M_API_VERSION) TargetingUtils.assets(com.android.tools.build.bundletool.testing.TargetingUtils.assets) File(java.io.File) ApkSetUtils.extractFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractFromApkSetFile) ResultUtils.archivedApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.archivedApkVariants) Paths(java.nio.file.Paths) FakeAdbServer(com.android.tools.build.bundletool.testing.FakeAdbServer) Abi(com.android.bundle.Targeting.Abi) TargetingUtils.sdkVersionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.sdkVersionTargeting) ManifestProtoUtils.withAppIcon(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withAppIcon) Variant(com.android.bundle.Commands.Variant) TestUtils.extractAndroidManifest(com.android.tools.build.bundletool.testing.TestUtils.extractAndroidManifest) MoreCollectors.onlyElement(com.google.common.collect.MoreCollectors.onlyElement) ManifestProtoUtils.androidManifestForAssetModule(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifestForAssetModule) TargetingUtils.mergeVariantTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeVariantTargeting) ManifestProtoUtils.withDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withDelivery) TargetingUtils.deviceTierTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.deviceTierTargeting) TargetingUtils.targetedAssetsDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedAssetsDirectory) After(org.junit.After) ManifestProtoUtils.withTargetSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withTargetSdkVersion) ImmutableMap(com.google.common.collect.ImmutableMap) FromDataPoints(org.junit.experimental.theories.FromDataPoints) List(java.util.List) Certificate(java.security.cert.Certificate) INSTANT(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.INSTANT) DataPoints(org.junit.experimental.theories.DataPoints) ABI(com.android.tools.build.bundletool.model.OptimizationDimension.ABI) ManifestProtoUtils.withCustomThemeActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withCustomThemeActivity) TargetingUtils.apkLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkLanguageTargeting) TestModule(com.android.tools.build.bundletool.testing.TestModule) BeforeClass(org.junit.BeforeClass) TargetingUtils.apexImages(com.android.tools.build.bundletool.testing.TargetingUtils.apexImages) BuildApksResult(com.android.bundle.Commands.BuildApksResult) DeviceTierTargeting(com.android.bundle.Targeting.DeviceTierTargeting) SdkVersionTargeting(com.android.bundle.Targeting.SdkVersionTargeting) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) MIPS(com.android.bundle.Targeting.Abi.AbiAlias.MIPS) ManifestProtoUtils.withInstant(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstant) ARCHIVE(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.ARCHIVE) Assert.assertNotNull(org.junit.Assert.assertNotNull) InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) ManifestProtoUtils.withFusingAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withFusingAttribute) TargetingUtils.apkMultiAbiTargetingFromAllTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkMultiAbiTargetingFromAllTargeting) ETC1_RGB8(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ETC1_RGB8) AssetModulesInfo(com.android.bundle.Commands.AssetModulesInfo) Maps(com.google.common.collect.Maps) AbiAlias(com.android.bundle.Targeting.Abi.AbiAlias) Rule(org.junit.Rule) Collections(java.util.Collections) TemporaryFolder(org.junit.rules.TemporaryFolder) AppBundle(com.android.tools.build.bundletool.model.AppBundle) BuildApksResult(com.android.bundle.Commands.BuildApksResult) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) Test(org.junit.Test)

Example 5 with ABI

use of com.android.tools.build.bundletool.model.OptimizationDimension.ABI in project bundletool by google.

the class BuildApksManagerTest method buildApksCommand_standalone_oneModuleManyVariants.

@Test
public void buildApksCommand_standalone_oneModuleManyVariants() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.addFile("dex/classes.dex").addFile("lib/x86/libsome.so").addFile("lib/x86_64/libsome.so").addFile("lib/mips/libsome.so").setNativeConfig(nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(X86)), targetedNativeDirectory("lib/x86_64", nativeDirectoryTargeting(X86_64)), targetedNativeDirectory("lib/mips", nativeDirectoryTargeting(MIPS)))).setManifest(androidManifest("com.test.app"))).build();
    TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputFilePath).withOptimizationDimensions(ABI).build());
    buildApksManager.execute();
    ZipFile apkSetFile = openZipFile(outputFilePath.toFile());
    BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir);
    ImmutableMap<Abi, Variant> standaloneVariantsByAbi = Maps.uniqueIndex(standaloneApkVariants(result), variant -> {
        ApkDescription apkDescription = getOnlyElement(apkDescriptions(variant));
        return getOnlyElement(apkDescription.getTargeting().getAbiTargeting().getValueList());
    });
    assertThat(standaloneVariantsByAbi.keySet()).containsExactly(toAbi(X86), toAbi(X86_64), toAbi(MIPS));
    assertThat(standaloneVariantsByAbi.get(toAbi(X86)).getTargeting()).ignoringRepeatedFieldOrder().isEqualTo(mergeVariantTargeting(variantAbiTargeting(X86, ImmutableSet.of(X86_64, MIPS)), variantSdkTargeting(LOWEST_SDK_VERSION, ImmutableSet.of(L_SDK_VERSION, M_SDK_VERSION))));
    assertThat(standaloneVariantsByAbi.get(toAbi(X86_64)).getTargeting()).ignoringRepeatedFieldOrder().isEqualTo(mergeVariantTargeting(variantAbiTargeting(X86_64, ImmutableSet.of(X86, MIPS)), variantSdkTargeting(LOWEST_SDK_VERSION, ImmutableSet.of(L_SDK_VERSION, M_SDK_VERSION))));
    assertThat(standaloneVariantsByAbi.get(toAbi(MIPS)).getTargeting()).ignoringRepeatedFieldOrder().isEqualTo(mergeVariantTargeting(variantAbiTargeting(MIPS, ImmutableSet.of(X86, X86_64)), variantSdkTargeting(LOWEST_SDK_VERSION, ImmutableSet.of(L_SDK_VERSION, M_SDK_VERSION))));
    for (Variant variant : standaloneVariantsByAbi.values()) {
        assertThat(variant.getApkSetList()).hasSize(1);
        ApkSet apkSet = variant.getApkSet(0);
        assertThat(apkSet.getApkDescriptionList()).hasSize(1);
        assertThat(apkSetFile).hasFile(apkSet.getApkDescription(0).getPath());
    }
}
Also used : TEST_LABEL_RESOURCE_ID(com.android.tools.build.bundletool.testing.ResourcesTableFactory.TEST_LABEL_RESOURCE_ID) SYSTEM(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.SYSTEM) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ApkSetUtils.parseTocFromFile(com.android.tools.build.bundletool.testing.ApkSetUtils.parseTocFromFile) TargetingUtils.alternativeLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeLanguageTargeting) Bundletool(com.android.bundle.Config.Bundletool) ARM64_V8A(com.android.bundle.Targeting.Abi.AbiAlias.ARM64_V8A) AssetModulesConfig(com.android.bundle.Config.AssetModulesConfig) Map(java.util.Map) DensityAlias(com.android.bundle.Targeting.ScreenDensity.DensityAlias) TestUtils.filesUnderPath(com.android.tools.build.bundletool.testing.TestUtils.filesUnderPath) Path(java.nio.file.Path) SourceStamp(com.android.tools.build.bundletool.model.SourceStamp) ManifestProtoUtils.withTitle(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withTitle) TargetingUtils.nativeDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.nativeDirectoryTargeting) ASSETS_DIRECTORY(com.android.tools.build.bundletool.model.BundleModule.ASSETS_DIRECTORY) DIRECTORY(com.android.tools.build.bundletool.commands.BuildApksCommand.OutputFormat.DIRECTORY) DeviceFactory.sdkVersion(com.android.tools.build.bundletool.testing.DeviceFactory.sdkVersion) ApkSet(com.android.bundle.Commands.ApkSet) BundleConfig(com.android.bundle.Config.BundleConfig) TextureCompressionFormatTargeting(com.android.bundle.Targeting.TextureCompressionFormatTargeting) TargetingUtils.variantAbiTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantAbiTargeting) SystemApkOption(com.android.tools.build.bundletool.commands.BuildApksCommand.SystemApkOption) ManifestProtoUtils.androidManifestForFeature(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifestForFeature) TargetingUtils.assetsDirectoryTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.assetsDirectoryTargeting) CodeTransparency(com.android.bundle.CodeTransparencyOuterClass.CodeTransparency) SystemApkMetadata(com.android.bundle.Commands.SystemApkMetadata) STAMP_SOURCE_METADATA_KEY(com.android.tools.build.bundletool.model.SourceStamp.STAMP_SOURCE_METADATA_KEY) MDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.MDPI) ApexManifest(com.android.apex.ApexManifestProto.ApexManifest) ZipPath(com.android.tools.build.bundletool.model.ZipPath) ManifestProtoUtils.withInstantOnDemandDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstantOnDemandDelivery) RunWith(org.junit.runner.RunWith) MDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.MDPI_VALUE) SdkVersion(com.android.bundle.Targeting.SdkVersion) TEXTURE_COMPRESSION_FORMAT(com.android.tools.build.bundletool.model.OptimizationDimension.TEXTURE_COMPRESSION_FORMAT) DeviceFactory.mergeSpecs(com.android.tools.build.bundletool.testing.DeviceFactory.mergeSpecs) StandaloneApkMetadata(com.android.bundle.Commands.StandaloneApkMetadata) SigningConfiguration(com.android.tools.build.bundletool.model.SigningConfiguration) Theories(org.junit.experimental.theories.Theories) ResultUtils.instantApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.instantApkVariants) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) ApkDescription(com.android.bundle.Commands.ApkDescription) Before(org.junit.Before) X86(com.android.bundle.Targeting.Abi.AbiAlias.X86) USER_PACKAGE_OFFSET(com.android.tools.build.bundletool.testing.ResourcesTableFactory.USER_PACKAGE_OFFSET) AssetSliceSet(com.android.bundle.Commands.AssetSliceSet) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) IOException(java.io.IOException) Test(org.junit.Test) Correspondence(com.google.common.truth.Correspondence) ALL_MODULES_SHORTCUT(com.android.tools.build.bundletool.commands.ExtractApksCommand.ALL_MODULES_SHORTCUT) ResultUtils.apexApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.apexApkVariants) AppBundle(com.android.tools.build.bundletool.model.AppBundle) CodeRelatedFile(com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile) X509Certificate(java.security.cert.X509Certificate) ManifestProtoUtils.withNativeActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withNativeActivity) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) Maps.transformValues(com.google.common.collect.Maps.transformValues) ManifestProtoUtils.withInstallLocation(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstallLocation) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) AssetsDirectoryTargeting(com.android.bundle.Targeting.AssetsDirectoryTargeting) TargetingUtils.languageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.languageTargeting) ManifestProtoUtils.withOnDemandDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withOnDemandDelivery) ZipFile(java.util.zip.ZipFile) ZipEntry(java.util.zip.ZipEntry) PERSISTENT(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.PERSISTENT) ImmutableSet(com.google.common.collect.ImmutableSet) Collection(java.util.Collection) KeyStore(java.security.KeyStore) InstantMetadata(com.android.bundle.Commands.InstantMetadata) Collectors(java.util.stream.Collectors) ScreenDensity(com.android.bundle.Targeting.ScreenDensity) InvalidVersionCodeException(com.android.tools.build.bundletool.model.exceptions.InvalidVersionCodeException) DefaultTargetingValue(com.android.bundle.Commands.DefaultTargetingValue) ManifestProtoUtils.withOnDemandAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withOnDemandAttribute) CertificateHelper(com.android.tools.build.bundletool.model.utils.CertificateHelper) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) ApkSetUtils(com.android.tools.build.bundletool.testing.ApkSetUtils) PermanentlyFusedModule(com.android.bundle.Commands.PermanentlyFusedModule) FilePreconditions(com.android.tools.build.bundletool.model.utils.files.FilePreconditions) ManifestProtoUtils.withMaxSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMaxSdkVersion) BundleType(com.android.bundle.Config.BundleConfig.BundleType) DeviceFactory.locales(com.android.tools.build.bundletool.testing.DeviceFactory.locales) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) TargetingUtils.alternativeTextureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeTextureCompressionTargeting) TargetingUtils.variantSdkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantSdkTargeting) ResultUtils.standaloneApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.standaloneApkVariants) ApkModifier(com.android.tools.build.bundletool.model.ApkModifier) BundleConfigBuilder(com.android.tools.build.bundletool.testing.BundleConfigBuilder) Hashing(com.google.common.hash.Hashing) TargetingUtils.moduleDeviceGroupsTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.moduleDeviceGroupsTargeting) ManifestProtoUtils.withDeviceGroupsCondition(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withDeviceGroupsCondition) TargetingUtils.toAbi(com.android.tools.build.bundletool.testing.TargetingUtils.toAbi) Inject(javax.inject.Inject) ModuleMetadata(com.android.bundle.Commands.ModuleMetadata) ImmutableList(com.google.common.collect.ImmutableList) Charset(java.nio.charset.Charset) ManifestProtoUtils.withSplitNameService(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withSplitNameService) CharSource(com.google.common.io.CharSource) Truth8.assertThat(com.google.common.truth.Truth8.assertThat) LDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.LDPI) CertificateFactory(com.android.tools.build.bundletool.testing.CertificateFactory) TargetingUtils.sdkVersionFrom(com.android.tools.build.bundletool.testing.TargetingUtils.sdkVersionFrom) TestData(com.android.tools.build.bundletool.TestData) Truth.assertThat(com.google.common.truth.Truth.assertThat) FileUtils(com.android.tools.build.bundletool.testing.FileUtils) TargetingUtils.nativeLibraries(com.android.tools.build.bundletool.testing.TargetingUtils.nativeLibraries) Ignore(org.junit.Ignore) InvalidCommandException(com.android.tools.build.bundletool.model.exceptions.InvalidCommandException) ApkVerifier(com.android.apksig.ApkVerifier) Configuration(com.android.aapt.ConfigurationOuterClass.Configuration) KeyPair(java.security.KeyPair) Value(com.android.bundle.Config.SplitDimension.Value) UNIVERSAL(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.UNIVERSAL) ResourcesTableFactory.locale(com.android.tools.build.bundletool.testing.ResourcesTableFactory.locale) TargetingUtils.textureCompressionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionTargeting) DeviceFactory.abis(com.android.tools.build.bundletool.testing.DeviceFactory.abis) TargetingUtils.variantMultiAbiTargetingFromAllTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.variantMultiAbiTargetingFromAllTargeting) DeliveryType(com.android.bundle.Commands.DeliveryType) ManifestProtoUtils.withUsesSplit(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withUsesSplit) ResourcesTableFactory.resourceTableWithTestLabel(com.android.tools.build.bundletool.testing.ResourcesTableFactory.resourceTableWithTestLabel) Version(com.android.tools.build.bundletool.model.version.Version) TruthZip(com.android.tools.build.bundletool.testing.truth.zip.TruthZip) Theory(org.junit.experimental.theories.Theory) KeyPairGenerator(java.security.KeyPairGenerator) ImmutableMultiset.toImmutableMultiset(com.google.common.collect.ImmutableMultiset.toImmutableMultiset) BundleToolVersion(com.android.tools.build.bundletool.model.version.BundleToolVersion) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Set(java.util.Set) ARMEABI_V7A(com.android.bundle.Targeting.Abi.AbiAlias.ARMEABI_V7A) LanguageTargeting(com.android.bundle.Targeting.LanguageTargeting) ManifestProtoUtils.withInstallTimeRemovableElement(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstallTimeRemovableElement) Executors(java.util.concurrent.Executors) ManifestProtoUtils.withMinSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withMinSdkVersion) ApexImages(com.android.bundle.Files.ApexImages) TargetingUtils.apexImageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apexImageTargeting) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) DeviceFactory.density(com.android.tools.build.bundletool.testing.DeviceFactory.density) TextureCompressionFormat(com.android.bundle.Targeting.TextureCompressionFormat) PrivateKey(java.security.PrivateKey) ByteStreams(com.google.common.io.ByteStreams) ManifestProtoUtils.withInstallTimeDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstallTimeDelivery) ResultUtils.systemApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.systemApkVariants) DEVELOPMENT_SDK_VERSION(com.android.tools.build.bundletool.model.AndroidManifest.DEVELOPMENT_SDK_VERSION) TargetingUtils.targetedApexImage(com.android.tools.build.bundletool.testing.TargetingUtils.targetedApexImage) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) TruthZip.assertThat(com.android.tools.build.bundletool.testing.truth.zip.TruthZip.assertThat) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Iterables(com.google.common.collect.Iterables) Optimizations(com.android.bundle.Config.Optimizations) ATC(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ATC) TargetingUtils.textureCompressionFormat(com.android.tools.build.bundletool.testing.TargetingUtils.textureCompressionFormat) Component(dagger.Component) LANGUAGE(com.android.tools.build.bundletool.model.OptimizationDimension.LANGUAGE) ApkSetUtils.extractTocFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractTocFromApkSetFile) Closer(com.google.common.io.Closer) ImmutableMultiset(com.google.common.collect.ImmutableMultiset) AppBundleSerializer(com.android.tools.build.bundletool.io.AppBundleSerializer) ResultUtils.splitApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.splitApkVariants) SplitApkMetadata(com.android.bundle.Commands.SplitApkMetadata) ANDROID_P_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_P_API_VERSION) ByteSource(com.google.common.io.ByteSource) CodeTransparencyTestUtils.createJwsToken(com.android.tools.build.bundletool.testing.CodeTransparencyTestUtils.createJwsToken) ANDROID_Q_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_Q_API_VERSION) VariantTargeting(com.android.bundle.Targeting.VariantTargeting) AdbServer(com.android.tools.build.bundletool.device.AdbServer) StandaloneConfig(com.android.bundle.Config.StandaloneConfig) Int32Value(com.google.protobuf.Int32Value) DeviceFactory.deviceTier(com.android.tools.build.bundletool.testing.DeviceFactory.deviceTier) Files(java.nio.file.Files) ANDROID_N_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_N_API_VERSION) TargetingUtils.targetedNativeDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedNativeDirectory) TestCase.fail(junit.framework.TestCase.fail) FileOutputStream(java.io.FileOutputStream) X86_64(com.android.bundle.Targeting.Abi.AbiAlias.X86_64) BundleMetadata(com.android.tools.build.bundletool.model.BundleMetadata) ANDROID_M_API_VERSION(com.android.tools.build.bundletool.model.utils.Versions.ANDROID_M_API_VERSION) TargetingUtils.assets(com.android.tools.build.bundletool.testing.TargetingUtils.assets) File(java.io.File) ApkSetUtils.extractFromApkSetFile(com.android.tools.build.bundletool.testing.ApkSetUtils.extractFromApkSetFile) ResultUtils.archivedApkVariants(com.android.tools.build.bundletool.model.utils.ResultUtils.archivedApkVariants) Paths(java.nio.file.Paths) FakeAdbServer(com.android.tools.build.bundletool.testing.FakeAdbServer) Abi(com.android.bundle.Targeting.Abi) TargetingUtils.sdkVersionTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.sdkVersionTargeting) ManifestProtoUtils.withAppIcon(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withAppIcon) Variant(com.android.bundle.Commands.Variant) TestUtils.extractAndroidManifest(com.android.tools.build.bundletool.testing.TestUtils.extractAndroidManifest) MoreCollectors.onlyElement(com.google.common.collect.MoreCollectors.onlyElement) ManifestProtoUtils.androidManifestForAssetModule(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifestForAssetModule) TargetingUtils.mergeVariantTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeVariantTargeting) ManifestProtoUtils.withDelivery(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withDelivery) TargetingUtils.deviceTierTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.deviceTierTargeting) TargetingUtils.targetedAssetsDirectory(com.android.tools.build.bundletool.testing.TargetingUtils.targetedAssetsDirectory) After(org.junit.After) ManifestProtoUtils.withTargetSdkVersion(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withTargetSdkVersion) ImmutableMap(com.google.common.collect.ImmutableMap) FromDataPoints(org.junit.experimental.theories.FromDataPoints) List(java.util.List) Certificate(java.security.cert.Certificate) INSTANT(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.INSTANT) DataPoints(org.junit.experimental.theories.DataPoints) ABI(com.android.tools.build.bundletool.model.OptimizationDimension.ABI) ManifestProtoUtils.withCustomThemeActivity(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withCustomThemeActivity) TargetingUtils.apkLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkLanguageTargeting) TestModule(com.android.tools.build.bundletool.testing.TestModule) BeforeClass(org.junit.BeforeClass) TargetingUtils.apexImages(com.android.tools.build.bundletool.testing.TargetingUtils.apexImages) BuildApksResult(com.android.bundle.Commands.BuildApksResult) DeviceTierTargeting(com.android.bundle.Targeting.DeviceTierTargeting) SdkVersionTargeting(com.android.bundle.Targeting.SdkVersionTargeting) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) MIPS(com.android.bundle.Targeting.Abi.AbiAlias.MIPS) ManifestProtoUtils.withInstant(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withInstant) ARCHIVE(com.android.tools.build.bundletool.commands.BuildApksCommand.ApkBuildMode.ARCHIVE) Assert.assertNotNull(org.junit.Assert.assertNotNull) InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) ManifestProtoUtils.withFusingAttribute(com.android.tools.build.bundletool.testing.ManifestProtoUtils.withFusingAttribute) TargetingUtils.apkMultiAbiTargetingFromAllTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkMultiAbiTargetingFromAllTargeting) ETC1_RGB8(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias.ETC1_RGB8) AssetModulesInfo(com.android.bundle.Commands.AssetModulesInfo) Maps(com.google.common.collect.Maps) AbiAlias(com.android.bundle.Targeting.Abi.AbiAlias) Rule(org.junit.Rule) Collections(java.util.Collections) TemporaryFolder(org.junit.rules.TemporaryFolder) Variant(com.android.bundle.Commands.Variant) ApkSet(com.android.bundle.Commands.ApkSet) AppBundle(com.android.tools.build.bundletool.model.AppBundle) ApkDescription(com.android.bundle.Commands.ApkDescription) ZipFile(java.util.zip.ZipFile) BuildApksResult(com.android.bundle.Commands.BuildApksResult) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) TargetingUtils.toAbi(com.android.tools.build.bundletool.testing.TargetingUtils.toAbi) Abi(com.android.bundle.Targeting.Abi) Test(org.junit.Test)

Aggregations

Configuration (com.android.aapt.ConfigurationOuterClass.Configuration)9 AbiAlias (com.android.bundle.Targeting.Abi.AbiAlias)9 ApkTargeting (com.android.bundle.Targeting.ApkTargeting)9 DensityAlias (com.android.bundle.Targeting.ScreenDensity.DensityAlias)9 ApexManifest (com.android.apex.ApexManifestProto.ApexManifest)5 ApkVerifier (com.android.apksig.ApkVerifier)5 CodeRelatedFile (com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile)5 CodeTransparency (com.android.bundle.CodeTransparencyOuterClass.CodeTransparency)5 ApkDescription (com.android.bundle.Commands.ApkDescription)5 ApkSet (com.android.bundle.Commands.ApkSet)5 AssetModulesInfo (com.android.bundle.Commands.AssetModulesInfo)5 AssetSliceSet (com.android.bundle.Commands.AssetSliceSet)5 BuildApksResult (com.android.bundle.Commands.BuildApksResult)5 DefaultTargetingValue (com.android.bundle.Commands.DefaultTargetingValue)5 DeliveryType (com.android.bundle.Commands.DeliveryType)5 InstantMetadata (com.android.bundle.Commands.InstantMetadata)5 ModuleMetadata (com.android.bundle.Commands.ModuleMetadata)5 PermanentlyFusedModule (com.android.bundle.Commands.PermanentlyFusedModule)5 SplitApkMetadata (com.android.bundle.Commands.SplitApkMetadata)5 StandaloneApkMetadata (com.android.bundle.Commands.StandaloneApkMetadata)5