Search in sources :

Example 1 with SplitDimension

use of com.android.bundle.Config.SplitDimension in project bundletool by google.

the class ModuleSplitterForShards method stripAssetsWithTargeting.

private static ModuleSplit stripAssetsWithTargeting(ModuleSplit split, ImmutableList<SplitDimension> dimensionsToStrip) {
    for (SplitDimension dimension : dimensionsToStrip) {
        checkArgument(SUFFIX_STRIPPING_DIMENSIONS.contains(dimension.getValue()));
        split = SuffixStripper.createForDimension(dimension.getValue()).applySuffixStripping(split, dimension.getSuffixStripping());
    }
    return split;
}
Also used : SplitDimension(com.android.bundle.Config.SplitDimension)

Example 2 with SplitDimension

use of com.android.bundle.Config.SplitDimension in project bundletool by google.

the class TextureCompressionFormatParityValidator method validateBundle.

@Override
public void validateBundle(AppBundle bundle) {
    BundleConfig bundleConfig = bundle.getBundleConfig();
    Optimizations optimizations = bundleConfig.getOptimizations();
    List<SplitDimension> splitDimensions = optimizations.getSplitsConfig().getSplitDimensionList();
    Optional<String> tcfDefaultSuffix = splitDimensions.stream().filter(dimension -> dimension.getValue().equals(Value.TEXTURE_COMPRESSION_FORMAT)).map(dimension -> dimension.getSuffixStripping().getDefaultSuffix()).collect(toOptional());
    if (tcfDefaultSuffix.isPresent()) {
        // Get the default texture compression format targeting, or an empty optional if fallback
        // must be used.
        Optional<TextureCompressionFormatTargeting> defaultTextureCompressionFormat = Optional.ofNullable(TextureCompressionUtils.TEXTURE_TO_TARGETING.get(tcfDefaultSuffix.get()));
        validateFormatSupportedByAllModules(bundle, defaultTextureCompressionFormat);
    }
}
Also used : MoreCollectors.toOptional(com.google.common.collect.MoreCollectors.toOptional) ImmutableSet(com.google.common.collect.ImmutableSet) Value(com.android.bundle.Config.SplitDimension.Value) Optimizations(com.android.bundle.Config.Optimizations) InvalidBundleException(com.android.tools.build.bundletool.model.exceptions.InvalidBundleException) TargetedDirectory(com.android.tools.build.bundletool.model.targeting.TargetedDirectory) TargetingDimension(com.android.tools.build.bundletool.model.targeting.TargetingDimension) List(java.util.List) TextureCompressionUtils(com.android.tools.build.bundletool.model.utils.TextureCompressionUtils) ImmutableList(com.google.common.collect.ImmutableList) BundleConfig(com.android.bundle.Config.BundleConfig) SplitDimension(com.android.bundle.Config.SplitDimension) AssetsDirectoryTargeting(com.android.bundle.Targeting.AssetsDirectoryTargeting) TextureCompressionFormatTargeting(com.android.bundle.Targeting.TextureCompressionFormatTargeting) AutoValue(com.google.auto.value.AutoValue) Optional(java.util.Optional) TargetingUtils.extractTextureCompressionFormats(com.android.tools.build.bundletool.model.targeting.TargetingUtils.extractTextureCompressionFormats) TextureCompressionFormatAlias(com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias) TargetingUtils.extractAssetsTargetedDirectories(com.android.tools.build.bundletool.model.targeting.TargetingUtils.extractAssetsTargetedDirectories) AppBundle(com.android.tools.build.bundletool.model.AppBundle) BundleModule(com.android.tools.build.bundletool.model.BundleModule) BundleConfig(com.android.bundle.Config.BundleConfig) SplitDimension(com.android.bundle.Config.SplitDimension) TextureCompressionFormatTargeting(com.android.bundle.Targeting.TextureCompressionFormatTargeting) Optimizations(com.android.bundle.Config.Optimizations)

Aggregations

SplitDimension (com.android.bundle.Config.SplitDimension)2 BundleConfig (com.android.bundle.Config.BundleConfig)1 Optimizations (com.android.bundle.Config.Optimizations)1 Value (com.android.bundle.Config.SplitDimension.Value)1 AssetsDirectoryTargeting (com.android.bundle.Targeting.AssetsDirectoryTargeting)1 TextureCompressionFormatAlias (com.android.bundle.Targeting.TextureCompressionFormat.TextureCompressionFormatAlias)1 TextureCompressionFormatTargeting (com.android.bundle.Targeting.TextureCompressionFormatTargeting)1 AppBundle (com.android.tools.build.bundletool.model.AppBundle)1 BundleModule (com.android.tools.build.bundletool.model.BundleModule)1 InvalidBundleException (com.android.tools.build.bundletool.model.exceptions.InvalidBundleException)1 TargetedDirectory (com.android.tools.build.bundletool.model.targeting.TargetedDirectory)1 TargetingDimension (com.android.tools.build.bundletool.model.targeting.TargetingDimension)1 TargetingUtils.extractAssetsTargetedDirectories (com.android.tools.build.bundletool.model.targeting.TargetingUtils.extractAssetsTargetedDirectories)1 TargetingUtils.extractTextureCompressionFormats (com.android.tools.build.bundletool.model.targeting.TargetingUtils.extractTextureCompressionFormats)1 TextureCompressionUtils (com.android.tools.build.bundletool.model.utils.TextureCompressionUtils)1 AutoValue (com.google.auto.value.AutoValue)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 MoreCollectors.toOptional (com.google.common.collect.MoreCollectors.toOptional)1 List (java.util.List)1