Merge "Create java_defaults in api.go" am: b36fa7723a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2529279 Change-Id: Ibefb14b2c468d1caefd5bcf970efd7162465fa26 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
39
api/api.go
39
api/api.go
@@ -15,7 +15,9 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
|
||||||
@@ -102,6 +104,13 @@ type fgProps struct {
|
|||||||
Visibility []string
|
Visibility []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type defaultsProps struct {
|
||||||
|
Name *string
|
||||||
|
Api_surface *string
|
||||||
|
Api_contributions []string
|
||||||
|
Defaults_visibility []string
|
||||||
|
}
|
||||||
|
|
||||||
type Bazel_module struct {
|
type Bazel_module struct {
|
||||||
Bp2build_available *bool
|
Bp2build_available *bool
|
||||||
}
|
}
|
||||||
@@ -164,7 +173,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createMergedAnnotationsFilegroups(ctx android.LoadHookContext, modules, system_server_modules []string) {
|
func createMergedAnnotationsFilegroups(ctx android.LoadHookContext, modules, system_server_modules []string) {
|
||||||
for _, i := range []struct{
|
for _, i := range []struct {
|
||||||
name string
|
name string
|
||||||
tag string
|
tag string
|
||||||
modules []string
|
modules []string
|
||||||
@@ -329,6 +338,30 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func createApiContributionDefaults(ctx android.LoadHookContext, modules []string) {
|
||||||
|
defaultsSdkKinds := []android.SdkKind{
|
||||||
|
android.SdkPublic, android.SdkSystem, android.SdkModule,
|
||||||
|
}
|
||||||
|
for _, sdkKind := range defaultsSdkKinds {
|
||||||
|
props := defaultsProps{}
|
||||||
|
props.Name = proptools.StringPtr(
|
||||||
|
sdkKind.DefaultJavaLibraryName() + "_contributions")
|
||||||
|
if sdkKind == android.SdkModule {
|
||||||
|
props.Name = proptools.StringPtr(
|
||||||
|
sdkKind.DefaultJavaLibraryName() + "_contributions_full")
|
||||||
|
}
|
||||||
|
props.Api_surface = proptools.StringPtr(sdkKind.String())
|
||||||
|
apiSuffix := ""
|
||||||
|
if sdkKind != android.SdkPublic {
|
||||||
|
apiSuffix = "." + strings.ReplaceAll(sdkKind.String(), "-", "_")
|
||||||
|
}
|
||||||
|
props.Api_contributions = transformArray(
|
||||||
|
modules, "", fmt.Sprintf(".stubs.source%s.api.contribution", apiSuffix))
|
||||||
|
props.Defaults_visibility = []string{"//visibility:public"}
|
||||||
|
ctx.CreateModule(java.DefaultsFactory, &props)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
|
func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
|
||||||
bootclasspath := a.properties.Bootclasspath
|
bootclasspath := a.properties.Bootclasspath
|
||||||
system_server_classpath := a.properties.System_server_classpath
|
system_server_classpath := a.properties.System_server_classpath
|
||||||
@@ -347,6 +380,8 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
|
|||||||
createMergedAnnotationsFilegroups(ctx, bootclasspath, system_server_classpath)
|
createMergedAnnotationsFilegroups(ctx, bootclasspath, system_server_classpath)
|
||||||
|
|
||||||
createPublicStubsSourceFilegroup(ctx, bootclasspath)
|
createPublicStubsSourceFilegroup(ctx, bootclasspath)
|
||||||
|
|
||||||
|
createApiContributionDefaults(ctx, bootclasspath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func combinedApisModuleFactory() android.Module {
|
func combinedApisModuleFactory() android.Module {
|
||||||
@@ -374,7 +409,7 @@ func (a *CombinedApis) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||||||
"system-server": "-system-server-current.txt",
|
"system-server": "-system-server-current.txt",
|
||||||
}
|
}
|
||||||
|
|
||||||
for scopeName, suffix := range scopeToSuffix{
|
for scopeName, suffix := range scopeToSuffix {
|
||||||
name := a.Name() + suffix
|
name := a.Name() + suffix
|
||||||
|
|
||||||
var scope bazel.StringAttribute
|
var scope bazel.StringAttribute
|
||||||
|
|||||||
Reference in New Issue
Block a user