Search in sources :

Example 21 with ApkTargeting

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

the class TargetingUtilsTest method apkMultiAbiTargeting_byAbiAliasAndAlternativesSet.

@Test
public void apkMultiAbiTargeting_byAbiAliasAndAlternativesSet() {
    ApkTargeting expectedTargeting = ApkTargeting.newBuilder().setMultiAbiTargeting(SINGLE_ABI_WITH_ALTERNATIVES).build();
    assertThat(TargetingUtils.apkMultiAbiTargeting(AbiAlias.X86, ImmutableSet.of(ARMEABI_V7A, ARM64_V8A))).ignoringRepeatedFieldOrder().isEqualTo(expectedTargeting);
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) Test(org.junit.Test)

Example 22 with ApkTargeting

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

the class TargetingUtilsTest method apkMultiAbiTargeting_byAbiAlias.

@Test
public void apkMultiAbiTargeting_byAbiAlias() {
    ApkTargeting expectedTargeting = ApkTargeting.newBuilder().setMultiAbiTargeting(SINGLE_ABI_NO_ALTERNATIVES).build();
    assertThat(TargetingUtils.apkMultiAbiTargeting(X86)).isEqualTo(expectedTargeting);
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) Test(org.junit.Test)

Example 23 with ApkTargeting

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

the class TargetingUtilsTest method apkMultiAbiTargetingFromAllTergeting.

@Test
public void apkMultiAbiTargetingFromAllTergeting() {
    ImmutableSet<ImmutableSet<AbiAlias>> allTargeting = ImmutableSet.of(ImmutableSet.of(ARMEABI_V7A), ImmutableSet.of(ARM64_V8A), ImmutableSet.of(X86));
    ApkTargeting expectedTargeting = ApkTargeting.newBuilder().setMultiAbiTargeting(SINGLE_ABI_WITH_ALTERNATIVES).build();
    assertThat(TargetingUtils.apkMultiAbiTargetingFromAllTargeting(ImmutableSet.of(X86), allTargeting)).ignoringRepeatedFieldOrder().isEqualTo(expectedTargeting);
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) Test(org.junit.Test)

Example 24 with ApkTargeting

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

the class MergingUtilsTest method mergeShardTargetings_equalDensities_ok.

@Test
public void mergeShardTargetings_equalDensities_ok() {
    ApkTargeting targeting = apkDensityTargeting(DensityAlias.HDPI);
    ApkTargeting merged = MergingUtils.mergeShardTargetings(targeting, targeting);
    assertThat(merged).isEqualTo(targeting);
    assertThat(merged.hasAbiTargeting()).isFalse();
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) Test(org.junit.Test)

Example 25 with ApkTargeting

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

the class MergingUtilsTest method mergeShardTargetings_firstAbiSecondDensity_ok.

@Test
public void mergeShardTargetings_firstAbiSecondDensity_ok() {
    ApkTargeting targeting1 = apkAbiTargeting(AbiAlias.X86);
    ApkTargeting targeting2 = apkDensityTargeting(DensityAlias.HDPI);
    ApkTargeting merged = MergingUtils.mergeShardTargetings(targeting1, targeting2);
    assertThat(merged).isEqualTo(ApkTargeting.newBuilder().setAbiTargeting(abiTargeting(AbiAlias.X86)).setScreenDensityTargeting(screenDensityTargeting(DensityAlias.HDPI)).build());
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) Test(org.junit.Test)

Aggregations

ApkTargeting (com.android.bundle.Targeting.ApkTargeting)49 Test (org.junit.Test)44 TargetingUtils.mergeApkTargeting (com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting)28 ModuleSplit (com.android.tools.build.bundletool.model.ModuleSplit)22 BundleModule (com.android.tools.build.bundletool.model.BundleModule)18 BundleModuleBuilder (com.android.tools.build.bundletool.testing.BundleModuleBuilder)18 ResourceTableBuilder (com.android.tools.build.bundletool.testing.ResourceTableBuilder)10 ResourceTable (com.android.aapt.Resources.ResourceTable)8 DensityAlias (com.android.bundle.Targeting.ScreenDensity.DensityAlias)7 ImmutableList (com.google.common.collect.ImmutableList)7 ImmutableSet (com.google.common.collect.ImmutableSet)7 ApexImages (com.android.bundle.Files.ApexImages)6 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)6 ImmutableSet.toImmutableSet (com.google.common.collect.ImmutableSet.toImmutableSet)6 Configuration (com.android.aapt.ConfigurationOuterClass.Configuration)5 ZipPath (com.android.tools.build.bundletool.model.ZipPath)5 ManifestProtoUtils.androidManifest (com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest)5 MDPI (com.android.tools.build.bundletool.testing.ResourcesTableFactory.MDPI)5 USER_PACKAGE_OFFSET (com.android.tools.build.bundletool.testing.ResourcesTableFactory.USER_PACKAGE_OFFSET)5 ImmutableMap (com.google.common.collect.ImmutableMap)5