use of com.android.bundle.Files.NativeLibraries in project bundletool by google.
the class NativeTargetingValidatorTest method validateModule_valid_succeeds.
@Test
public void validateModule_valid_succeeds() throws Exception {
NativeLibraries config = nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(X86)), targetedNativeDirectory("lib/x86_64", nativeDirectoryTargeting(X86_64)), targetedNativeDirectory("lib/mips", nativeDirectoryTargeting(MIPS)));
BundleModule module = new BundleModuleBuilder("testModule").setNativeConfig(config).addFile("lib/x86/libX.so").addFile("lib/x86_64/libX.so").addFile("lib/mips/libX.so").setManifest(androidManifest("com.test.app")).build();
new NativeTargetingValidator().validateModule(module);
}
use of com.android.bundle.Files.NativeLibraries 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.bundle.Files.NativeLibraries in project bundletool by google.
the class AssetModuleFilesValidatorTest method moduleWithNativeConfig_throws.
@Test
public void moduleWithNativeConfig_throws() throws Exception {
NativeLibraries config = nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(DXT1)));
BundleModule module = new BundleModuleBuilder(MODULE_NAME).setManifest(androidManifestForAssetModule(PKG_NAME)).setNativeConfig(config).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new AssetModuleFilesValidator().validateModule(module));
assertThat(exception).hasMessageThat().matches("Native libraries config not allowed in asset packs, but found in 'assetmodule'.");
}
use of com.android.bundle.Files.NativeLibraries in project bundletool by google.
the class NativeTargetingValidatorTest method validateModule_abiTargetingDimensionNotSet_throws.
@Test
public void validateModule_abiTargetingDimensionNotSet_throws() throws Exception {
NativeLibraries config = nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(DXT1)));
BundleModule module = new BundleModuleBuilder("testModule").addFile("lib/x86/libX.so").setNativeConfig(config).setManifest(androidManifest("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new NativeTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("Targeted native directory 'lib/x86' does not have the ABI dimension set");
}
use of com.android.bundle.Files.NativeLibraries in project bundletool by google.
the class NativeTargetingValidatorTest method validateModule_pointDirectlyToLib_throws.
@Test
public void validateModule_pointDirectlyToLib_throws() throws Exception {
NativeLibraries config = nativeLibraries(targetedNativeDirectory("lib/", nativeDirectoryTargeting(X86_64)));
BundleModule module = new BundleModuleBuilder("testModule").setNativeConfig(config).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>'");
}
Aggregations