use of com.android.bundle.Targeting.ApkTargeting in project bundletool by google.
the class MergingUtilsTest method mergeShardTargetings_differentDensities_ok.
@Test
public void mergeShardTargetings_differentDensities_ok() {
ApkTargeting targeting1 = apkDensityTargeting(DensityAlias.MDPI, ImmutableSet.of(DensityAlias.HDPI, DensityAlias.LDPI));
ApkTargeting targeting2 = apkDensityTargeting(DensityAlias.HDPI, ImmutableSet.of(DensityAlias.MDPI, DensityAlias.LDPI));
ApkTargeting merged = MergingUtils.mergeShardTargetings(targeting1, targeting2);
assertThat(merged).ignoringRepeatedFieldOrder().isEqualTo(apkDensityTargeting(ImmutableSet.of(DensityAlias.MDPI, DensityAlias.HDPI), ImmutableSet.of(DensityAlias.LDPI)));
}
use of com.android.bundle.Targeting.ApkTargeting in project bundletool by google.
the class MergingUtilsTest method mergeShardTargetings_defaultInstances_ok.
@Test
public void mergeShardTargetings_defaultInstances_ok() {
ApkTargeting targeting = ApkTargeting.getDefaultInstance();
ApkTargeting merged = MergingUtils.mergeShardTargetings(targeting, targeting);
assertThat(merged).isEqualTo(targeting);
assertThat(merged.hasAbiTargeting()).isFalse();
assertThat(merged.hasScreenDensityTargeting()).isFalse();
}
use of com.android.bundle.Targeting.ApkTargeting in project bundletool by google.
the class MergingUtilsTest method mergeShardTargetings_equalDeviceTier_ok.
@Test
public void mergeShardTargetings_equalDeviceTier_ok() {
ApkTargeting targeting = apkDeviceTierTargeting(deviceTierTargeting(0, ImmutableList.of(1)));
assertThat(MergingUtils.mergeShardTargetings(targeting, targeting)).isEqualTo(targeting);
}
use of com.android.bundle.Targeting.ApkTargeting in project bundletool by google.
the class MergingUtilsTest method mergeShardTargetings_differentLanguages_ok.
@Test
public void mergeShardTargetings_differentLanguages_ok() {
ApkTargeting targeting1 = apkAlternativeLanguageTargeting("en", "jp");
ApkTargeting targeting2 = apkLanguageTargeting("fr");
assertThat(MergingUtils.mergeShardTargetings(targeting1, targeting2)).isEqualTo(apkLanguageTargeting(ImmutableSet.of("fr"), ImmutableSet.of("en", "jp")));
}
use of com.android.bundle.Targeting.ApkTargeting in project bundletool by google.
the class TargetingUtils method standaloneApkVariantTargeting.
public static VariantTargeting standaloneApkVariantTargeting(ModuleSplit standaloneApk) {
ApkTargeting apkTargeting = standaloneApk.getApkTargeting();
VariantTargeting.Builder variantTargeting = sdkVariantTargeting(standaloneApk.getAndroidManifest().getEffectiveMinSdkVersion()).toBuilder();
if (apkTargeting.hasAbiTargeting()) {
variantTargeting.setAbiTargeting(apkTargeting.getAbiTargeting());
}
if (apkTargeting.hasScreenDensityTargeting()) {
variantTargeting.setScreenDensityTargeting(apkTargeting.getScreenDensityTargeting());
}
if (apkTargeting.hasMultiAbiTargeting()) {
variantTargeting.setMultiAbiTargeting(apkTargeting.getMultiAbiTargeting());
}
if (apkTargeting.hasTextureCompressionFormatTargeting()) {
variantTargeting.setTextureCompressionFormatTargeting(apkTargeting.getTextureCompressionFormatTargeting());
}
return variantTargeting.build();
}
Aggregations