use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class AssetModuleSizeAggregatorTest method getSize_singleAssetModule_noTargeting.
@Test
public void getSize_singleAssetModule_noTargeting() throws Exception {
ImmutableList<AssetSliceSet> assetModules = ImmutableList.of(createAssetSliceSet("asset1", DeliveryType.INSTALL_TIME, createMasterApkDescription(ApkTargeting.getDefaultInstance(), ZipPath.create("asset1-master.apk"))));
VariantTargeting variantTargeting = VariantTargeting.getDefaultInstance();
ImmutableMap<String, Long> sizeByApkPaths = ImmutableMap.of("asset1-master.apk", 10L);
ConfigurationSizes configurationSizes = new AssetModuleSizeAggregator(assetModules, variantTargeting, sizeByApkPaths, getSizeCommand.build()).getSize();
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 10L);
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 10L);
}
use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class AssetModuleSizeAggregatorTest method getSize_multipleAssetModules_withTargeting.
@Test
public void getSize_multipleAssetModules_withTargeting() throws Exception {
ImmutableList<AssetSliceSet> assetModules = ImmutableList.of(ASSET_MODULE_1, ASSET_MODULE_2);
VariantTargeting variantTargeting = variantSdkTargeting(21);
ConfigurationSizes configurationSizes = new AssetModuleSizeAggregator(assetModules, variantTargeting, SIZE_BY_APK_PATHS, getSizeCommand.setDimensions(ImmutableSet.of(TEXTURE_COMPRESSION_FORMAT)).build()).getSize();
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setTextureCompressionFormat("etc2").build(), ASSET_1_MASTER_SIZE + ASSET_1_ETC2_SIZE + ASSET_2_MASTER_SIZE + ASSET_2_ETC2_SIZE, SizeConfiguration.builder().setTextureCompressionFormat("astc").build(), ASSET_1_MASTER_SIZE + ASSET_1_ASTC_SIZE + ASSET_2_MASTER_SIZE + ASSET_2_ASTC_SIZE);
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setTextureCompressionFormat("etc2").build(), ASSET_1_MASTER_SIZE + ASSET_1_ETC2_SIZE + ASSET_2_MASTER_SIZE + ASSET_2_ETC2_SIZE, SizeConfiguration.builder().setTextureCompressionFormat("astc").build(), ASSET_1_MASTER_SIZE + ASSET_1_ASTC_SIZE + ASSET_2_MASTER_SIZE + ASSET_2_ASTC_SIZE);
}
use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class AssetModuleSizeAggregatorTest method getSize_noAssetModules.
@Test
public void getSize_noAssetModules() throws Exception {
ConfigurationSizes configurationSizes = new AssetModuleSizeAggregator(ImmutableList.of(), VariantTargeting.getDefaultInstance(), ImmutableMap.of(), getSizeCommand.build()).getSize();
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 0L);
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 0L);
}
use of com.android.tools.build.bundletool.model.ConfigurationSizes in project bundletool by google.
the class VariantTotalSizeAggregatorTest method splitVariant_singleModule_SingleTargeting.
@Test
public void splitVariant_singleModule_SingleTargeting() {
Variant lVariant = createVariant(lPlusVariantTargeting(), createSplitApkSet(/* moduleName= */
"base", createMasterApkDescription(ApkTargeting.getDefaultInstance(), ZipPath.create("base-master.apk"))));
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.of("base-master.apk", 10L), BundleToolVersion.getCurrentVersion(), lVariant, getSizeCommand.build()).getSize();
assertThat(configurationSizes.getMaxSizeConfigurationMap()).containsExactly(SizeConfiguration.getDefaultInstance(), 10L);
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 getSize_standaloneVariants_withAllDeviceSpecAndDimensions.
@Test
public void getSize_standaloneVariants_withAllDeviceSpecAndDimensions() {
ZipPath apk = ZipPath.create("sample.apk");
Variant variant = standaloneVariant(mergeVariantTargeting(variantSdkTargeting(sdkVersionFrom(15), ImmutableSet.of(sdkVersionFrom(21))), variantAbiTargeting(ARM64_V8A, ImmutableSet.of(X86)), variantDensityTargeting(MDPI, ImmutableSet.of(XXHDPI, XXXHDPI))), ApkTargeting.getDefaultInstance(), apk);
ConfigurationSizes configurationSizes = new VariantTotalSizeAggregator(ImmutableMap.of("sample.apk", 11L), BundleToolVersion.getCurrentVersion(), variant, getSizeCommand.setDimensions(ImmutableSet.of(ABI, SCREEN_DENSITY, LANGUAGE, SDK)).setDeviceSpec(mergeSpecs(locales("fr", "jp"), abis("arm64-v8a", "mips"), density(MDPI), sdkVersion(15))).build()).getSize();
assertThat(configurationSizes.getMinSizeConfigurationMap()).isEqualTo(configurationSizes.getMaxSizeConfigurationMap());
assertThat(configurationSizes.getMinSizeConfigurationMap()).containsExactly(SizeConfiguration.builder().setSdkVersion("15").setScreenDensity("160").setLocale("fr,jp").setAbi("arm64-v8a,mips").build(), 11L);
}
Aggregations