use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException 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.exceptions.InvalidBundleException in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_emptyTargetedDirectory_throws.
@Test
public void validateModule_emptyTargetedDirectory_throws() throws Exception {
Assets config = assets(targetedAssetsDirectory("assets/dir#tcf_etc1", assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ETC1_RGB8))));
BundleModule module = new BundleModuleBuilder("testModule").setAssetsConfig(config).setManifest(androidManifest("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new AssetsTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("Targeted directory 'assets/dir#tcf_etc1' is empty.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class BundleConfigValidatorTest method optimizations_tcfDimensionSuffixStrippingWithInvalidDefault_throws.
@Test
public void optimizations_tcfDimensionSuffixStrippingWithInvalidDefault_throws() throws Exception {
AppBundle appBundle = createAppBundle(BundleConfigBuilder.create().clearOptimizations().addSplitDimension(SplitDimension.newBuilder().setValueValue(Value.TEXTURE_COMPRESSION_FORMAT_VALUE).setSuffixStripping(SuffixStripping.newBuilder().setEnabled(true).setDefaultSuffix("unrecognized_tcf")).build()));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new BundleConfigValidator().validateBundle(appBundle));
assertThat(exception).hasMessageThat().contains("The default texture compression format chosen for suffix stripping" + " (\"unrecognized_tcf\") is not valid.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class BundleConfigValidatorTest method optimizations_duplicateSplitDimensions_positiveAndNegative_throws.
@Test
public void optimizations_duplicateSplitDimensions_positiveAndNegative_throws() throws Exception {
AppBundle appBundle = createAppBundle(BundleConfigBuilder.create().clearOptimizations().addSplitDimension(SplitDimension.Value.ABI, /* negate= */
false).addSplitDimension(SplitDimension.Value.ABI, /* negate= */
true));
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new BundleConfigValidator().validateBundle(appBundle));
assertThat(exception).hasMessageThat().contains("duplicate split dimensions");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class BundleConfigValidatorTest method compression_invalidGlob_throws.
@Test
public void compression_invalidGlob_throws() throws Exception {
AppBundle appBundle = createAppBundle(BundleConfigBuilder.create().clearCompression().addUncompressedGlob("res/raw\\"));
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new BundleConfigValidator().validateBundle(appBundle));
assertThat(e).hasMessageThat().contains("Invalid uncompressed glob: 'res/raw\\'.");
}
Aggregations