Search in sources :

Example 6 with SPLIT

use of com.android.tools.build.bundletool.model.ModuleSplit.SplitType.SPLIT 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)

Aggregations

ResourceTable (com.android.aapt.Resources.ResourceTable)6 XmlNode (com.android.aapt.Resources.XmlNode)6 ApkTargeting (com.android.bundle.Targeting.ApkTargeting)6 LanguageTargeting (com.android.bundle.Targeting.LanguageTargeting)6 VariantTargeting (com.android.bundle.Targeting.VariantTargeting)6 AndroidManifest (com.android.tools.build.bundletool.model.AndroidManifest)6 BundleModuleName (com.android.tools.build.bundletool.model.BundleModuleName)6 BASE_MODULE_NAME (com.android.tools.build.bundletool.model.BundleModuleName.BASE_MODULE_NAME)6 ModuleSplit (com.android.tools.build.bundletool.model.ModuleSplit)6 SplitType (com.android.tools.build.bundletool.model.ModuleSplit.SplitType)6 SPLIT (com.android.tools.build.bundletool.model.ModuleSplit.SplitType.SPLIT)6 SYSTEM (com.android.tools.build.bundletool.model.ModuleSplit.SplitType.SYSTEM)6 ManifestProtoUtils.androidManifest (com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest)6 ResourceTableBuilder (com.android.tools.build.bundletool.testing.ResourceTableBuilder)6 TargetingUtils.languageTargeting (com.android.tools.build.bundletool.testing.TargetingUtils.languageTargeting)6 TruthResourceTable.assertThat (com.android.tools.build.bundletool.testing.truth.resources.TruthResourceTable.assertThat)6 ImmutableList (com.google.common.collect.ImmutableList)6 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)6 ImmutableMap (com.google.common.collect.ImmutableMap)6 MoreCollectors.onlyElement (com.google.common.collect.MoreCollectors.onlyElement)6