Search in sources :

Example 6 with MultiAbiTargeting

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

the class ApkMatcherTest method apexVariantMatch_noMatch_throws.

// APEX variants tests.
@Test
public void apexVariantMatch_noMatch_throws() {
    ZipPath x86Apk = ZipPath.create("standalone-x86.apk");
    ZipPath x64X86Apk = ZipPath.create("standalone-x86_64.x86.apk");
    ImmutableSet<ImmutableSet<AbiAlias>> x86Set = ImmutableSet.of(ImmutableSet.of(X86));
    ImmutableSet<ImmutableSet<AbiAlias>> x64X86Set = ImmutableSet.of(ImmutableSet.of(X86_64, X86));
    MultiAbiTargeting x86Targeting = multiAbiTargeting(x86Set, x64X86Set);
    MultiAbiTargeting x64X86Targeting = multiAbiTargeting(x64X86Set, x86Set);
    BuildApksResult buildApksResult = BuildApksResult.newBuilder().addVariant(multiAbiTargetingApexVariant(x86Targeting, x86Apk)).addVariant(multiAbiTargetingApexVariant(x64X86Targeting, x64X86Apk)).build();
    IncompatibleDeviceException e = assertThrows(IncompatibleDeviceException.class, () -> new ApkMatcher(abis("x86_64", "armeabi-v7a")).getMatchingApks(buildApksResult));
    assertThat(e).hasMessageThat().contains("No set of ABI architectures that the app supports is contained in the ABI " + "architecture set of the device");
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) BuildApksResult(com.android.bundle.Commands.BuildApksResult) ZipPath(com.android.tools.build.bundletool.model.ZipPath) IncompatibleDeviceException(com.android.tools.build.bundletool.model.exceptions.IncompatibleDeviceException) MultiAbiTargeting(com.android.bundle.Targeting.MultiAbiTargeting) Test(org.junit.Test)

Aggregations

MultiAbiTargeting (com.android.bundle.Targeting.MultiAbiTargeting)6 BuildApksResult (com.android.bundle.Commands.BuildApksResult)5 ZipPath (com.android.tools.build.bundletool.model.ZipPath)5 Test (org.junit.Test)5 ImmutableSet (com.google.common.collect.ImmutableSet)4 Variant (com.android.bundle.Commands.Variant)2 IncompatibleDeviceException (com.android.tools.build.bundletool.model.exceptions.IncompatibleDeviceException)2 ApksArchiveHelpers.createVariant (com.android.tools.build.bundletool.testing.ApksArchiveHelpers.createVariant)2 ApksArchiveHelpers.multiAbiTargetingApexVariant (com.android.tools.build.bundletool.testing.ApksArchiveHelpers.multiAbiTargetingApexVariant)2 ApksArchiveHelpers.standaloneVariant (com.android.tools.build.bundletool.testing.ApksArchiveHelpers.standaloneVariant)2 AbiTargeting (com.android.bundle.Targeting.AbiTargeting)1 LanguageTargeting (com.android.bundle.Targeting.LanguageTargeting)1 MultiAbi (com.android.bundle.Targeting.MultiAbi)1 Sanitizer (com.android.bundle.Targeting.Sanitizer)1 SanitizerTargeting (com.android.bundle.Targeting.SanitizerTargeting)1 TextureCompressionFormatTargeting (com.android.bundle.Targeting.TextureCompressionFormatTargeting)1 Path (java.nio.file.Path)1 StringJoiner (java.util.StringJoiner)1 Theory (org.junit.experimental.theories.Theory)1