Convert additional sdk_library stub libraries to from stub generation am: 0c705a448f
am: 965d58af92
am: 5803ca5737
am: be62f141cc
am: 8382920b4e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2689126 Change-Id: I91db0ba1829fc4c9114baca108233db704f6359e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -387,6 +387,23 @@ var (
|
|||||||
apiScopeModuleLib,
|
apiScopeModuleLib,
|
||||||
apiScopeSystemServer,
|
apiScopeSystemServer,
|
||||||
}
|
}
|
||||||
|
apiLibraryAdditionalProperties = map[string]struct {
|
||||||
|
FullApiSurfaceStubLib string
|
||||||
|
AdditionalApiContribution string
|
||||||
|
}{
|
||||||
|
"legacy.i18n.module.platform.api": {
|
||||||
|
FullApiSurfaceStubLib: "legacy.core.platform.api.stubs",
|
||||||
|
AdditionalApiContribution: "i18n.module.public.api.stubs.source.api.contribution",
|
||||||
|
},
|
||||||
|
"stable.i18n.module.platform.api": {
|
||||||
|
FullApiSurfaceStubLib: "stable.core.platform.api.stubs",
|
||||||
|
AdditionalApiContribution: "i18n.module.public.api.stubs.source.api.contribution",
|
||||||
|
},
|
||||||
|
"conscrypt.module.platform.api": {
|
||||||
|
FullApiSurfaceStubLib: "stable.core.platform.api.stubs",
|
||||||
|
AdditionalApiContribution: "conscrypt.module.public.api.stubs.source.api.contribution",
|
||||||
|
},
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -1513,6 +1530,29 @@ func (module *SdkLibrary) contributesToApiSurface(c android.Config) bool {
|
|||||||
return exists
|
return exists
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The listed modules are the special java_sdk_libraries where apiScope.kind do not match the
|
||||||
|
// api surface that the module contribute to. For example, the public droidstubs and java_library
|
||||||
|
// do not contribute to the public api surface, but contributes to the core platform api surface.
|
||||||
|
// This method returns the full api surface stub lib that
|
||||||
|
// the generated java_api_library should depend on.
|
||||||
|
func (module *SdkLibrary) alternativeFullApiSurfaceStubLib() string {
|
||||||
|
if val, ok := apiLibraryAdditionalProperties[module.Name()]; ok {
|
||||||
|
return val.FullApiSurfaceStubLib
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// The listed modules' stubs contents do not match the corresponding txt files,
|
||||||
|
// but require additional api contributions to generate the full stubs.
|
||||||
|
// This method returns the name of the additional api contribution module
|
||||||
|
// for corresponding sdk_library modules.
|
||||||
|
func (module *SdkLibrary) apiLibraryAdditionalApiContribution() string {
|
||||||
|
if val, ok := apiLibraryAdditionalProperties[module.Name()]; ok {
|
||||||
|
return val.AdditionalApiContribution
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func childModuleVisibility(childVisibility []string) []string {
|
func childModuleVisibility(childVisibility []string) []string {
|
||||||
if childVisibility == nil {
|
if childVisibility == nil {
|
||||||
// No child visibility set. The child will use the visibility of the sdk_library.
|
// No child visibility set. The child will use the visibility of the sdk_library.
|
||||||
@@ -1778,7 +1818,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
|
|||||||
mctx.CreateModule(DroidstubsFactory, &props).(*Droidstubs).CallHookIfAvailable(mctx)
|
mctx.CreateModule(DroidstubsFactory, &props).(*Droidstubs).CallHookIfAvailable(mctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext, apiScope *apiScope) {
|
func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext, apiScope *apiScope, alternativeFullApiSurfaceStub string) {
|
||||||
props := struct {
|
props := struct {
|
||||||
Name *string
|
Name *string
|
||||||
Visibility []string
|
Visibility []string
|
||||||
@@ -1801,6 +1841,12 @@ func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext,
|
|||||||
apiContributions = append(apiContributions, module.stubsSourceModuleName(scope)+".api.contribution")
|
apiContributions = append(apiContributions, module.stubsSourceModuleName(scope)+".api.contribution")
|
||||||
scope = scope.extends
|
scope = scope.extends
|
||||||
}
|
}
|
||||||
|
if apiScope == apiScopePublic {
|
||||||
|
additionalApiContribution := module.apiLibraryAdditionalApiContribution()
|
||||||
|
if additionalApiContribution != "" {
|
||||||
|
apiContributions = append(apiContributions, additionalApiContribution)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
props.Api_contributions = apiContributions
|
props.Api_contributions = apiContributions
|
||||||
props.Libs = module.properties.Libs
|
props.Libs = module.properties.Libs
|
||||||
@@ -1808,6 +1854,9 @@ func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext,
|
|||||||
props.Libs = append(props.Libs, "stub-annotations")
|
props.Libs = append(props.Libs, "stub-annotations")
|
||||||
props.Static_libs = module.sdkLibraryProperties.Stub_only_static_libs
|
props.Static_libs = module.sdkLibraryProperties.Stub_only_static_libs
|
||||||
props.Full_api_surface_stub = proptools.StringPtr(apiScope.kind.DefaultJavaLibraryName() + ".from-text")
|
props.Full_api_surface_stub = proptools.StringPtr(apiScope.kind.DefaultJavaLibraryName() + ".from-text")
|
||||||
|
if alternativeFullApiSurfaceStub != "" {
|
||||||
|
props.Full_api_surface_stub = proptools.StringPtr(alternativeFullApiSurfaceStub)
|
||||||
|
}
|
||||||
|
|
||||||
// android_module_lib_stubs_current.from-text only comprises api contributions from art, conscrypt and i18n.
|
// android_module_lib_stubs_current.from-text only comprises api contributions from art, conscrypt and i18n.
|
||||||
// Thus, replace with android_module_lib_stubs_current_full.from-text, which comprises every api domains.
|
// Thus, replace with android_module_lib_stubs_current_full.from-text, which comprises every api domains.
|
||||||
@@ -2062,9 +2111,13 @@ func (module *SdkLibrary) CreateInternalModules(mctx android.DefaultableHookCont
|
|||||||
|
|
||||||
module.createStubsLibrary(mctx, scope)
|
module.createStubsLibrary(mctx, scope)
|
||||||
|
|
||||||
contributesToApiSurface := module.contributesToApiSurface(mctx.Config())
|
alternativeFullApiSurfaceStubLib := ""
|
||||||
|
if scope == apiScopePublic {
|
||||||
|
alternativeFullApiSurfaceStubLib = module.alternativeFullApiSurfaceStubLib()
|
||||||
|
}
|
||||||
|
contributesToApiSurface := module.contributesToApiSurface(mctx.Config()) || alternativeFullApiSurfaceStubLib != ""
|
||||||
if contributesToApiSurface {
|
if contributesToApiSurface {
|
||||||
module.createApiLibrary(mctx, scope)
|
module.createApiLibrary(mctx, scope, alternativeFullApiSurfaceStubLib)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.createTopLevelStubsLibrary(mctx, scope, contributesToApiSurface)
|
module.createTopLevelStubsLibrary(mctx, scope, contributesToApiSurface)
|
||||||
|
Reference in New Issue
Block a user