use of com.android.tools.build.bundletool.model.GeneratedApks in project bundletool by google.
the class SplitsXmlInjectorTest method process_systemSplits.
@Test
public void process_systemSplits() throws Exception {
ModuleSplit baseMasterSplit = createModuleSplit(BASE_MODULE_NAME.getName(), /* splitId= */
"", /* masterSplit= */
true, SYSTEM, languageTargeting("es"));
ImmutableList<ModuleSplit> otherSplits = ImmutableList.of(createModuleSplit(BASE_MODULE_NAME.getName(), /* splitId= */
"config.ru", /* masterSplit= */
false, SYSTEM, languageTargeting("ru")), createModuleSplit(BASE_MODULE_NAME.getName(), /* splitId= */
"config.fr", /* masterSplit= */
false, SYSTEM, languageTargeting("fr")), createModuleSplit("module", /* splitId= */
"module.config.ru", /* masterSplit= */
false, SYSTEM, languageTargeting("ru")));
GeneratedApks generatedApks = GeneratedApks.fromModuleSplits(ImmutableList.<ModuleSplit>builder().add(baseMasterSplit).addAll(otherSplits).build());
assertThat(generatedApks.getAllApksStream()).containsAtLeastElementsIn(otherSplits);
ModuleSplit processedBaseMasterSplit = xmlInjectorProcess(generatedApks).stream().filter(module -> module.isMasterSplit() && module.isBaseModuleSplit()).collect(onlyElement());
assertThat(processedBaseMasterSplit.getAndroidManifest().getMetadataResourceId("com.android.vending.splits")).hasValue(0x7f010000);
assertThat(processedBaseMasterSplit.getResourceTable().get()).containsResource("com.example.app:xml/splits0").withFileReference("res/xml/splits0.xml");
XmlNode expectedSplitsProtoXml = new SplitsProtoXmlBuilder().addLanguageMapping(BundleModuleName.create("module"), "ru", "module.config.ru").addLanguageMapping(BASE_MODULE_NAME, "ru", "config.ru").addLanguageMapping(BASE_MODULE_NAME, "fr", "config.fr").addLanguageMapping(BASE_MODULE_NAME, "es", "").build();
assertThat(XmlNode.parseFrom(processedBaseMasterSplit.getEntries().get(0).getContent().read())).ignoringRepeatedFieldOrder().isEqualTo(expectedSplitsProtoXml);
}
use of com.android.tools.build.bundletool.model.GeneratedApks in project bundletool by google.
the class SplitsXmlInjectorTest method process.
@Test
public void process() throws Exception {
ModuleSplit baseMasterSplit = createModuleSplit(BASE_MODULE_NAME.getName(), /* splitId= */
"", /* masterSplit= */
true, SPLIT, /* languageTargeting= */
null);
ImmutableList<ModuleSplit> otherSplits = ImmutableList.of(createModuleSplit(BASE_MODULE_NAME.getName(), /* splitId= */
"config.ru", /* masterSplit= */
false, SPLIT, languageTargeting("ru")), createModuleSplit(BASE_MODULE_NAME.getName(), /* splitId= */
"config.fr", /* masterSplit= */
false, SPLIT, languageTargeting("fr")), createModuleSplit("module", /* splitId= */
"module", /* masterSplit= */
true, SPLIT, /* languageTargeting= */
null), createModuleSplit("module", /* splitId= */
"module.config.ru", /* masterSplit= */
false, SPLIT, languageTargeting("ru")));
GeneratedApks generatedApks = GeneratedApks.fromModuleSplits(ImmutableList.<ModuleSplit>builder().add(baseMasterSplit).addAll(otherSplits).build());
assertThat(generatedApks.getAllApksStream()).containsAtLeastElementsIn(otherSplits);
ModuleSplit processedBaseMasterSplit = xmlInjectorProcess(generatedApks).stream().filter(module -> module.isMasterSplit() && module.isBaseModuleSplit()).collect(onlyElement());
assertThat(processedBaseMasterSplit.getAndroidManifest().getMetadataResourceId("com.android.vending.splits")).hasValue(0x7f010000);
assertThat(processedBaseMasterSplit.getResourceTable().get()).containsResource("com.example.app:xml/splits0").withFileReference("res/xml/splits0.xml");
XmlNode expectedSplitsProtoXml = new SplitsProtoXmlBuilder().addLanguageMapping(BundleModuleName.create("module"), "ru", "module.config.ru").addLanguageMapping(BASE_MODULE_NAME, "ru", "config.ru").addLanguageMapping(BASE_MODULE_NAME, "fr", "config.fr").build();
assertThat(XmlNode.parseFrom(processedBaseMasterSplit.getEntries().get(0).getContent().read())).ignoringRepeatedFieldOrder().isEqualTo(expectedSplitsProtoXml);
}
use of com.android.tools.build.bundletool.model.GeneratedApks in project bundletool by google.
the class BuildSdkApksManager method execute.
void execute() {
ImmutableList<ModuleSplit> sdkApks = generateSdkApks();
GeneratedApks generatedApks = GeneratedApks.builder().setStandaloneApks(sdkApks).build();
// Create variants and serialize APKs.
apkSerializerManager.serializeSdkApkSet(createApkSetWriter(), generatedApks);
}
Aggregations