use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ModuleNamesValidatorTest method moreThanOneModuleWithoutSplitId.
@Test
public void moreThanOneModuleWithoutSplitId() {
BundleModule base1 = buildBundleModule("base").setAndroidManifestProto(androidManifest("com.app")).build();
BundleModule base2 = buildBundleModule("base").setAndroidManifestProto(androidManifest("com.app")).build();
InvalidBundleException expected = assertThrows(InvalidBundleException.class, () -> new ModuleNamesValidator().validateAllModules(ImmutableList.of(base1, base2)));
assertThat(expected).hasMessageThat().contains("More than one module was found without the 'split' attribute set in the " + "AndroidManifest.xml.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ModuleNamesValidatorTest method splitIdDoesNotMatchModuleName.
@Test
public void splitIdDoesNotMatchModuleName() {
BundleModule base = buildBundleModule("base").setAndroidManifestProto(androidManifest("com.app")).build();
BundleModule feature = buildBundleModule("module").setAndroidManifestProto(androidManifest("com.app", withSplitId("feature"))).build();
InvalidBundleException expected = assertThrows(InvalidBundleException.class, () -> new ModuleNamesValidator().validateAllModules(ImmutableList.of(base, feature)));
assertThat(expected).hasMessageThat().contains("The 'split' attribute in the AndroidManifest.xml of modules must be the name of the " + "module, but has the value 'feature' in module 'module'");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class ModuleTitleValidatorTest method validateAllModules_onDemandModuleTitleMissingInResourceTable_throws.
@Test
public void validateAllModules_onDemandModuleTitleMissingInResourceTable_throws() throws Exception {
ImmutableList<BundleModule> allModules = ImmutableList.of(module("base", androidManifest(PKG_NAME)), module("demand", androidManifest(PKG_NAME, withOnDemandAttribute(true), withTitle("@string/test_label", TEST_LABEL_RESOURCE_ID))));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new ModuleTitleValidator().validateAllModules(allModules));
assertThat(exception).hasMessageThat().contains("is missing in the base resource table");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class AssetModuleFilesValidatorTest method moduleWithResourceTable_throws.
@Test
public void moduleWithResourceTable_throws() throws Exception {
BundleModule module = new BundleModuleBuilder(MODULE_NAME).setManifest(androidManifestForAssetModule(PKG_NAME)).setResourceTable(ResourceTable.getDefaultInstance()).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new AssetModuleFilesValidator().validateModule(module));
assertThat(exception).hasMessageThat().matches("Unexpected resource table found in asset pack 'assetmodule'.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException 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'.");
}
Aggregations