Search in sources :

Example 1 with SdkVersion

use of com.android.bundle.Targeting.SdkVersion in project bundletool by google.

the class BuildApksManagerTest method deviceTieredAssets_withDeviceSpec_deviceTierNotSet_defaultIsUsed.

@Test
public void deviceTieredAssets_withDeviceSpec_deviceTierNotSet_defaultIsUsed() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.addFile("assets/images#tier_0/image.jpg").addFile("assets/images#tier_1/image.jpg").setManifest(androidManifest("com.test.app")).setAssetsConfig(assets(targetedAssetsDirectory("assets/images#tier_0", assetsDirectoryTargeting(deviceTierTargeting(/* value= */
    0, /* alternatives= */
    ImmutableList.of(1)))), targetedAssetsDirectory("assets/images#tier_1", assetsDirectoryTargeting(deviceTierTargeting(/* value= */
    1, /* alternatives= */
    ImmutableList.of(0))))))).setBundleConfig(BundleConfigBuilder.create().addSplitDimension(Value.DEVICE_TIER, /* negate= */
    false, /* stripSuffix= */
    false, /* defaultSuffix= */
    "0").build()).build();
    TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputFilePath).withDeviceSpec(mergeSpecs(sdkVersion(29), abis("x86"), density(DensityAlias.MDPI), locales("en-US"))).build());
    buildApksManager.execute();
    ZipFile apkSetFile = openZipFile(outputFilePath.toFile());
    BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir);
    ImmutableList<Variant> splitApkVariants = splitApkVariants(result);
    ImmutableList<ApkDescription> splitApks = apkDescriptions(splitApkVariants);
    // Check that only an APK for tier 0 has been created, not for 1
    ImmutableList<ApkDescription> deviceTierSplits = splitApks.stream().filter(apkDesc -> apkDesc.getTargeting().hasDeviceTierTargeting()).collect(toImmutableList());
    assertThat(apkNamesInApkDescriptions(deviceTierSplits)).containsExactly("base-tier_0.apk");
    // Check the content of the APK
    ImmutableMap<DeviceTierTargeting, ApkDescription> deviceTierSplitsByTargeting = Maps.uniqueIndex(deviceTierSplits, apk -> apk.getTargeting().getDeviceTierTargeting());
    ApkDescription lowTierSplit = deviceTierSplitsByTargeting.get(deviceTierTargeting(/* value= */
    0, /* alternatives= */
    ImmutableList.of(1)));
    assertThat(filesInApk(lowTierSplit, apkSetFile)).contains("assets/images#tier_0/image.jpg");
}
Also used : Variant(com.android.bundle.Commands.Variant) 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) DeviceTierTargeting(com.android.bundle.Targeting.DeviceTierTargeting) ZipFile(java.util.zip.ZipFile) BuildApksResult(com.android.bundle.Commands.BuildApksResult) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Test(org.junit.Test)

Example 2 with SdkVersion

use of com.android.bundle.Targeting.SdkVersion in project bundletool by google.

the class BuildApksManagerTest method deviceTieredAssets_withDeviceSpec_deviceTierSet.

@Test
public void deviceTieredAssets_withDeviceSpec_deviceTierSet() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.addFile("assets/images#tier_0/image.jpg").addFile("assets/images#tier_1/image.jpg").setManifest(androidManifest("com.test.app")).setAssetsConfig(assets(targetedAssetsDirectory("assets/images#tier_0", assetsDirectoryTargeting(deviceTierTargeting(/* value= */
    0, /* alternatives= */
    ImmutableList.of(1)))), targetedAssetsDirectory("assets/images#tier_1", assetsDirectoryTargeting(deviceTierTargeting(/* value= */
    1, /* alternatives= */
    ImmutableList.of(0))))))).setBundleConfig(BundleConfigBuilder.create().addSplitDimension(Value.DEVICE_TIER, /* negate= */
    false, /* stripSuffix= */
    false, /* defaultSuffix= */
    "0").build()).build();
    TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputFilePath).withDeviceSpec(mergeSpecs(sdkVersion(29), abis("x86"), density(DensityAlias.MDPI), locales("en-US"), deviceTier(1))).build());
    buildApksManager.execute();
    ZipFile apkSetFile = openZipFile(outputFilePath.toFile());
    BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir);
    ImmutableList<Variant> splitApkVariants = splitApkVariants(result);
    ImmutableList<ApkDescription> splitApks = apkDescriptions(splitApkVariants);
    // Check that only an APK for tier 1 has been created, not for 0
    ImmutableList<ApkDescription> deviceTierSplits = splitApks.stream().filter(apkDesc -> apkDesc.getTargeting().hasDeviceTierTargeting()).collect(toImmutableList());
    assertThat(apkNamesInApkDescriptions(deviceTierSplits)).containsExactly("base-tier_1.apk");
    // Check the content of the APK
    ImmutableMap<DeviceTierTargeting, ApkDescription> deviceTierSplitsByTargeting = Maps.uniqueIndex(deviceTierSplits, apk -> apk.getTargeting().getDeviceTierTargeting());
    ApkDescription mediumTierSplit = deviceTierSplitsByTargeting.get(deviceTierTargeting(/* value= */
    1, /* alternatives= */
    ImmutableList.of(0)));
    assertThat(filesInApk(mediumTierSplit, apkSetFile)).contains("assets/images#tier_1/image.jpg");
}
Also used : Variant(com.android.bundle.Commands.Variant) 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) DeviceTierTargeting(com.android.bundle.Targeting.DeviceTierTargeting) ZipFile(java.util.zip.ZipFile) BuildApksResult(com.android.bundle.Commands.BuildApksResult) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Test(org.junit.Test)

Example 3 with SdkVersion

use of com.android.bundle.Targeting.SdkVersion in project bundletool by google.

the class BuildApksManagerTest method multipleModulesFusedAndNotFused_systemApks_hasCorrectAdditionalLanguageSplits.

@Test
@Theory
public void multipleModulesFusedAndNotFused_systemApks_hasCorrectAdditionalLanguageSplits() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", module -> module.addFile("assets/base.txt").setManifest(androidManifest("com.app")).setResourceTable(resourceTableWithTestLabel("Test feature"))).addModule("fused", module -> module.addFile("assets/fused.txt").addFile("assets/fused/languages#lang_es/image.jpg").addFile("assets/fused/languages#lang_fr/image.jpg").setAssetsConfig(assets(targetedAssetsDirectory("assets/fused/languages#lang_es", assetsDirectoryTargeting(languageTargeting("es"))), targetedAssetsDirectory("assets/fused/languages#lang_fr", assetsDirectoryTargeting(languageTargeting("fr"))))).setManifest(androidManifestForFeature("com.app", withFusingAttribute(true), withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).addModule("notfused", module -> module.addFile("assets/notfused.txt").addFile("assets/notfused/languages#lang_it/image.jpg").setAssetsConfig(assets(targetedAssetsDirectory("assets/notfused/languages#lang_it", assetsDirectoryTargeting(languageTargeting("it"))))).setManifest(androidManifestForFeature("com.app", withFusingAttribute(false), withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).build();
    TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputFilePath).withApkBuildMode(SYSTEM).withDeviceSpec(mergeSpecs(sdkVersion(28), abis("x86"), density(DensityAlias.MDPI), locales("es"))).build());
    buildApksManager.execute();
    ZipFile apkSetFile = openZipFile(outputFilePath.toFile());
    BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir);
    assertThat(systemApkVariants(result)).hasSize(1);
    Variant systemVariant = result.getVariant(0);
    assertThat(systemVariant.getVariantNumber()).isEqualTo(0);
    assertThat(systemVariant.getApkSetList()).hasSize(2);
    ImmutableMap<String, ApkSet> apkSetByModule = Maps.uniqueIndex(systemVariant.getApkSetList(), apkSet -> apkSet.getModuleMetadata().getName());
    assertThat(apkSetByModule.keySet()).containsExactly("base", "notfused");
    ApkSet baseApkSet = apkSetByModule.get("base");
    assertThat(baseApkSet.getApkDescriptionList()).hasSize(2);
    assertThat(baseApkSet.getApkDescriptionList().stream().map(ApkDescription::getPath).collect(toImmutableSet())).containsExactly("system/system.apk", "splits/base-fr.apk");
    baseApkSet.getApkDescriptionList().forEach(apkDescription -> assertThat(apkSetFile).hasFile(apkDescription.getPath()));
    ApkSet nonFusedApkSet = apkSetByModule.get("notfused");
    assertThat(nonFusedApkSet.getApkDescriptionList()).hasSize(2);
    assertThat(nonFusedApkSet.getApkDescriptionList().stream().map(ApkDescription::getPath).collect(toImmutableSet())).containsExactly("splits/notfused-master.apk", "splits/notfused-it.apk");
    nonFusedApkSet.getApkDescriptionList().forEach(apkDescription -> assertThat(apkSetFile).hasFile(apkDescription.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) ZipFile(java.util.zip.ZipFile) BuildApksResult(com.android.bundle.Commands.BuildApksResult) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Test(org.junit.Test) Theory(org.junit.experimental.theories.Theory)

Example 4 with SdkVersion

use of com.android.bundle.Targeting.SdkVersion in project bundletool by google.

the class BuildApksManagerTest method buildApksCommand_system_withLanguageTargeting.

@Test
@Theory
public void buildApksCommand_system_withLanguageTargeting() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.addFile("lib/x86/libsome.so").addFile("lib/x86_64/libsome.so").addFile("lib/mips/libsome.so").addFile("assets/languages#lang_es/image.jpg").addFile("assets/languages#lang_fr/image.jpg").addFile("assets/languages#lang_it/image.jpg").setResourceTable(new ResourceTableBuilder().addPackage("com.test.app").addStringResource("title", "Not fused").build()).setAssetsConfig(assets(targetedAssetsDirectory("assets/languages#lang_it", assetsDirectoryTargeting(languageTargeting("it"))), targetedAssetsDirectory("assets/languages#lang_es", assetsDirectoryTargeting(languageTargeting("es"))), targetedAssetsDirectory("assets/languages#lang_fr", assetsDirectoryTargeting(languageTargeting("fr"))))).setNativeConfig(nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(X86)), targetedNativeDirectory("lib/x86_64", nativeDirectoryTargeting(X86_64)), targetedNativeDirectory("lib/mips", nativeDirectoryTargeting(MIPS)))).setManifest(androidManifest("com.test.app"))).addModule("not_fused", builder -> builder.addFile("lib/x86/libother.so").addFile("lib/x86_64/libother.so").addFile("lib/mips/libother.so").addFile("assets/other_languages#lang_es/image.jpg").addFile("assets/other_languages#lang_fr/image.jpg").addFile("assets/other_languages#lang_it/image.jpg").setAssetsConfig(assets(targetedAssetsDirectory("assets/other_languages#lang_it", assetsDirectoryTargeting(languageTargeting("it"))), targetedAssetsDirectory("assets/other_languages#lang_es", assetsDirectoryTargeting(languageTargeting("es"))), targetedAssetsDirectory("assets/other_languages#lang_fr", assetsDirectoryTargeting(languageTargeting("fr"))))).setNativeConfig(nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(X86)), targetedNativeDirectory("lib/x86_64", nativeDirectoryTargeting(X86_64)), targetedNativeDirectory("lib/mips", nativeDirectoryTargeting(MIPS)))).setManifest(androidManifestForFeature("com.test.app", withTitle("Not fused", 0x7f010000), withFusingAttribute(false)))).build();
    TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputFilePath).withApkBuildMode(SYSTEM).withDeviceSpec(mergeSpecs(sdkVersion(28), abis("x86"), density(DensityAlias.MDPI), locales("es"))).build());
    buildApksManager.execute();
    ZipFile apkSetFile = openZipFile(outputFilePath.toFile());
    BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir);
    assertThat(result.getVariantList()).hasSize(1);
    Variant x86Variant = result.getVariant(0);
    assertThat(x86Variant.getVariantNumber()).isEqualTo(0);
    assertThat(x86Variant.getTargeting()).ignoringRepeatedFieldOrder().isEqualTo(mergeVariantTargeting(variantAbiTargeting(X86, ImmutableSet.of(X86_64, MIPS)), variantSdkTargeting(LOWEST_SDK_VERSION)));
    assertThat(x86Variant.getApkSetList()).hasSize(2);
    ApkSet apkSet = x86Variant.getApkSet(0);
    assertThat(apkSet.getApkDescriptionList().stream().map(ApkDescription::getPath).collect(toImmutableSet())).containsExactly("system/system.apk", "splits/base-it.apk", "splits/base-fr.apk");
    ApkSet apkSetNotFusedModule = x86Variant.getApkSet(1);
    assertThat(apkSetNotFusedModule.getApkDescriptionList().stream().map(ApkDescription::getPath).collect(toImmutableSet())).containsExactly("splits/not_fused-master.apk", "splits/not_fused-es.apk", "splits/not_fused-it.apk", "splits/not_fused-fr.apk", "splits/not_fused-x86.apk");
    apkSet.getApkDescriptionList().forEach(apkDescription -> assertThat(apkSetFile).hasFile(apkDescription.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) ZipFile(java.util.zip.ZipFile) 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) Theory(org.junit.experimental.theories.Theory)

Example 5 with SdkVersion

use of com.android.bundle.Targeting.SdkVersion in project bundletool by google.

the class BuildApksManagerTest method selectsRightModules_systemApks.

@Test
@Theory
public void selectsRightModules_systemApks() throws Exception {
    AppBundle appBundle = new AppBundleBuilder().addModule("base", module -> module.addFile("assets/base.txt").setManifest(androidManifest("com.app")).setResourceTable(resourceTableWithTestLabel("Test feature"))).addModule("fused", module -> module.addFile("assets/fused.txt").setManifest(androidManifestForFeature("com.app", withFusingAttribute(true), withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).addModule("not_fused", module -> module.addFile("assets/not_fused.txt").setManifest(androidManifestForFeature("com.app", withFusingAttribute(false), withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID)))).build();
    TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputFilePath).withApkBuildMode(SYSTEM).withDeviceSpec(mergeSpecs(sdkVersion(28), abis("x86"), density(DensityAlias.MDPI), locales("en-US"))).build());
    buildApksManager.execute();
    ZipFile apkSetFile = openZipFile(outputFilePath.toFile());
    BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir);
    // System APKs: Only base and modules marked for fusing must be used.
    assertThat(systemApkVariants(result)).hasSize(1);
    ImmutableList<ApkDescription> systemApks = apkDescriptions(systemApkVariants(result));
    assertThat(systemApks).containsExactly(ApkDescription.newBuilder().setPath("system/system.apk").setTargeting(ApkTargeting.getDefaultInstance()).setSystemApkMetadata(SystemApkMetadata.newBuilder().addAllFusedModuleName(ImmutableList.of("base", "fused"))).build(), ApkDescription.newBuilder().setPath("splits/not_fused-master.apk").setTargeting(ApkTargeting.getDefaultInstance()).setSplitApkMetadata(SplitApkMetadata.newBuilder().setSplitId("not_fused").setIsMasterSplit(true)).build());
    File systemApkFile = extractFromApkSetFile(apkSetFile, "system/system.apk", outputDir);
    // Validate that the system APK contains appropriate files.
    ZipFile systemApkZip = openZipFile(systemApkFile);
    assertThat(filesUnderPath(systemApkZip, ZipPath.create("assets"))).containsExactly("assets/base.txt", "assets/fused.txt");
}
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) 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) Theory(org.junit.experimental.theories.Theory)

Aggregations

SdkVersion (com.android.bundle.Targeting.SdkVersion)12 VariantTargeting (com.android.bundle.Targeting.VariantTargeting)10 TargetingUtils.mergeVariantTargeting (com.android.tools.build.bundletool.testing.TargetingUtils.mergeVariantTargeting)10 Test (org.junit.Test)10 Configuration (com.android.aapt.ConfigurationOuterClass.Configuration)7 ApexManifest (com.android.apex.ApexManifestProto.ApexManifest)7 ApkVerifier (com.android.apksig.ApkVerifier)7 CodeRelatedFile (com.android.bundle.CodeTransparencyOuterClass.CodeRelatedFile)7 CodeTransparency (com.android.bundle.CodeTransparencyOuterClass.CodeTransparency)7 ApkDescription (com.android.bundle.Commands.ApkDescription)7 ApkSet (com.android.bundle.Commands.ApkSet)7 AssetModulesInfo (com.android.bundle.Commands.AssetModulesInfo)7 AssetSliceSet (com.android.bundle.Commands.AssetSliceSet)7 BuildApksResult (com.android.bundle.Commands.BuildApksResult)7 DefaultTargetingValue (com.android.bundle.Commands.DefaultTargetingValue)7 DeliveryType (com.android.bundle.Commands.DeliveryType)7 InstantMetadata (com.android.bundle.Commands.InstantMetadata)7 ModuleMetadata (com.android.bundle.Commands.ModuleMetadata)7 PermanentlyFusedModule (com.android.bundle.Commands.PermanentlyFusedModule)7 SplitApkMetadata (com.android.bundle.Commands.SplitApkMetadata)7