use of com.android.bundle.Commands.Variant in project bundletool by google.
the class VariantTotalSizeAggregatorTest method splitVariant_singleModule_multipleTargeting_withDimensionsAndDeviceSpec.
@Test
public void splitVariant_singleModule_multipleTargeting_withDimensionsAndDeviceSpec() {
Variant lVariant = createVariant(lPlusVariantTargeting(), createSplitApkSet(/* moduleName= */
"base", createMasterApkDescription(ApkTargeting.getDefaultInstance(), ZipPath.create("base-master.apk")), createApkDescription(apkLanguageTargeting("en"), ZipPath.create("base-en.apk"), /* isMasterSplit= */
false), createApkDescription(apkLanguageTargeting("fr"), ZipPath.create("base-fr.apk"), /* isMasterSplit= */
false), createApkDescription(apkDensityTargeting(LDPI, ImmutableSet.of(MDPI)), ZipPath.create("base-ldpi.apk"), /* isMasterSplit= */
false), createApkDescription(apkDensityTargeting(MDPI, ImmutableSet.of(LDPI)), ZipPath.create("base-mdpi.apk"), /* isMasterSplit= */
false)));
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.<String, Long>builder().put("base-master.apk", 10L).put("base-en.apk", 1L).put("base-fr.apk", 2L).put("base-mdpi.apk", 6L).put("base-ldpi.apk", 3L).build(), BundleToolVersion.getCurrentVersion(), lVariant, getSizeCommand.setDimensions(ImmutableSet.of(LANGUAGE)).setDeviceSpec(mergeSpecs(locales("en"))).build()).getSize();
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setLocale("en").build(), 17L);
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setLocale("en").build(), 14L);
}
use of com.android.bundle.Commands.Variant in project bundletool by google.
the class VariantTotalSizeAggregatorTest method getSize_standaloneVariant_withoutDimensionsAndDeviceSpec.
@Test
public void getSize_standaloneVariant_withoutDimensionsAndDeviceSpec() {
ZipPath apk = ZipPath.create("sample.apk");
Variant variant = standaloneVariant(mergeVariantTargeting(variantSdkTargeting(sdkVersionFrom(1), ImmutableSet.of(sdkVersionFrom(21))), variantAbiTargeting(X86, ImmutableSet.of(ARMEABI_V7A, ARM64_V8A))), ApkTargeting.getDefaultInstance(), apk);
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.of("sample.apk", 10L), BundleToolVersion.getCurrentVersion(), variant, getSizeCommand.build()).getSize();
assertThat(configurationSizes.getMinSizeConfigurationMap()).isEqualTo(configurationSizes.getMaxSizeConfigurationMap());
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 10L);
}
use of com.android.bundle.Commands.Variant in project bundletool by google.
the class VariantTotalSizeAggregatorTest method splitVariant_singleModule_multipleTargeting.
@Test
public void splitVariant_singleModule_multipleTargeting() {
Variant lVariant = createVariant(lPlusVariantTargeting(), createSplitApkSet(/* moduleName= */
"base", createMasterApkDescription(ApkTargeting.getDefaultInstance(), ZipPath.create("base-master.apk")), createApkDescription(apkAbiTargeting(X86, ImmutableSet.of(X86_64)), ZipPath.create("base-x86.apk"), /* isMasterSplit= */
false), createApkDescription(apkAbiTargeting(X86_64, ImmutableSet.of(X86)), ZipPath.create("base-x86_64.apk"), /* isMasterSplit= */
false)));
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.of("base-master.apk", 10L, "base-x86.apk", 4L, "base-x86_64.apk", 6L), BundleToolVersion.getCurrentVersion(), lVariant, getSizeCommand.build()).getSize();
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 16L);
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 14L);
}
use of com.android.bundle.Commands.Variant in project bundletool by google.
the class VariantTotalSizeAggregatorTest method getSize_standaloneVariant_withModules.
@Test
public void getSize_standaloneVariant_withModules() {
ZipPath apk = ZipPath.create("sample.apk");
Variant variant = standaloneVariant(mergeVariantTargeting(variantSdkTargeting(sdkVersionFrom(1), ImmutableSet.of(sdkVersionFrom(21)))), ApkTargeting.getDefaultInstance(), apk);
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.of("sample.apk", 10L), BundleToolVersion.getCurrentVersion(), variant, getSizeCommand.setModules(ImmutableSet.of("base")).build()).getSize();
assertThat(configurationSizes.getMaxSizeConfigurationMap()).isEmpty();
assertThat(configurationSizes.getMinSizeConfigurationMap()).isEmpty();
}
use of com.android.bundle.Commands.Variant in project bundletool by google.
the class VariantTotalSizeAggregatorTest method getSize_standaloneVariant_withDimensionsAndWithoutDeviceSpec.
@Test
public void getSize_standaloneVariant_withDimensionsAndWithoutDeviceSpec() {
ZipPath apk = ZipPath.create("sample.apk");
Variant variant = standaloneVariant(mergeVariantTargeting(variantSdkTargeting(sdkVersionFrom(1), ImmutableSet.of(sdkVersionFrom(21))), variantAbiTargeting(ARMEABI_V7A, ImmutableSet.of(X86, ARM64_V8A)), variantDensityTargeting(XHDPI, ImmutableSet.of(MDPI, LDPI))), ApkTargeting.getDefaultInstance(), apk);
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.of("sample.apk", 20L), BundleToolVersion.getCurrentVersion(), variant, getSizeCommand.setDimensions(ImmutableSet.of(ABI, SCREEN_DENSITY, LANGUAGE, SDK)).build()).getSize();
assertThat(configurationSizes.getMinSizeConfigurationMap()).isEqualTo(configurationSizes.getMaxSizeConfigurationMap());
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setAbi("armeabi-v7a").setScreenDensity("XHDPI").setSdkVersion("1-20").build(), 20L);
}
Aggregations