use of com.android.bundle.Targeting.Abi in project bundletool by google.
the class BuildApksManagerTest method splitFileNames_abi.
@Test
public void splitFileNames_abi() throws Exception {
AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.addFile("dex/classes.dex").addFile("lib/x86/library.so").setManifest(androidManifest("com.test.app")).setNativeConfig(nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(X86))))).build();
TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputFilePath).withOptimizationDimensions(ABI).build());
buildApksManager.execute();
ZipFile apkSetFile = openZipFile(outputFilePath.toFile());
BuildApksResult result = extractTocFromApkSetFile(apkSetFile, outputDir);
ImmutableMap<VariantTargeting, Variant> splitVariantsByTargeting = Maps.uniqueIndex(splitApkVariants(result), Variant::getTargeting);
VariantTargeting lSplitVariantTargeting = variantSdkTargeting(L_SDK_VERSION, ImmutableSet.of(LOWEST_SDK_VERSION, M_SDK_VERSION));
VariantTargeting mSplitVariantTargeting = variantSdkTargeting(M_SDK_VERSION, ImmutableSet.of(LOWEST_SDK_VERSION, L_SDK_VERSION));
assertThat(splitVariantsByTargeting.keySet()).containsExactly(lSplitVariantTargeting, mSplitVariantTargeting);
assertThat(ImmutableSet.builder().addAll(apkNamesInVariant(splitVariantsByTargeting.get(lSplitVariantTargeting))).addAll(apkNamesInVariant(splitVariantsByTargeting.get(mSplitVariantTargeting))).build()).containsExactly("base-master.apk", "base-x86.apk", "base-master_2.apk", "base-x86_2.apk");
}
Aggregations