Create java_api_contribution_import from sdk_library_import
This change modifies sdk_library_import so that it directly creates java_api_contribution per api scope. The module creates api_contribution module for api scopes where the api file is specified. Test: m nothing && MODULE_BUILD_FROM_SOURCE=false m nothing --build-from-text-stub and inspect ninja dependency of java_api_library Bug: 300175323 Change-Id: I74be3b4f1efef7f7d1cb8bd7b6c893b9cef0f370
This commit is contained in:
@@ -2479,6 +2479,10 @@ func (module *SdkLibraryImport) createInternalModules(mctx android.DefaultableHo
|
||||
if len(scopeProperties.Stub_srcs) > 0 {
|
||||
module.createPrebuiltStubsSources(mctx, apiScope, scopeProperties)
|
||||
}
|
||||
|
||||
if scopeProperties.Current_api != nil {
|
||||
module.createPrebuiltApiContribution(mctx, apiScope, scopeProperties)
|
||||
}
|
||||
}
|
||||
|
||||
javaSdkLibraries := javaSdkLibraries(mctx.Config())
|
||||
@@ -2534,6 +2538,25 @@ func (module *SdkLibraryImport) createPrebuiltStubsSources(mctx android.Defaulta
|
||||
mctx.CreateModule(PrebuiltStubsSourcesFactory, &props)
|
||||
}
|
||||
|
||||
func (module *SdkLibraryImport) createPrebuiltApiContribution(mctx android.DefaultableHookContext, apiScope *apiScope, scopeProperties *sdkLibraryScopeProperties) {
|
||||
api_file := scopeProperties.Current_api
|
||||
api_surface := &apiScope.name
|
||||
|
||||
props := struct {
|
||||
Name *string
|
||||
Api_surface *string
|
||||
Api_file *string
|
||||
Visibility []string
|
||||
}{}
|
||||
|
||||
props.Name = proptools.StringPtr(module.stubsSourceModuleName(apiScope) + ".api.contribution")
|
||||
props.Api_surface = api_surface
|
||||
props.Api_file = api_file
|
||||
props.Visibility = []string{"//visibility:override", "//visibility:public"}
|
||||
|
||||
mctx.CreateModule(ApiContributionImportFactory, &props)
|
||||
}
|
||||
|
||||
// Add the dependencies on the child module in the component deps mutator so that it
|
||||
// creates references to the prebuilt and not the source modules.
|
||||
func (module *SdkLibraryImport) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
|
Reference in New Issue
Block a user