Merge changes I439179a9,I8ad68f0d into main am: a73c4021ec
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3069684 Change-Id: Iaf1c0e80bfb13de39a07a5bc394af7289646bbd9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -604,6 +604,11 @@ func (d *Droidstubs) apiLevelsAnnotationsFlags(ctx android.ModuleContext, cmd *a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AndroidPlusUpdatableJar is the name of some extra jars added into `module-lib` and
|
||||||
|
// `system-server` directories that contain all the APIs provided by the platform and updatable
|
||||||
|
// modules because the `android.jar` files do not. See b/337836752.
|
||||||
|
const AndroidPlusUpdatableJar = "android-plus-updatable.jar"
|
||||||
|
|
||||||
func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, stubsType StubsType, apiVersionsXml android.WritablePath) {
|
func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, stubsType StubsType, apiVersionsXml android.WritablePath) {
|
||||||
if len(d.properties.Api_levels_annotations_dirs) == 0 {
|
if len(d.properties.Api_levels_annotations_dirs) == 0 {
|
||||||
ctx.PropertyErrorf("api_levels_annotations_dirs",
|
ctx.PropertyErrorf("api_levels_annotations_dirs",
|
||||||
@@ -648,16 +653,24 @@ func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *an
|
|||||||
// Grab the first extensions_dir and we find while scanning ExportedDroiddocDir.deps;
|
// Grab the first extensions_dir and we find while scanning ExportedDroiddocDir.deps;
|
||||||
// ideally this should be read from prebuiltApis.properties.Extensions_*
|
// ideally this should be read from prebuiltApis.properties.Extensions_*
|
||||||
for _, dep := range t.deps {
|
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 extRegex.MatchString(dep.String()) && d.properties.Extensions_info_file != nil {
|
||||||
if extensions_dir == "" {
|
if extensions_dir == "" {
|
||||||
extensions_dir = t.dir.String() + "/extensions"
|
extensions_dir = t.dir.String() + "/extensions"
|
||||||
}
|
}
|
||||||
cmd.Implicit(dep)
|
cmd.Implicit(dep)
|
||||||
}
|
} else if depBase == filename {
|
||||||
if dep.Base() == filename {
|
// Check to see if it matches a dessert release for an SDK, e.g. Android, Car, Wear, etc..
|
||||||
cmd.Implicit(dep)
|
cmd.Implicit(dep)
|
||||||
}
|
} else if depBase == AndroidPlusUpdatableJar && d.properties.Extensions_info_file != nil {
|
||||||
if filename != "android.jar" && dep.Base() == "android.jar" {
|
// The output api-versions.xml has been requested to include information on SDK
|
||||||
|
// extensions. That means it also needs to include
|
||||||
|
// so
|
||||||
|
// The module-lib and system-server directories should use `android-plus-updatable.jar`
|
||||||
|
// instead of `android.jar`. See AndroidPlusUpdatableJar for more information.
|
||||||
|
cmd.Implicit(dep)
|
||||||
|
} else if filename != "android.jar" && depBase == "android.jar" {
|
||||||
// Metalava implicitly searches these patterns:
|
// Metalava implicitly searches these patterns:
|
||||||
// prebuilts/tools/common/api-versions/android-%/android.jar
|
// prebuilts/tools/common/api-versions/android-%/android.jar
|
||||||
// prebuilts/sdk/%/public/android.jar
|
// prebuilts/sdk/%/public/android.jar
|
||||||
@@ -675,9 +688,25 @@ func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *an
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Generate the list of --android-jar-pattern options. The order matters so the first one which
|
||||||
|
// matches will be the one that is used for a specific api level..
|
||||||
for _, sdkDir := range sdkDirs {
|
for _, sdkDir := range sdkDirs {
|
||||||
for _, dir := range dirs {
|
for _, dir := range dirs {
|
||||||
cmd.FlagWithArg("--android-jar-pattern ", fmt.Sprintf("%s/%%/%s/%s", dir, sdkDir, filename))
|
addPattern := func(jarFilename string) {
|
||||||
|
cmd.FlagWithArg("--android-jar-pattern ", fmt.Sprintf("%s/%%/%s/%s", dir, sdkDir, jarFilename))
|
||||||
|
}
|
||||||
|
|
||||||
|
if sdkDir == "module-lib" || sdkDir == "system-server" {
|
||||||
|
// The module-lib and system-server android.jars do not include the updatable modules (as
|
||||||
|
// doing so in the source would introduce dependency cycles and the prebuilts have to
|
||||||
|
// match the sources). So, instead an additional `android-plus-updatable.jar` will be used
|
||||||
|
// that does include the updatable modules and this pattern will match that. This pattern
|
||||||
|
// is added in addition to the following pattern to decouple this change from the change
|
||||||
|
// to add the `android-plus-updatable.jar`.
|
||||||
|
addPattern(AndroidPlusUpdatableJar)
|
||||||
|
}
|
||||||
|
|
||||||
|
addPattern(filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1327,7 +1356,7 @@ func (d *Droidstubs) createApiContribution(ctx android.DefaultableHookContext) {
|
|||||||
// use a strict naming convention
|
// use a strict naming convention
|
||||||
var (
|
var (
|
||||||
droidstubsModuleNamingToSdkKind = map[string]android.SdkKind{
|
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,
|
"intracore": android.SdkIntraCore,
|
||||||
"intra.core": android.SdkIntraCore,
|
"intra.core": android.SdkIntraCore,
|
||||||
"system_server": android.SdkSystemServer,
|
"system_server": android.SdkSystemServer,
|
||||||
|
Reference in New Issue
Block a user