Search in sources :

Example 61 with ResourceTableBuilder

use of com.android.tools.build.bundletool.testing.ResourceTableBuilder in project bundletool by google.

the class SystemApksGeneratorTest method shardByAbiAndDensity_multipleLanguageResourceAndDeviceSpecMissingLanguage_fallsBackToDefault.

@Test
public void shardByAbiAndDensity_multipleLanguageResourceAndDeviceSpecMissingLanguage_fallsBackToDefault() throws Exception {
    BundleModule bundleModule = new BundleModuleBuilder("base").addFile("dex/classes.dex").addFile("lib/x86/libtest.so").addFile("root/license.dat").addFile("assets/languages#lang_es/image.jpg").addFile("assets/languages#lang_fr/image.jpg").addFile("assets/languages/image.jpg").setManifest(androidManifest("com.test.app")).setNativeConfig(nativeLibraries(targetedNativeDirectory("lib/x86", nativeDirectoryTargeting(X86)))).setAssetsConfig(assets(targetedAssetsDirectory("assets/languages#lang_es", assetsDirectoryTargeting(languageTargeting("es"))), targetedAssetsDirectory("assets/languages#lang_fr", assetsDirectoryTargeting(languageTargeting("fr"))), targetedAssetsDirectory("assets/languages", assetsDirectoryTargeting(alternativeLanguageTargeting("es", "fr"))))).setResourceTable(new ResourceTableBuilder().addPackage("com.test.app").addStringResourceForMultipleLocales("text", ImmutableMap.of(/* default locale */
    "", "hello", "es", "hola", "fr", "bonjour")).build()).build();
    ImmutableList<ModuleSplit> shards = systemApksGenerator.generateSystemApks(/* modules= */
    ImmutableList.of(bundleModule), /* modulesToFuse= */
    ImmutableSet.of(BASE_MODULE_NAME), splitOptimizations(OptimizationDimension.ABI, OptimizationDimension.SCREEN_DENSITY, OptimizationDimension.LANGUAGE));
    ModuleSplit fatShard = getSystemImageSplit(shards);
    assertThat(fatShard.getApkTargeting()).isEqualTo(mergeApkTargeting(apkAbiTargeting(X86), apkAlternativeLanguageTargeting("es", "fr")));
    assertThat(fatShard.getApkTargeting().getAbiTargeting()).isEqualTo(abiTargeting(X86));
    assertThat(fatShard.getApkTargeting().getScreenDensityTargeting()).isEqualToDefaultInstance();
    assertThat(fatShard.getVariantTargeting()).isEqualTo(mergeVariantTargeting(variantMinSdkTargeting(1), variantAbiTargeting(X86)));
    assertThat(fatShard.getSplitType()).isEqualTo(SplitType.SYSTEM);
    assertThat(fatShard.getResourceTable().get()).isEqualTo(new ResourceTableBuilder().addPackage("com.test.app").addStringResourceForMultipleLocales("text", ImmutableMap.of(/* default locale */
    "", "hello")).build());
    assertThat(extractPaths(fatShard.getEntries())).containsExactly("dex/classes.dex", "lib/x86/libtest.so", "root/license.dat", "assets/languages/image.jpg");
    ImmutableMap<LanguageTargeting, ModuleSplit> splitLanguageTargetingMap = Maps.uniqueIndex(getAdditionalSplits(shards), split -> split.getApkTargeting().getLanguageTargeting());
    assertThat(splitLanguageTargetingMap.keySet()).containsExactly(languageTargeting("es"), languageTargeting("fr"));
    ModuleSplit esLangShard = splitLanguageTargetingMap.get(languageTargeting("es"));
    assertThat(esLangShard.getApkTargeting()).isEqualTo(apkLanguageTargeting("es"));
    assertThat(esLangShard.getSplitType()).isEqualTo(SplitType.SYSTEM);
    assertThat(esLangShard.getResourceTable().get()).isEqualTo(new ResourceTableBuilder().addPackage("com.test.app").addStringResourceForMultipleLocales("text", ImmutableMap.of("es", "hola")).build());
    assertThat(extractPaths(esLangShard.getEntries())).containsExactly("assets/languages#lang_es/image.jpg");
    ModuleSplit frLangShard = splitLanguageTargetingMap.get(languageTargeting("fr"));
    assertThat(frLangShard.getApkTargeting()).isEqualTo(apkLanguageTargeting("fr"));
    assertThat(frLangShard.getSplitType()).isEqualTo(SplitType.SYSTEM);
    assertThat(frLangShard.getResourceTable().get()).isEqualTo(new ResourceTableBuilder().addPackage("com.test.app").addStringResourceForMultipleLocales("text", ImmutableMap.of("fr", "bonjour")).build());
    assertThat(extractPaths(frLangShard.getEntries())).containsExactly("assets/languages#lang_fr/image.jpg");
}
Also used : TargetingUtils.alternativeLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.alternativeLanguageTargeting) LanguageTargeting(com.android.bundle.Targeting.LanguageTargeting) TargetingUtils.apkLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkLanguageTargeting) TargetingUtils.apkAlternativeLanguageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkAlternativeLanguageTargeting) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 62 with ResourceTableBuilder

use of com.android.tools.build.bundletool.testing.ResourceTableBuilder in project bundletool by google.

the class LocaleConfigXmlInjectorTest method process_noLanguageTargeting.

@Test
public void process_noLanguageTargeting() throws Exception {
    ModuleSplit baseMasterSplit = createModuleSplit(new ResourceTableBuilder().addPackage("com.example.app.module").build(), BASE_MODULE_NAME.getName(), /* masterSplit= */
    true, SPLIT, /* languageTargeting= */
    null);
    ModuleSplit otherSplit = createModuleSplit(new ResourceTableBuilder().addPackage("com.example.app.module").build(), BASE_MODULE_NAME.getName(), /* masterSplit= */
    false, SPLIT, /* languageTargeting= */
    null);
    ModuleSplit processedBaseMasterSplit = localeConfigXmlInjector.process(VariantKey.create(baseMasterSplit), ImmutableList.of(baseMasterSplit, otherSplit)).stream().filter(split -> split.isMasterSplit() && split.isBaseModuleSplit()).collect(onlyElement());
    assertThat(processedBaseMasterSplit.getAndroidManifest().hasLocaleConfig()).isFalse();
    assertThat(processedBaseMasterSplit.getResourceTable().get()).doesNotContainResource("com.example.app.module:xml/locales_config");
}
Also used : Arrays(java.util.Arrays) ApkTargeting(com.android.bundle.Targeting.ApkTargeting) BundleModuleName(com.android.tools.build.bundletool.model.BundleModuleName) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) VariantKey(com.android.tools.build.bundletool.model.VariantKey) XmlProtoNode(com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoNode) RunWith(org.junit.runner.RunWith) AndroidManifest(com.android.tools.build.bundletool.model.AndroidManifest) XmlProtoAttributeBuilder(com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoAttributeBuilder) BASE_MODULE_NAME(com.android.tools.build.bundletool.model.BundleModuleName.BASE_MODULE_NAME) MoreCollectors.onlyElement(com.google.common.collect.MoreCollectors.onlyElement) TruthResourceTable.assertThat(com.android.tools.build.bundletool.testing.truth.resources.TruthResourceTable.assertThat) HashSet(java.util.HashSet) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) ImmutableList(com.google.common.collect.ImmutableList) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) Theories(org.junit.experimental.theories.Theories) TargetingUtils.languageTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.languageTargeting) SYSTEM(com.android.tools.build.bundletool.model.ModuleSplit.SplitType.SYSTEM) ResourceTable(com.android.aapt.Resources.ResourceTable) VariantTargeting(com.android.bundle.Targeting.VariantTargeting) Nullable(javax.annotation.Nullable) Before(org.junit.Before) XmlProtoElementBuilder(com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElementBuilder) ImmutableMap(com.google.common.collect.ImmutableMap) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Test(org.junit.Test) Truth.assertThat(com.google.common.truth.Truth.assertThat) LanguageTargeting(com.android.bundle.Targeting.LanguageTargeting) SplitType(com.android.tools.build.bundletool.model.ModuleSplit.SplitType) XmlNode(com.android.aapt.Resources.XmlNode) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) ExtensionRegistry(com.google.protobuf.ExtensionRegistry) SPLIT(com.android.tools.build.bundletool.model.ModuleSplit.SplitType.SPLIT) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) Test(org.junit.Test)

Example 63 with ResourceTableBuilder

use of com.android.tools.build.bundletool.testing.ResourceTableBuilder in project bundletool by google.

the class ResourcesUtilsTest method lookupEntryByResourceId_negativeId.

@Test
public void lookupEntryByResourceId_negativeId() {
    ResourceTable resourceTable = new ResourceTableBuilder().addPackage("com.test.app", 0x7F).addXmlResource("layout", "res/xml/not-the-layout-we-want.xml").addPackage("com.test.app.split", 0x80).addXmlResource("layout", "res/xml/layout.xml").addStringResource("hello", "res/string/hello.xml").addStringResource("world", "res/string/world.xml").build();
    Optional<Entry> layoutResource = ResourcesUtils.lookupEntryByResourceId(resourceTable, 0x80010000);
    assertThat(layoutResource).isPresent();
    assertThat(extractFilePathValues(layoutResource.get())).containsExactly("res/xml/layout.xml");
    Optional<Entry> helloResource = ResourcesUtils.lookupEntryByResourceId(resourceTable, 0x80020000);
    assertThat(helloResource).isPresent();
    assertThat(extractStringValues(helloResource.get())).containsExactly("res/string/hello.xml");
    Optional<Entry> worldResource = ResourcesUtils.lookupEntryByResourceId(resourceTable, 0x80020001);
    assertThat(worldResource).isPresent();
    assertThat(extractStringValues(worldResource.get())).containsExactly("res/string/world.xml");
}
Also used : Entry(com.android.aapt.Resources.Entry) ResourceTableEntry(com.android.tools.build.bundletool.model.ResourceTableEntry) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) ResourceTable(com.android.aapt.Resources.ResourceTable) Test(org.junit.Test)

Example 64 with ResourceTableBuilder

use of com.android.tools.build.bundletool.testing.ResourceTableBuilder in project bundletool by google.

the class ScreenDensityResourcesSplitterTest method manifestMutatorToRequireSplits_registered_whenDensityResourcesPresent.

@Test
public void manifestMutatorToRequireSplits_registered_whenDensityResourcesPresent() throws Exception {
    BundleModule testModule = new BundleModuleBuilder("testModule").addFile("res/drawable-mdpi/image.jpg").addFile("res/drawable-hdpi/image.jpg").setResourceTable(new ResourceTableBuilder().addPackage("com.test.app").addDrawableResourceForMultipleDensities("image", ImmutableMap.of(MDPI_VALUE, "res/drawable-ldpi/image.jpg", HDPI_VALUE, "res/drawable-dpi/image.jpg")).build()).setManifest(androidManifest("com.test.app")).build();
    ImmutableCollection<ModuleSplit> densitySplits = splitter.split(ModuleSplit.forResources(testModule));
    ImmutableList<ModuleSplit> configSplits = densitySplits.stream().filter(split -> !split.isMasterSplit()).collect(toImmutableList());
    assertThat(configSplits).isNotEmpty();
    for (ModuleSplit configSplit : configSplits) {
        assertThat(compareManifestMutators(configSplit.getMasterManifestMutators(), withSplitsRequired(true))).isTrue();
    }
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) ImmutableCollection(com.google.common.collect.ImmutableCollection) MoreCollectors.onlyElement(com.google.common.collect.MoreCollectors.onlyElement) ManifestMutator.withSplitsRequired(com.android.tools.build.bundletool.model.ManifestMutator.withSplitsRequired) Item(com.android.aapt.Resources.Item) LDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.LDPI_VALUE) TVDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.TVDPI) ResourceId(com.android.tools.build.bundletool.model.ResourceId) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) ResourcesTableFactory.entry(com.android.tools.build.bundletool.testing.ResourcesTableFactory.entry) DensityAlias(com.android.bundle.Targeting.ScreenDensity.DensityAlias) Version(com.android.tools.build.bundletool.model.version.Version) ResourcesTableFactory.type(com.android.tools.build.bundletool.testing.ResourcesTableFactory.type) XXHDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.XXHDPI) ResourceTable(com.android.aapt.Resources.ResourceTable) Theory(org.junit.experimental.theories.Theory) BundleToolVersion(com.android.tools.build.bundletool.model.version.BundleToolVersion) ImmutableSet(com.google.common.collect.ImmutableSet) ConfigValue(com.android.aapt.Resources.ConfigValue) ImmutableMap(com.google.common.collect.ImmutableMap) XXXHDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.XXXHDPI) Predicate(java.util.function.Predicate) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Collection(java.util.Collection) DEFAULT_DENSITY_BUCKETS(com.android.tools.build.bundletool.splitters.ScreenDensityResourcesSplitter.DEFAULT_DENSITY_BUCKETS) ResourcesTableFactory.sdk(com.android.tools.build.bundletool.testing.ResourcesTableFactory.sdk) XXXHDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.XXXHDPI_VALUE) Collectors(java.util.stream.Collectors) ScreenDensity(com.android.bundle.Targeting.ScreenDensity) Sets(com.google.common.collect.Sets) FromDataPoints(org.junit.experimental.theories.FromDataPoints) ByteString(com.google.protobuf.ByteString) List(java.util.List) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) Optional(java.util.Optional) DataPoints(org.junit.experimental.theories.DataPoints) DEFAULT_DENSITY_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.DEFAULT_DENSITY_VALUE) MDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.MDPI) Value(com.android.aapt.Resources.Value) RunWith(org.junit.runner.RunWith) MDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.MDPI_VALUE) TestUtils.extractPaths(com.android.tools.build.bundletool.testing.TestUtils.extractPaths) ResourcesTableFactory.resourceTable(com.android.tools.build.bundletool.testing.ResourcesTableFactory.resourceTable) TruthResourceTable.assertThat(com.android.tools.build.bundletool.testing.truth.resources.TruthResourceTable.assertThat) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) ImmutableList(com.google.common.collect.ImmutableList) Theories(org.junit.experimental.theories.Theories) TVDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.TVDPI_VALUE) ResourcesTableFactory.mergeConfigs(com.android.tools.build.bundletool.testing.ResourcesTableFactory.mergeConfigs) Truth8(com.google.common.truth.Truth8) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) Predicates(com.google.common.base.Predicates) ResourcesTableFactory.pkg(com.android.tools.build.bundletool.testing.ResourcesTableFactory.pkg) Truth8.assertThat(com.google.common.truth.Truth8.assertThat) ResourcesTableFactory._560DPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory._560DPI) ManifestProtoUtils.compareManifestMutators(com.android.tools.build.bundletool.testing.ManifestProtoUtils.compareManifestMutators) LDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.LDPI) HDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.HDPI_VALUE) USER_PACKAGE_OFFSET(com.android.tools.build.bundletool.testing.ResourcesTableFactory.USER_PACKAGE_OFFSET) HDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.HDPI) TestCase.fail(junit.framework.TestCase.fail) XXHDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.XXHDPI_VALUE) TargetingUtils.assertForNonDefaultSplits(com.android.tools.build.bundletool.testing.TargetingUtils.assertForNonDefaultSplits) Test(org.junit.Test) XHDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.XHDPI) Truth.assertThat(com.google.common.truth.Truth.assertThat) ResourcesTableFactory.fileReference(com.android.tools.build.bundletool.testing.ResourcesTableFactory.fileReference) TargetingUtils.apkDensityTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkDensityTargeting) ResourcesTableFactory.forDpi(com.android.tools.build.bundletool.testing.ResourcesTableFactory.forDpi) StringPool(com.android.aapt.Resources.StringPool) XHDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.XHDPI_VALUE) TargetingUtils.assertForSingleDefaultSplit(com.android.tools.build.bundletool.testing.TargetingUtils.assertForSingleDefaultSplit) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Configuration(com.android.aapt.ConfigurationOuterClass.Configuration) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 65 with ResourceTableBuilder

use of com.android.tools.build.bundletool.testing.ResourceTableBuilder in project bundletool by google.

the class ScreenDensityResourcesSplitterTest method lowestDensityConfigsPinnedToMaster_masterCoversRangeOfDensities.

@Test
public void lowestDensityConfigsPinnedToMaster_masterCoversRangeOfDensities() throws Exception {
    BundleModule testModule = new BundleModuleBuilder("testModule").addFile("res/drawable-ldpi/image.jpg").addFile("res/drawable-xxxhdpi/image.jpg").addFile("res/drawable-ldpi/other.jpg").addFile("res/drawable-mdpi/other.jpg").addFile("res/drawable-tvdpi/other.jpg").addFile("res/drawable-xhdpi/other.jpg").addFile("res/drawable-xxhdpi/other.jpg").addFile("res/drawable-xxxhdpi/other.jpg").setResourceTable(new ResourceTableBuilder().addPackage("com.test.app").addDrawableResourceForMultipleDensities("image", ImmutableMap.of(/* ldpi */
    120, "res/drawable-ldpi/image.jpg", /* xxxhdpi */
    640, "res/drawable-xxxhdpi/image.jpg")).addDrawableResourceForMultipleDensities("other", ImmutableMap.<Integer, String>builder().put(/* ldpi */
    120, "res/drawable-ldpi/other.jpg").put(/* mdpi */
    160, "res/drawable-mdpi/other.jpg").put(/* tvdpi */
    213, "res/drawable-tvdpi/other.jpg").put(/* hdpi */
    240, "res/drawable-hdpi/other.jpg").put(/* xhdpi */
    320, "res/drawable-xhdpi/other.jpg").put(/* xxhdpi */
    480, "res/drawable-xxhdpi/other.jpg").put(/* xxxhdpi */
    640, "res/drawable-xxxhdpi/image.jpg").build()).build()).setManifest(androidManifest("com.test.app")).build();
    // 0x7f010000 is the "drawable/image" resource.
    Predicate<ResourceId> pinnedLowDensityResourcesPredicate = resourceId -> resourceId.getFullResourceId() == 0x7f010000;
    ScreenDensityResourcesSplitter splitter = new ScreenDensityResourcesSplitter(BundleToolVersion.getCurrentVersion(), NO_RESOURCES_PINNED_TO_MASTER, pinnedLowDensityResourcesPredicate, /* pinLowestBucketOfStylesToMaster= */
    false);
    ImmutableCollection<ModuleSplit> densitySplits = splitter.split(ModuleSplit.forResources(testModule));
    ImmutableList<ModuleSplit> configSplits = densitySplits.stream().filter(split -> !split.isMasterSplit()).collect(toImmutableList());
    assertThat(configSplits).isNotEmpty();
    for (ModuleSplit configSplit : configSplits) {
        DensityAlias targetDensity = configSplit.getApkTargeting().getScreenDensityTargeting().getValue(0).getDensityAlias();
        switch(targetDensity) {
            case LDPI:
            case MDPI:
                // Devices <= MDPI are covered by the LDPI config.
                assertThat(extractPaths(configSplit.getEntries())).doesNotContain("res/drawable-xxxhdpi/image.jpg");
                break;
            default:
                // Devices > MDPI are covered by the XXXHDPI config.
                assertThat(extractPaths(configSplit.getEntries())).contains("res/drawable-xxxhdpi/image.jpg");
        }
    }
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) ManifestProtoUtils.androidManifest(com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest) ImmutableCollection(com.google.common.collect.ImmutableCollection) MoreCollectors.onlyElement(com.google.common.collect.MoreCollectors.onlyElement) ManifestMutator.withSplitsRequired(com.android.tools.build.bundletool.model.ManifestMutator.withSplitsRequired) Item(com.android.aapt.Resources.Item) LDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.LDPI_VALUE) TVDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.TVDPI) ResourceId(com.android.tools.build.bundletool.model.ResourceId) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) ResourcesTableFactory.entry(com.android.tools.build.bundletool.testing.ResourcesTableFactory.entry) DensityAlias(com.android.bundle.Targeting.ScreenDensity.DensityAlias) Version(com.android.tools.build.bundletool.model.version.Version) ResourcesTableFactory.type(com.android.tools.build.bundletool.testing.ResourcesTableFactory.type) XXHDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.XXHDPI) ResourceTable(com.android.aapt.Resources.ResourceTable) Theory(org.junit.experimental.theories.Theory) BundleToolVersion(com.android.tools.build.bundletool.model.version.BundleToolVersion) ImmutableSet(com.google.common.collect.ImmutableSet) ConfigValue(com.android.aapt.Resources.ConfigValue) ImmutableMap(com.google.common.collect.ImmutableMap) XXXHDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.XXXHDPI) Predicate(java.util.function.Predicate) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Collection(java.util.Collection) DEFAULT_DENSITY_BUCKETS(com.android.tools.build.bundletool.splitters.ScreenDensityResourcesSplitter.DEFAULT_DENSITY_BUCKETS) ResourcesTableFactory.sdk(com.android.tools.build.bundletool.testing.ResourcesTableFactory.sdk) XXXHDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.XXXHDPI_VALUE) Collectors(java.util.stream.Collectors) ScreenDensity(com.android.bundle.Targeting.ScreenDensity) Sets(com.google.common.collect.Sets) FromDataPoints(org.junit.experimental.theories.FromDataPoints) ByteString(com.google.protobuf.ByteString) List(java.util.List) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) Optional(java.util.Optional) DataPoints(org.junit.experimental.theories.DataPoints) DEFAULT_DENSITY_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.DEFAULT_DENSITY_VALUE) MDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.MDPI) Value(com.android.aapt.Resources.Value) RunWith(org.junit.runner.RunWith) MDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.MDPI_VALUE) TestUtils.extractPaths(com.android.tools.build.bundletool.testing.TestUtils.extractPaths) ResourcesTableFactory.resourceTable(com.android.tools.build.bundletool.testing.ResourcesTableFactory.resourceTable) TruthResourceTable.assertThat(com.android.tools.build.bundletool.testing.truth.resources.TruthResourceTable.assertThat) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ProtoTruth.assertThat(com.google.common.truth.extensions.proto.ProtoTruth.assertThat) ImmutableList(com.google.common.collect.ImmutableList) Theories(org.junit.experimental.theories.Theories) TVDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.TVDPI_VALUE) ResourcesTableFactory.mergeConfigs(com.android.tools.build.bundletool.testing.ResourcesTableFactory.mergeConfigs) Truth8(com.google.common.truth.Truth8) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) Predicates(com.google.common.base.Predicates) ResourcesTableFactory.pkg(com.android.tools.build.bundletool.testing.ResourcesTableFactory.pkg) Truth8.assertThat(com.google.common.truth.Truth8.assertThat) ResourcesTableFactory._560DPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory._560DPI) ManifestProtoUtils.compareManifestMutators(com.android.tools.build.bundletool.testing.ManifestProtoUtils.compareManifestMutators) LDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.LDPI) HDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.HDPI_VALUE) USER_PACKAGE_OFFSET(com.android.tools.build.bundletool.testing.ResourcesTableFactory.USER_PACKAGE_OFFSET) HDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.HDPI) TestCase.fail(junit.framework.TestCase.fail) XXHDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.XXHDPI_VALUE) TargetingUtils.assertForNonDefaultSplits(com.android.tools.build.bundletool.testing.TargetingUtils.assertForNonDefaultSplits) Test(org.junit.Test) XHDPI(com.android.tools.build.bundletool.testing.ResourcesTableFactory.XHDPI) Truth.assertThat(com.google.common.truth.Truth.assertThat) ResourcesTableFactory.fileReference(com.android.tools.build.bundletool.testing.ResourcesTableFactory.fileReference) TargetingUtils.apkDensityTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.apkDensityTargeting) ResourcesTableFactory.forDpi(com.android.tools.build.bundletool.testing.ResourcesTableFactory.forDpi) StringPool(com.android.aapt.Resources.StringPool) XHDPI_VALUE(com.android.tools.build.bundletool.model.utils.ResourcesUtils.XHDPI_VALUE) TargetingUtils.assertForSingleDefaultSplit(com.android.tools.build.bundletool.testing.TargetingUtils.assertForSingleDefaultSplit) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Configuration(com.android.aapt.ConfigurationOuterClass.Configuration) ResourceId(com.android.tools.build.bundletool.model.ResourceId) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) ModuleSplit(com.android.tools.build.bundletool.model.ModuleSplit) ResourceTableBuilder(com.android.tools.build.bundletool.testing.ResourceTableBuilder) DensityAlias(com.android.bundle.Targeting.ScreenDensity.DensityAlias) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Aggregations

ResourceTableBuilder (com.android.tools.build.bundletool.testing.ResourceTableBuilder)77 Test (org.junit.Test)77 ModuleSplit (com.android.tools.build.bundletool.model.ModuleSplit)44 BundleModuleBuilder (com.android.tools.build.bundletool.testing.BundleModuleBuilder)44 BundleModule (com.android.tools.build.bundletool.model.BundleModule)40 ResourceTable (com.android.aapt.Resources.ResourceTable)35 ApkTargeting (com.android.bundle.Targeting.ApkTargeting)25 ManifestProtoUtils.androidManifest (com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest)24 Truth.assertThat (com.google.common.truth.Truth.assertThat)24 RunWith (org.junit.runner.RunWith)24 ImmutableMap (com.google.common.collect.ImmutableMap)21 ProtoTruth.assertThat (com.google.common.truth.extensions.proto.ProtoTruth.assertThat)21 ImmutableList (com.google.common.collect.ImmutableList)20 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)20 MoreCollectors.onlyElement (com.google.common.collect.MoreCollectors.onlyElement)20 DensityAlias (com.android.bundle.Targeting.ScreenDensity.DensityAlias)18 Theories (org.junit.experimental.theories.Theories)18 Configuration (com.android.aapt.ConfigurationOuterClass.Configuration)16 Truth8.assertThat (com.google.common.truth.Truth8.assertThat)16 Collection (java.util.Collection)16