Search in sources :

Example 41 with BundleModule

use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.

the class AndroidManifestValidatorTest method withHighTargetSandboxVersionCode_throws.

@Test
public void withHighTargetSandboxVersionCode_throws() throws Exception {
    BundleModule module = baseModule(withTargetSandboxVersion(3));
    InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new AndroidManifestValidator().validateAllModules(ImmutableList.of(module)));
    assertThat(e).hasMessageThat().contains("cannot have a value greater than 2, but found 3");
}
Also used : InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 42 with BundleModule

use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.

the class AndroidManifestValidatorTest method assetModuleWithOnDemandAndInstantAttributeSetToTrue_ok.

@Test
public void assetModuleWithOnDemandAndInstantAttributeSetToTrue_ok() throws Exception {
    BundleModule assetModule = new BundleModuleBuilder("assetmodule").setManifest(androidManifestForAssetModule(PKG_NAME, withOnDemandAttribute(true), withInstant(true))).build();
    new AndroidManifestValidator().validateModule(assetModule);
}
Also used : BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 43 with BundleModule

use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.

the class AndroidManifestValidatorTest method minSdkConditionGreaterEqualThanMinSdkVersion_ok.

@Test
public void minSdkConditionGreaterEqualThanMinSdkVersion_ok() throws Exception {
    BundleModule featureModule = new BundleModuleBuilder(FEATURE_MODULE_NAME).setManifest(androidManifest(PKG_NAME, withFusingAttribute(true), withMinSdkCondition(24), withMinSdkVersion(19))).build();
    new AndroidManifestValidator().validateModule(featureModule);
}
Also used : BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 44 with BundleModule

use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.

the class AndroidManifestValidatorTest method withMinSdkEqualMaxSdk_ok.

@Test
public void withMinSdkEqualMaxSdk_ok() throws Exception {
    BundleModule module = baseModule(withMaxSdkVersion(5), withMinSdkVersion(5));
    new AndroidManifestValidator().validateModule(module);
}
Also used : BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 45 with BundleModule

use of com.android.tools.build.bundletool.model.BundleModule in project bundletool by google.

the class AndroidManifestValidatorTest method assetModule_withApplication_throws.

@Test
public void assetModule_withApplication_throws() throws Exception {
    BundleModule module = new BundleModuleBuilder("asset_module").setManifest(androidManifestForAssetModule("com.test.app", withOnDemandDelivery(), withApplication())).build();
    Throwable exception = assertThrows(InvalidBundleException.class, () -> new AndroidManifestValidator().validateModule(module));
    assertThat(exception).hasMessageThat().matches("Unexpected element declaration in manifest of asset pack 'asset_module'.");
}
Also used : BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Aggregations

BundleModule (com.android.tools.build.bundletool.model.BundleModule)404 Test (org.junit.Test)370 BundleModuleBuilder (com.android.tools.build.bundletool.testing.BundleModuleBuilder)321 ModuleSplit (com.android.tools.build.bundletool.model.ModuleSplit)158 InvalidBundleException (com.android.tools.build.bundletool.model.exceptions.InvalidBundleException)112 ResourceTableBuilder (com.android.tools.build.bundletool.testing.ResourceTableBuilder)42 ResourceTable (com.android.aapt.Resources.ResourceTable)40 ApkTargeting (com.android.bundle.Targeting.ApkTargeting)29 ImmutableList (com.google.common.collect.ImmutableList)27 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)24 ImmutableSet (com.google.common.collect.ImmutableSet)22 ImmutableSet.toImmutableSet (com.google.common.collect.ImmutableSet.toImmutableSet)21 DensityAlias (com.android.bundle.Targeting.ScreenDensity.DensityAlias)19 AppBundle (com.android.tools.build.bundletool.model.AppBundle)15 ManifestProtoUtils.androidManifest (com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest)15 TestUtils.extractPaths (com.android.tools.build.bundletool.testing.TestUtils.extractPaths)15 Truth.assertThat (com.google.common.truth.Truth.assertThat)15 RunWith (org.junit.runner.RunWith)15 Assets (com.android.bundle.Files.Assets)14 VariantTargeting (com.android.bundle.Targeting.VariantTargeting)14