use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class AssetModuleSizeAggregatorTest method getSize_multipleAssetModules_withDeviceSpecAndVariantTargeting.
@Test
public void getSize_multipleAssetModules_withDeviceSpecAndVariantTargeting() throws Exception {
ImmutableList<AssetSliceSet> assetModules = ImmutableList.of(ASSET_MODULE_1, ASSET_MODULE_2);
VariantTargeting variantTargeting = variantTextureTargeting(ETC2);
ConfigurationSizes configurationSizes = new AssetModuleSizeAggregator(assetModules, variantTargeting, SIZE_BY_APK_PATHS, getSizeCommand.setDimensions(ImmutableSet.of(TEXTURE_COMPRESSION_FORMAT, SDK)).setDeviceSpec(sdkVersion(21)).build()).getSize();
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setTextureCompressionFormat("etc2").setSdkVersion("21").build(), ASSET_1_MASTER_SIZE + ASSET_1_ETC2_SIZE + ASSET_2_MASTER_SIZE + ASSET_2_ETC2_SIZE);
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setTextureCompressionFormat("etc2").setSdkVersion("21").build(), ASSET_1_MASTER_SIZE + ASSET_1_ETC2_SIZE + ASSET_2_MASTER_SIZE + ASSET_2_ETC2_SIZE);
}
use of com.android.tools.build.bundletool.model.ConfigurationSizes 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.tools.build.bundletool.model.ConfigurationSizes 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.tools.build.bundletool.model.ConfigurationSizes 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.tools.build.bundletool.model.ConfigurationSizes 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();
}
Aggregations