use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class NativeTargetingValidatorTest method validateModule_pathOutsideLib_throws.
@Test
public void validateModule_pathOutsideLib_throws() throws Exception {
NativeLibraries config = nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(X86)), targetedNativeDirectory("assets/lib/x86_64", nativeDirectoryTargeting(X86_64)));
BundleModule module = new BundleModuleBuilder("testModule").setNativeConfig(config).addFile("lib/x86/libX.so").setManifest(androidManifest("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new NativeTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("directory must be in format 'lib/<directory>'");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class NativeTargetingValidatorTest method validateModule_directoriesUnderLibNotTargeted_throws.
@Test
public void validateModule_directoriesUnderLibNotTargeted_throws() throws Exception {
NativeLibraries config = nativeLibraries(targetedNativeDirectory("lib/mips", nativeDirectoryTargeting(MIPS)));
BundleModule module = new BundleModuleBuilder("testModule").addFile("lib/x86/libX.so").addFile("lib/x86_64/libX.so").addFile("lib/mips/libX.so").setNativeConfig(config).setManifest(androidManifest("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new NativeTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("Following native directories are not targeted: [lib/x86, lib/x86_64]");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ResourceTableValidatorTest method validateModule_nonReferencedFile_throws.
@Test
public void validateModule_nonReferencedFile_throws() throws Exception {
BundleModule module = new BundleModuleBuilder("module").setResourceTable(new ResourceTableBuilder().addPackage("com.test.app").addDrawableResource("icon", "res/drawable/icon.png").build()).setManifest(androidManifest("com.test.app")).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ResourceTableValidator().validateModule(module));
assertThat(exception).hasMessageThat().contains("contains references to non-existing files: [res/drawable/icon.png]");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ResourceTableValidatorTest method validateModule_fileOutsideRes_throws.
@Test
public void validateModule_fileOutsideRes_throws() throws Exception {
BundleModule module = new BundleModuleBuilder("module").addFile("assets/icon.png").setResourceTable(new ResourceTableBuilder().addPackage("com.test.app").addDrawableResource("icon", "assets/icon.png").build()).setManifest(androidManifest("com.test.app")).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ResourceTableValidator().validateModule(module));
assertThat(exception).hasMessageThat().contains("references file 'assets/icon.png' outside of the 'res/' directory");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ResourceTableValidatorTest method validateModule_nonExistingFile_throws.
@Test
public void validateModule_nonExistingFile_throws() throws Exception {
BundleModule module = new BundleModuleBuilder("module").setResourceTable(ResourceTable.getDefaultInstance()).addFile("res/drawable/icon.png").setManifest(androidManifest("com.test.app")).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ResourceTableValidator().validateModule(module));
assertThat(exception).hasMessageThat().contains("contains resource files that are not referenced from the resource table: " + "[res/drawable/icon.png]");
}
Aggregations