use of com.android.bundle.Targeting.ModuleTargeting in project bundletool by google.
the class ModuleConditionsTest method toTargeting_mixedConditions.
@Test
public void toTargeting_mixedConditions() {
ModuleConditions moduleConditions = ModuleConditions.builder().addDeviceFeatureCondition(DeviceFeatureCondition.create("com.feature1")).addDeviceFeatureCondition(DeviceFeatureCondition.create("com.feature2")).setMinSdkVersion(24).setUserCountriesCondition(UserCountriesCondition.create(ImmutableList.of("FR"), /* exclude= */
false)).setDeviceGroupsCondition(DeviceGroupsCondition.create(ImmutableSet.of("group1"))).build();
ModuleTargeting moduleTargeting = moduleConditions.toTargeting();
assertThat(moduleTargeting).ignoringRepeatedFieldOrder().isEqualTo(mergeModuleTargeting(moduleFeatureTargeting("com.feature1"), moduleFeatureTargeting("com.feature2"), moduleMinSdkVersionTargeting(24), moduleIncludeCountriesTargeting("FR"), moduleDeviceGroupsTargeting("group1")));
}
use of com.android.bundle.Targeting.ModuleTargeting in project bundletool by google.
the class BundleModuleTest method moduleTargeting_moduleMinSdkVersion_minSdkConditionPreferred.
@Test
public void moduleTargeting_moduleMinSdkVersion_minSdkConditionPreferred() {
BundleModule bundleModule = createMinimalModuleBuilder().setAndroidManifestProto(androidManifest("com.test.app", withMinSdkVersion(24), withMinSdkCondition(28), withFeatureCondition("com.feature1"))).build();
ModuleTargeting moduleTargeting = bundleModule.getModuleMetadata().getTargeting();
assertThat(moduleTargeting).ignoringRepeatedFieldOrder().isEqualTo(mergeModuleTargeting(moduleFeatureTargeting("com.feature1"), moduleMinSdkVersionTargeting(28)));
}
use of com.android.bundle.Targeting.ModuleTargeting in project bundletool by google.
the class BundleModuleTest method moduleTargeting_moduleMinSdkVersionInherited.
@Test
public void moduleTargeting_moduleMinSdkVersionInherited() {
BundleModule bundleModule = createMinimalModuleBuilder().setAndroidManifestProto(androidManifest("com.test.app", withMinSdkVersion(24), withFeatureCondition("com.feature1"))).build();
ModuleTargeting moduleTargeting = bundleModule.getModuleMetadata().getTargeting();
assertThat(moduleTargeting).ignoringRepeatedFieldOrder().isEqualTo(mergeModuleTargeting(moduleFeatureTargeting("com.feature1"), moduleMinSdkVersionTargeting(24)));
}
Aggregations