use of com.android.tools.build.bundletool.testing.BundleModuleBuilder 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.
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AndroidManifestValidatorTest method withMaxSdkEqualToInstantSdk_ok.
@Test
public void withMaxSdkEqualToInstantSdk_ok() throws Exception {
BundleModule module = new BundleModuleBuilder(FEATURE_MODULE_NAME).setManifest(androidManifest(PKG_NAME, withInstant(true), withOnDemandAttribute(false), withFusingAttribute(false), withMaxSdkVersion(21))).build();
new AndroidManifestValidator().validateModule(module);
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AndroidManifestValidatorTest method conditionalModuleNonRemovable_throws.
@Test
public void conditionalModuleNonRemovable_throws() throws Exception {
ImmutableList<BundleModule> bundleModules = ImmutableList.of(new BundleModuleBuilder(BASE_MODULE_NAME).addFile("assets/textures#tcf_astc/level1.assets").setManifest(androidManifest("com.test")).build(), new BundleModuleBuilder("asset_module").addFile("assets/other_textures#tcf_astc/astc_file.assets").setManifest(androidManifestForAssetModule("com.test.app", withInstallTimeRemovableElement(false), withMinSdkVersion(24), withFeatureCondition("android.feature"))).build());
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new AndroidManifestValidator().validateAllModules(bundleModules));
assertThat(exception).hasMessageThat().contains("Conditional modules cannot be set to non-removable.");
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AndroidManifestValidatorTest method assetOnly_ok.
@Test
public void assetOnly_ok() throws Exception {
BundleModule module = new BundleModuleBuilder(BASE_MODULE_NAME, BundleConfig.newBuilder().setType(BundleConfig.BundleType.ASSET_ONLY).build()).setManifest(androidManifestForAssetModule(PKG_NAME)).build();
new AndroidManifestValidator().validateAllModules(ImmutableList.of(module));
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AndroidManifestValidatorTest method assetModule_noVersionCode_ok.
@Test
public void assetModule_noVersionCode_ok() throws Exception {
ImmutableList<BundleModule> bundleModules = ImmutableList.of(new BundleModuleBuilder(BASE_MODULE_NAME).setManifest(androidManifest("com.test", withVersionCode(2))).build(), new BundleModuleBuilder("asset_module").setManifest(androidManifestForAssetModule("com.test.app")).build());
new AndroidManifestValidator().validateAllModules(bundleModules);
}
Aggregations