use of com.android.bundle.Commands.BuildApksResult in project bundletool by google.
the class ApkMatcherTest method apexVariantMatch_matchesRightVariant.
@Test
public void apexVariantMatch_matchesRightVariant() {
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)).setBundletool(Bundletool.newBuilder().setVersion(BundleToolVersion.getCurrentVersion().toString())).build();
assertThat(new ApkMatcher(abis("x86")).getMatchingApks(buildApksResult)).containsExactly(baseMatchedApk(x86Apk));
assertThat(new ApkMatcher(abis("x86_64", "x86")).getMatchingApks(buildApksResult)).containsExactly(baseMatchedApk(x64X86Apk));
assertThat(new ApkMatcher(abis("x86_64", "x86", "armeabi-v7a")).getMatchingApks(buildApksResult)).containsExactly(baseMatchedApk(x64X86Apk));
// Other device specs don't affect the matching variant.
assertThat(new ApkMatcher(deviceWith(26, ImmutableList.of("x86"), HDPI)).getMatchingApks(buildApksResult)).containsExactly(baseMatchedApk(x86Apk));
}
use of com.android.bundle.Commands.BuildApksResult in project bundletool by google.
the class ApkMatcherTest method apkMatch_textureSplit_fallback.
@Test
public void apkMatch_textureSplit_fallback() {
ZipPath apk = ZipPath.create("master-other_tcf.apk");
BuildApksResult buildApksResult = buildApksResult(oneApkSplitApkVariant(variantSdkTargeting(sdkVersionFrom(Versions.ANDROID_L_API_VERSION)), apkTextureTargeting(ImmutableSet.of(), ImmutableSet.of(ATC, PVRTC)), apk));
assertThat(new ApkMatcher(lDevice()).getMatchingApks(buildApksResult)).containsExactly(baseMatchedApk(apk));
}
use of com.android.bundle.Commands.BuildApksResult in project bundletool by google.
the class ApkMatcherTest method apkMatch_abiSplit.
// APK targeting tests.
// ABI splits.
@Test
public void apkMatch_abiSplit() {
ZipPath apk = ZipPath.create("sample.apk");
BuildApksResult buildApksResult = buildApksResult(oneApkSplitApkVariant(variantSdkTargeting(sdkVersionFrom(Versions.ANDROID_L_API_VERSION)), apkAbiTargeting(X86), apk));
assertThat(new ApkMatcher(lDeviceWithAbis("x86_64", "x86")).getMatchingApks(buildApksResult)).containsExactly(baseMatchedApk(apk));
}
use of com.android.bundle.Commands.BuildApksResult in project bundletool by google.
the class ApkMatcherTest method apkMatch_abiSplit_noBetterAlternative.
@Test
public void apkMatch_abiSplit_noBetterAlternative() {
ZipPath apk = ZipPath.create("sample.apk");
BuildApksResult buildApksResult = buildApksResult(oneApkSplitApkVariant(variantSdkTargeting(sdkVersionFrom(Versions.ANDROID_L_API_VERSION)), apkAbiTargeting(X86, ImmutableSet.of(ARM64_V8A, ARMEABI)), apk));
assertThat(new ApkMatcher(lDeviceWithAbis("x86_64", "x86", "arm64-v8a")).getMatchingApks(buildApksResult)).containsExactly(baseMatchedApk(apk));
}
use of com.android.bundle.Commands.BuildApksResult in project bundletool by google.
the class ApkMatcherTest method textureVariant_preL_incompatibleDevice.
@Test
public void textureVariant_preL_incompatibleDevice() {
ZipPath apk = ZipPath.create("master-etc1_rgb8.apk");
BuildApksResult buildApksResult = buildApksResult(standaloneVariant(mergeVariantTargeting(variantSdkTargeting(sdkVersionFrom(1), ImmutableSet.of(sdkVersionFrom(21))), variantTextureTargeting(ATC)), ApkTargeting.getDefaultInstance(), apk));
IncompatibleDeviceException exception = assertThrows(IncompatibleDeviceException.class, () -> new ApkMatcher(preLDeviceWithGlExtensions("GL_OES_compressed_ETC1_RGB8_texture")).getMatchingApks(buildApksResult));
assertThat(exception).hasMessageThat().contains("The app doesn't support texture compression formats of the device. Device formats:" + " [ETC1_RGB8], app formats: [ATC]");
}
Aggregations