summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2023-10-27 17:21:52 +0000
committer Spandan Das <spandandas@google.com> 2023-10-31 20:57:56 +0000
commit2cc80ba1458c2c273fa495e20c3c9286a36373cc (patch)
treee74fc785c2949067b7a43a28108b65e0ddebda9e /java
parentee44d32adda18275869a99b0b3e4c26d10d4dc59 (diff)
Add the name of the sdk library to dynamically generated java modules
The name of the sdk library will be used in source vs prebuilt selection. For soong modules that are not dynamically created from a java_sdk_library, the value will be nil. Bug: 308174768 Test: TH Change-Id: Ic7e9889f00c6184992b663a7124967bb0794d475
Diffstat (limited to 'java')
-rw-r--r--java/droidstubs.go5
-rw-r--r--java/java.go5
-rw-r--r--java/sdk_library.go8
3 files changed, 14 insertions, 4 deletions
diff --git a/java/droidstubs.go b/java/droidstubs.go
index a7e8eb659..c000ac382 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -48,6 +48,7 @@ func RegisterStubsBuildComponents(ctx android.RegistrationContext) {
// Droidstubs
type Droidstubs struct {
Javadoc
+ embeddableInModuleAndImport
properties DroidstubsProperties
apiFile android.Path
@@ -184,6 +185,7 @@ func DroidstubsFactory() android.Module {
module.AddProperties(&module.properties,
&module.Javadoc.properties)
+ module.initModuleAndImport(module)
InitDroiddocModule(module, android.HostAndDeviceSupported)
@@ -930,6 +932,8 @@ type PrebuiltStubsSourcesProperties struct {
type PrebuiltStubsSources struct {
android.ModuleBase
android.DefaultableModuleBase
+ embeddableInModuleAndImport
+
prebuilt android.Prebuilt
properties PrebuiltStubsSourcesProperties
@@ -1008,6 +1012,7 @@ func PrebuiltStubsSourcesFactory() android.Module {
module := &PrebuiltStubsSources{}
module.AddProperties(&module.properties)
+ module.initModuleAndImport(module)
android.InitPrebuiltModule(module, &module.properties.Srcs)
InitDroiddocModule(module, android.HostAndDeviceSupported)
diff --git a/java/java.go b/java/java.go
index bc240508b..ee58ee465 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1612,6 +1612,7 @@ func BinaryHostFactory() android.Module {
type JavaApiContribution struct {
android.ModuleBase
android.DefaultableModuleBase
+ embeddableInModuleAndImport
properties struct {
// name of the API surface
@@ -1627,6 +1628,7 @@ func ApiContributionFactory() android.Module {
android.InitAndroidModule(module)
android.InitDefaultableModule(module)
module.AddProperties(&module.properties)
+ module.initModuleAndImport(module)
return module
}
@@ -1655,6 +1657,7 @@ type ApiLibrary struct {
hiddenAPI
dexer
+ embeddableInModuleAndImport
properties JavaApiLibraryProperties
@@ -1713,6 +1716,7 @@ func ApiLibraryFactory() android.Module {
module := &ApiLibrary{}
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
module.AddProperties(&module.properties)
+ module.initModuleAndImport(module)
android.InitDefaultableModule(module)
return module
}
@@ -3512,6 +3516,7 @@ func ApiContributionImportFactory() android.Module {
android.InitDefaultableModule(module)
android.InitPrebuiltModule(module, &[]string{""})
module.AddProperties(&module.properties)
+ module.AddProperties(&module.sdkLibraryComponentProperties)
return module
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 7807889cc..1de89727f 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1829,7 +1829,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
}
}
- mctx.CreateModule(DroidstubsFactory, &props).(*Droidstubs).CallHookIfAvailable(mctx)
+ mctx.CreateModule(DroidstubsFactory, &props, module.sdkComponentPropertiesForChildLibrary()).(*Droidstubs).CallHookIfAvailable(mctx)
}
func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext, apiScope *apiScope, alternativeFullApiSurfaceStub string) {
@@ -1892,7 +1892,7 @@ func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext,
props.System_modules = module.deviceProperties.System_modules
props.Enable_validation = proptools.BoolPtr(true)
- mctx.CreateModule(ApiLibraryFactory, &props)
+ mctx.CreateModule(ApiLibraryFactory, &props, module.sdkComponentPropertiesForChildLibrary())
}
func (module *SdkLibrary) createTopLevelStubsLibrary(
@@ -2590,7 +2590,7 @@ func (module *SdkLibraryImport) createPrebuiltStubsSources(mctx android.Defaulta
// The stubs source is preferred if the java_sdk_library_import is preferred.
props.CopyUserSuppliedPropertiesFromPrebuilt(&module.prebuilt)
- mctx.CreateModule(PrebuiltStubsSourcesFactory, &props)
+ mctx.CreateModule(PrebuiltStubsSourcesFactory, &props, module.sdkComponentPropertiesForChildLibrary())
}
func (module *SdkLibraryImport) createPrebuiltApiContribution(mctx android.DefaultableHookContext, apiScope *apiScope, scopeProperties *sdkLibraryScopeProperties) {
@@ -2609,7 +2609,7 @@ func (module *SdkLibraryImport) createPrebuiltApiContribution(mctx android.Defau
props.Api_file = api_file
props.Visibility = []string{"//visibility:override", "//visibility:public"}
- mctx.CreateModule(ApiContributionImportFactory, &props)
+ mctx.CreateModule(ApiContributionImportFactory, &props, module.sdkComponentPropertiesForChildLibrary())
}
// Add the dependencies on the child module in the component deps mutator so that it