Add an apex_contributions_defaults module to module sdk

This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.

Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
    name: "art-module-host-exports.contributions",
    contents: [
        "prebuilt_art.module.api.annotations",
        "prebuilt_dex2oat",
        "prebuilt_dex2oatd",
        "prebuilt_dexdump",
        "prebuilt_hiddenapi",
        "prebuilt_oatdump",
        "prebuilt_profman",
        "prebuilt_veridex",
        "prebuilt_libartpalette",
        "prebuilt_libartbase",
    ],
}

Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
This commit is contained in:
Spandan Das
2024-03-06 14:04:36 +00:00
parent 159b264873
commit a5e26d3cd6
11 changed files with 432 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ import (
"android/soong/apex"
"android/soong/cc"
"android/soong/java"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -388,6 +389,7 @@ be unnecessary as every module in the sdk already has its own licenses property.
// Create the prebuilt modules for each of the member modules.
traits := s.gatherTraits()
memberNames := []string{} // soong module names of the members. contains the prebuilt_ prefix.
for _, member := range members {
memberType := member.memberType
if !memberType.ArePrebuiltsRequired() {
@@ -409,6 +411,38 @@ be unnecessary as every module in the sdk already has its own licenses property.
prebuiltModule := memberType.AddPrebuiltModule(memberCtx, member)
s.createMemberSnapshot(memberCtx, member, prebuiltModule.(*bpModule))
if member.memberType != android.LicenseModuleSdkMemberType && !builder.isInternalMember(member.name) {
// More exceptions
// 1. Skip BCP and SCCP fragments
// 2. Skip non-sdk contents of BCP and SCCP fragments
//
// The non-sdk contents of BCP/SSCP fragments should only be used for dexpreopt and hiddenapi,
// and are not available to the rest of the build.
if android.InList(member.memberType,
[]android.SdkMemberType{
// bcp
java.BootclasspathFragmentSdkMemberType,
java.JavaBootLibsSdkMemberType,
// sscp
java.SystemServerClasspathFragmentSdkMemberType,
java.JavaSystemserverLibsSdkMemberType,
},
) {
continue
}
memberNames = append(memberNames, android.PrebuiltNameFromSource(member.name))
}
}
// create an apex_contributions_defaults for this module's sdk.
// this module type is supported in V and above.
if targetApiLevel.GreaterThan(android.ApiLevelUpsideDownCake) {
ac := newModule("apex_contributions_defaults")
ac.AddProperty("name", s.Name()+".contributions")
ac.AddProperty("contents", memberNames)
bpFile.AddModule(ac)
}
// Create a transformer that will transform a module by replacing any references