use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class VariantTotalSizeAggregatorTest method splitVariant_singleModule_multipleTargeting_withDimensions.
@Test
public void splitVariant_singleModule_multipleTargeting_withDimensions() {
Variant lVariant = createVariant(lPlusVariantTargeting(), createSplitApkSet(/* moduleName= */
"base", createMasterApkDescription(ApkTargeting.getDefaultInstance(), ZipPath.create("base-master.apk")), createApkDescription(apkAbiTargeting(ARMEABI, ImmutableSet.of(ARM64_V8A)), ZipPath.create("base-armeabi.apk"), /* isMasterSplit= */
false), createApkDescription(apkAbiTargeting(ARM64_V8A, ImmutableSet.of(ARMEABI)), ZipPath.create("base-arm64_v8a.apk"), /* isMasterSplit= */
false), createApkDescription(apkDensityTargeting(XHDPI, ImmutableSet.of(XXHDPI)), ZipPath.create("base-xhdpi.apk"), /* isMasterSplit= */
false), createApkDescription(apkDensityTargeting(XXHDPI, ImmutableSet.of(XHDPI)), ZipPath.create("base-xxhdpi.apk"), /* isMasterSplit= */
false), createApkDescription(apkLanguageTargeting("en"), ZipPath.create("base-en.apk"), /* isMasterSplit= */
false)));
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.<String, Long>builder().put("base-master.apk", 10L).put("base-armeabi.apk", 4L).put("base-arm64_v8a.apk", 6L).put("base-xhdpi.apk", 2L).put("base-xxhdpi.apk", 3L).put("base-en.apk", 1L).build(), BundleToolVersion.getCurrentVersion(), lVariant, getSizeCommand.setDimensions(ImmutableSet.of(ABI, SCREEN_DENSITY)).build()).getSize();
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setAbi("armeabi").setScreenDensity("XHDPI").build(), 17L, SizeConfiguration.builder().setAbi("armeabi").setScreenDensity("XXHDPI").build(), 18L, SizeConfiguration.builder().setAbi("arm64-v8a").setScreenDensity("XHDPI").build(), 19L, SizeConfiguration.builder().setAbi("arm64-v8a").setScreenDensity("XXHDPI").build(), 20L);
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setAbi("armeabi").setScreenDensity("XHDPI").build(), 17L, SizeConfiguration.builder().setAbi("armeabi").setScreenDensity("XXHDPI").build(), 18L, SizeConfiguration.builder().setAbi("arm64-v8a").setScreenDensity("XHDPI").build(), 19L, SizeConfiguration.builder().setAbi("arm64-v8a").setScreenDensity("XXHDPI").build(), 20L);
}
use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class VariantTotalSizeAggregatorTest method splitVariant_multipleModules_multipleTargeting_withDeviceSpec.
@Test
public void splitVariant_multipleModules_multipleTargeting_withDeviceSpec() {
Variant lVariant = createVariant(lPlusVariantTargeting(), createSplitApkSet(/* moduleName= */
"base", createMasterApkDescription(ApkTargeting.getDefaultInstance(), ZipPath.create("base-master.apk")), createApkDescription(apkAbiTargeting(MIPS, ImmutableSet.of(X86)), ZipPath.create("base-mips.apk"), /* isMasterSplit= */
false), createApkDescription(apkAbiTargeting(X86, ImmutableSet.of(MIPS)), ZipPath.create("base-x86.apk"), /* isMasterSplit= */
false), createApkDescription(apkLanguageTargeting("en"), ZipPath.create("base-en.apk"), /* isMasterSplit= */
false), createApkDescription(apkLanguageTargeting("fr"), ZipPath.create("base-fr.apk"), /* isMasterSplit= */
false)), createSplitApkSet(/* moduleName= */
"feature", createMasterApkDescription(ApkTargeting.getDefaultInstance(), ZipPath.create("feature-master.apk")), createApkDescription(apkDensityTargeting(XHDPI, ImmutableSet.of(XXHDPI)), ZipPath.create("feature-xhdpi.apk"), /* isMasterSplit= */
false), createApkDescription(apkDensityTargeting(XXHDPI, ImmutableSet.of(XHDPI)), ZipPath.create("feature-xxhdpi.apk"), /* isMasterSplit= */
false)));
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.<String, Long>builder().put("base-master.apk", 10L).put("base-mips.apk", 3L).put("base-x86.apk", 4L).put("base-en.apk", 1L).put("base-fr.apk", 2L).put("feature-master.apk", 15L).put("feature-xhdpi.apk", 6L).put("feature-xxhdpi.apk", 5L).build(), BundleToolVersion.getCurrentVersion(), lVariant, getSizeCommand.setDeviceSpec(mergeSpecs(density(XHDPI), abis("mips"))).build()).getSize();
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), // 10+3+2+15+6
36L);
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), // 10+3+1+15+6
35L);
}
use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class VariantTotalSizeAggregatorTest method splitVariant_singleModule_multipleTargeting_withDifferentDimensionsAndDeviceSpec.
@Test
public void splitVariant_singleModule_multipleTargeting_withDifferentDimensionsAndDeviceSpec() {
Variant lVariant = createVariant(lPlusVariantTargeting(), createSplitApkSet(/* moduleName= */
"base", createMasterApkDescription(ApkTargeting.getDefaultInstance(), ZipPath.create("base-master.apk")), createApkDescription(apkLanguageTargeting("jp"), ZipPath.create("base-jp.apk"), /* isMasterSplit= */
false), createApkDescription(apkLanguageTargeting("en-US"), ZipPath.create("base-en-US.apk"), /* isMasterSplit= */
false), createApkDescription(apkDensityTargeting(XHDPI, ImmutableSet.of(XXHDPI)), ZipPath.create("base-xhdpi.apk"), /* isMasterSplit= */
false), createApkDescription(apkDensityTargeting(XXHDPI, ImmutableSet.of(XHDPI)), ZipPath.create("base-xxhdpi.apk"), /* isMasterSplit= */
false), 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.<String, Long>builder().put("base-master.apk", 10L).put("base-jp.apk", 1L).put("base-en-US.apk", 2L).put("base-xhdpi.apk", 6L).put("base-xxhdpi.apk", 3L).put("base-x86.apk", 4L).put("base-x86_64.apk", 5L).build(), BundleToolVersion.getCurrentVersion(), lVariant, getSizeCommand.setDimensions(ImmutableSet.of(SCREEN_DENSITY, SDK)).setDeviceSpec(mergeSpecs(locales("jp"), abis("x86"))).build()).getSize();
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setSdkVersion("21-").setScreenDensity("XHDPI").build(), 21L, SizeConfiguration.builder().setSdkVersion("21-").setScreenDensity("XXHDPI").build(), 18L);
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setSdkVersion("21-").setScreenDensity("XHDPI").build(), 21L, SizeConfiguration.builder().setSdkVersion("21-").setScreenDensity("XXHDPI").build(), 18L);
}
use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class VariantTotalSizeAggregatorTest method getSize_standaloneVariant_withDeviceSpecAndWithoutDimensions.
@Test
public void getSize_standaloneVariant_withDeviceSpecAndWithoutDimensions() {
ZipPath apk = ZipPath.create("sample.apk");
Variant variant = standaloneVariant(mergeVariantTargeting(variantSdkTargeting(sdkVersionFrom(1), ImmutableSet.of(sdkVersionFrom(21))), variantAbiTargeting(MIPS), variantDensityTargeting(LDPI, ImmutableSet.of(XXXHDPI))), ApkTargeting.getDefaultInstance(), apk);
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.of("sample.apk", 15L), BundleToolVersion.getCurrentVersion(), variant, getSizeCommand.setDeviceSpec(mergeSpecs(locales("jp"), abis("mips"))).build()).getSize();
assertThat(configurationSizes.getMinSizeConfigurationMap()).isEqualTo(configurationSizes.getMaxSizeConfigurationMap());
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 15L);
}
use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class VariantTotalSizeAggregatorTest method instantVariant_multipleModules_withInstantVariant.
@Test
public void instantVariant_multipleModules_withInstantVariant() {
// Instant variants only have instant split APKs.
Variant lVariant = createVariant(lPlusVariantTargeting(), createInstantApkSet(/* moduleName= */
"base", ApkTargeting.getDefaultInstance(), ZipPath.create("base-master.apk")), createInstantApkSet(/* moduleName= */
"feature", ApkTargeting.getDefaultInstance(), ZipPath.create("feature-master.apk")), createInstantApkSet(/* moduleName= */
"feature1", ApkTargeting.getDefaultInstance(), ZipPath.create("feature1-master.apk")));
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.<String, Long>builder().put("base-master.apk", 10L).put("feature-master.apk", 15L).put("feature1-master.apk", 6L).build(), BundleToolVersion.getCurrentVersion(), lVariant, getSizeCommand.setInstant(true).build()).getSize();
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 31L);
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 31L);
}
Aggregations