Clean up apiLevelsGenerationFlags deps gathering

Restructures the code a little to make it clear that extensions
directories are distinct from dessert release directories.

Bug: 337836752
Test: m --no-skip-soong-tests nothing
Change-Id: I8ad68f0d112e62f8f1ddda1b6718119fe18eb8a9
This commit is contained in:
Paul Duffin 2024-05-01 13:13:51 +01:00
parent 0141b4acad
commit 2ced2eb07f

View file

@ -648,16 +648,17 @@ func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *an
// Grab the first extensions_dir and we find while scanning ExportedDroiddocDir.deps;
// ideally this should be read from prebuiltApis.properties.Extensions_*
for _, dep := range t.deps {
// Check to see if it matches an extension first.
depBase := dep.Base()
if extRegex.MatchString(dep.String()) && d.properties.Extensions_info_file != nil {
if extensions_dir == "" {
extensions_dir = t.dir.String() + "/extensions"
}
cmd.Implicit(dep)
}
if dep.Base() == filename {
} else if depBase == filename {
// Check to see if it matches a dessert release for an SDK, e.g. Android, Car, Wear, etc..
cmd.Implicit(dep)
}
if filename != "android.jar" && dep.Base() == "android.jar" {
} else if filename != "android.jar" && depBase == "android.jar" {
// Metalava implicitly searches these patterns:
// prebuilts/tools/common/api-versions/android-%/android.jar
// prebuilts/sdk/%/public/android.jar
@ -1327,7 +1328,7 @@ func (d *Droidstubs) createApiContribution(ctx android.DefaultableHookContext) {
// use a strict naming convention
var (
droidstubsModuleNamingToSdkKind = map[string]android.SdkKind{
//public is commented out since the core libraries use public in their java_sdk_library names
// public is commented out since the core libraries use public in their java_sdk_library names
"intracore": android.SdkIntraCore,
"intra.core": android.SdkIntraCore,
"system_server": android.SdkSystemServer,