use of com.android.bundle.Files.ApexImages in project bundletool by google.
the class BuildApksManagerTest method buildApksCommand_apkNotificationMessageKeyApexBundle_hasRightSuffix.
@Test
public void buildApksCommand_apkNotificationMessageKeyApexBundle_hasRightSuffix() throws Exception {
ApexImages apexConfig = apexImages(targetedApexImage("apex/x86_64.img", apexImageTargeting("x86_64")), targetedApexImage("apex/x86.img", apexImageTargeting("x86")), targetedApexImage("apex/arm64-v8a.img", apexImageTargeting("arm64-v8a")), targetedApexImage("apex/armeabi-v7a.img", apexImageTargeting("armeabi-v7a")), targetedApexImage("apex/arm64-v8a.armeabi-v7a.img", apexImageTargeting("arm64-v8a", "armeabi-v7a")));
AppBundle appBundle = new AppBundleBuilder().addModule("base", builder -> builder.addFile(APEX_MANIFEST_PATH, APEX_MANIFEST).addFile("apex/x86_64.img").addFile("apex/x86.img").addFile("apex/arm64-v8a.img").addFile("apex/armeabi-v7a.img").addFile("apex/arm64-v8a.armeabi-v7a.img").setApexConfig(apexConfig).setManifest(androidManifest("com.test.app"))).build();
TestComponent.useTestModule(this, createTestModuleBuilder().withAppBundle(appBundle).withOutputPath(outputFilePath).build());
buildApksManager.execute();
BuildApksResult result = extractTocFromApkSetFile(openZipFile(outputFilePath.toFile()), outputDir);
ImmutableList<Variant> variants = apexApkVariants(result);
ImmutableSet<String> apkPaths = variants.stream().map(variant -> getOnlyElement(getOnlyElement(variant.getApkSetList()).getApkDescriptionList()).getPath()).collect(toImmutableSet());
assertThat(apkPaths).containsExactly("standalones/standalone-x86_64.apex", "standalones/standalone-x86.apex", "standalones/standalone-arm64_v8a.apex", "standalones/standalone-armeabi_v7a.apex", "standalones/standalone-armeabi_v7a.arm64_v8a.apex");
}
use of com.android.bundle.Files.ApexImages in project bundletool by google.
the class ApexBundleValidatorTest method validateModule_singleton64BitAbiAnd64With32Missing_throws.
@Test
public void validateModule_singleton64BitAbiAnd64With32Missing_throws() throws Exception {
ApexImages apexConfig = ApexImages.newBuilder().addImage(TargetedApexImage.newBuilder().setPath("apex/x86_64.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/x86.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/armeabi-v7a.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/x86_64.x86.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/x86_64.armeabi-v7a.img")).build();
BundleModule apexModule = new BundleModuleBuilder("apexTestModule").setManifest(androidManifest(PKG_NAME)).setApexConfig(apexConfig).addFile(APEX_MANIFEST_PATH, APEX_MANIFEST).addFile("apex/x86_64.img").addFile("apex/x86.img").addFile("apex/armeabi-v7a.img").addFile("apex/x86_64.x86.img").addFile("apex/x86_64.armeabi-v7a.img").build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ApexBundleValidator().validateModule(apexModule));
assertThat(exception).hasMessageThat().contains("APEX bundle must contain one of");
}
use of com.android.bundle.Files.ApexImages in project bundletool by google.
the class ApexBundleValidatorTest method validateModule_imageFilesTargetSameSetOfAbis_throws.
@Test
public void validateModule_imageFilesTargetSameSetOfAbis_throws() throws Exception {
ApexImages apexConfig = APEX_CONFIG.toBuilder().addImage(TargetedApexImage.newBuilder().setPath("apex/x86.armeabi-v7a.x86_64.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/x86_64.x86.armeabi-v7a.img")).build();
BundleModule apexModule = new BundleModuleBuilder("apexTestModule").setManifest(androidManifest(PKG_NAME)).setApexConfig(apexConfig).addFile(APEX_MANIFEST_PATH, APEX_MANIFEST).addFile("apex/x86_64.img").addFile("apex/x86.img").addFile("apex/armeabi-v7a.img").addFile("apex/arm64-v8a.img").addFile("apex/x86.armeabi-v7a.x86_64.img").addFile("apex/x86_64.x86.armeabi-v7a.img").build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ApexBundleValidator().validateModule(apexModule));
assertThat(exception).hasMessageThat().contains("Every APEX image file must target a unique set of architectures");
}
use of com.android.bundle.Files.ApexImages in project bundletool by google.
the class ApexBundleValidatorTest method validateModule_singleton64BitAbiMissing_doesNotThrow.
@Test
public void validateModule_singleton64BitAbiMissing_doesNotThrow() throws Exception {
ApexImages apexConfig = ApexImages.newBuilder().addImage(TargetedApexImage.newBuilder().setPath("apex/x86_64.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/x86.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/armeabi-v7a.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/x86_64.x86.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/arm64-v8a.armeabi-v7a.img")).build();
BundleModule apexModule = new BundleModuleBuilder("apexTestModule").setManifest(androidManifest(PKG_NAME)).setApexConfig(apexConfig).addFile(APEX_MANIFEST_PATH, APEX_MANIFEST).addFile("apex/x86_64.img").addFile("apex/x86.img").addFile("apex/armeabi-v7a.img").addFile("apex/x86_64.x86.img").addFile("apex/arm64-v8a.armeabi-v7a.img").build();
new ApexBundleValidator().validateModule(apexModule);
}
use of com.android.bundle.Files.ApexImages in project bundletool by google.
the class ApexBundleValidatorTest method validateModule_singleton32BitAbiMissing_throws.
@Test
public void validateModule_singleton32BitAbiMissing_throws() throws Exception {
ApexImages apexConfig = ApexImages.newBuilder().addImage(TargetedApexImage.newBuilder().setPath("apex/x86_64.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/x86.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/arm64-v8a.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/x86_64.x86.img")).addImage(TargetedApexImage.newBuilder().setPath("apex/x86_64.armeabi-v7a.img")).build();
BundleModule apexModule = new BundleModuleBuilder("apexTestModule").setManifest(androidManifest(PKG_NAME)).setApexConfig(apexConfig).addFile(APEX_MANIFEST_PATH, APEX_MANIFEST).addFile("apex/x86_64.img").addFile("apex/x86.img").addFile("apex/arm64-v8a.img").addFile("apex/x86_64.x86.img").addFile("apex/x86_64.armeabi-v7a.img").build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ApexBundleValidator().validateModule(apexModule));
assertThat(exception).hasMessageThat().contains("APEX bundle must contain one of");
}
Aggregations