use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.
the class AssetBundleValidatorTest method validateAllModules_assetOnlyWithInstallTime_throws.
@Test
public void validateAllModules_assetOnlyWithInstallTime_throws() throws Exception {
ImmutableList<BundleModule> allModules = ImmutableList.of(assetOnlyModule("asset", androidManifestForAssetModule(PKG_NAME, withInstallTimeDelivery())));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new AssetBundleValidator().validateAllModules(allModules));
assertThat(exception).hasMessageThat().contains("Asset-only bundle contains an install-time asset module");
}
use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.
the class AssetModuleFilesValidatorTest method validModule_succeeds.
@Test
public void validModule_succeeds() throws Exception {
BundleModule module = new BundleModuleBuilder(MODULE_NAME).setManifest(androidManifest(PKG_NAME)).addFile("assets/img.jpg").build();
new AssetModuleFilesValidator().validateModule(module);
}
use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.
the class AssetModuleFilesValidatorTest method moduleWithInvalidEntry_throws.
@Test
public void moduleWithInvalidEntry_throws() throws Exception {
BundleModule module = new BundleModuleBuilder(MODULE_NAME).setManifest(androidManifestForAssetModule(PKG_NAME)).addFile("dex/classes.dex").build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new AssetModuleFilesValidator().validateModule(module));
assertThat(exception).hasMessageThat().matches("Invalid entry found in asset pack 'assetmodule': 'dex/classes.dex'.");
}
use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.
the class AssetModuleFilesValidatorTest method moduleWithInvalidEntries_throws.
@Test
public void moduleWithInvalidEntries_throws() throws Exception {
BundleModule module = new BundleModuleBuilder(MODULE_NAME).setManifest(androidManifestForAssetModule(PKG_NAME)).addFile("res/string.xml").addFile("lib/x86/awesomelib.so").addFile("assets/kitten.jpg").addFile("root/groot.jpg").build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new AssetModuleFilesValidator().validateModule(module));
assertThat(exception).hasMessageThat().matches("Invalid entries found in asset pack 'assetmodule': 'res/string.xml'," + " 'lib/x86/awesomelib.so', 'root/groot.jpg'.");
}
use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_valid_succeeds.
@Test
public void validateModule_valid_succeeds() throws Exception {
Assets config = assets(targetedAssetsDirectory("assets/dir_other#tcf_etc1", assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ETC1_RGB8))));
BundleModule module = new BundleModuleBuilder("testModule").addFile("assets/dir_other#tcf_etc1/raw.dat").setAssetsConfig(config).setManifest(androidManifest("com.test.app")).build();
new AssetsTargetingValidator().validateModule(module);
}
Aggregations