use of com.android.tools.build.bundletool.model.BundleModule 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.BundleModule in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_pointDirectlyToAssets_succeeds.
@Test
public void validateModule_pointDirectlyToAssets_succeeds() throws Exception {
Assets config = assets(targetedAssetsDirectory("assets", AssetsDirectoryTargeting.getDefaultInstance()));
BundleModule module = new BundleModuleBuilder("testModule").addFile("assets/file.dat").setAssetsConfig(config).setManifest(androidManifest("com.test.app")).build();
new AssetsTargetingValidator().validateModule(module);
}
use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.
the class VariantGeneratorTest method targetsPreLOnlyInManifest_throws.
@Test
public void targetsPreLOnlyInManifest_throws() throws Exception {
int preL = 20;
BundleModule bundleModule = new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app", withMaxSdkVersion(preL))).build();
CommandExecutionException exception = assertThrows(CommandExecutionException.class, () -> new VariantGenerator().generateVariants(bundleModule));
assertThat(exception).hasMessageThat().contains("does not target devices on Android L or above");
}
use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.
the class VariantGeneratorTest method variantsWithV3SigningRestrictedToRPlus.
@Test
public void variantsWithV3SigningRestrictedToRPlus() throws Exception {
BundleModule bundleModule = new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).build();
VariantGenerator variantGenerator = new VariantGenerator();
ImmutableCollection<VariantTargeting> splits = variantGenerator.generateVariants(bundleModule, ApkGenerationConfiguration.builder().setMinSdkForAdditionalVariantWithV3Rotation(ANDROID_R_API_VERSION).build());
assertThat(splits).containsExactly(lPlusVariantTargeting(), variantMinSdkTargeting(ANDROID_R_API_VERSION));
}
use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.
the class AndroidManifestValidatorTest method withMinSdkHigherThanBase_ok.
@Test
public void withMinSdkHigherThanBase_ok() throws Exception {
BundleModule base = baseModule(withMinSdkVersion(20));
BundleModule module = new BundleModuleBuilder(FEATURE_MODULE_NAME).setManifest(androidManifest(PKG_NAME, withMinSdkVersion(21))).build();
new AndroidManifestValidator().validateAllModules(ImmutableList.of(base, module));
// No exception thrown.
}
Aggregations