summaryrefslogtreecommitdiff
path: root/java/sdk_library.go
diff options
context:
space:
mode:
authorHaamed Gheibi <haamed@google.com>2021-07-16 22:06:52 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-07-16 22:06:52 +0000
commitf0dd5152a12c045deb95609ef47da5e6cd7c13be (patch)
tree8a151da47606af4442fd95f3d62c68326fcd516a /java/sdk_library.go
parente64464306404bb00c04190e2e44cb0952e824646 (diff)
parentd4fd974eb42fa9bc991011d544a48157aa8e95a7 (diff)
Merge "Merge SP1A.210709.002" into s-keystone-qcom-dev
Diffstat (limited to 'java/sdk_library.go')
-rw-r--r--java/sdk_library.go41
1 files changed, 39 insertions, 2 deletions
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 409a41fd7..1064f7c7f 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -675,15 +675,27 @@ func (c *commonToSdkLibraryAndImport) initCommonAfterDefaultsApplied(ctx android
return false
}
+ namePtr := proptools.StringPtr(c.module.BaseModuleName())
+ c.sdkLibraryComponentProperties.SdkLibraryName = namePtr
+
// Only track this sdk library if this can be used as a shared library.
if c.sharedLibrary() {
// Use the name specified in the module definition as the owner.
- c.sdkLibraryComponentProperties.SdkLibraryToImplicitlyTrack = proptools.StringPtr(c.module.BaseModuleName())
+ c.sdkLibraryComponentProperties.SdkLibraryToImplicitlyTrack = namePtr
}
return true
}
+// uniqueApexVariations provides common implementation of the ApexModule.UniqueApexVariations
+// method.
+func (c *commonToSdkLibraryAndImport) uniqueApexVariations() bool {
+ // A java_sdk_library that is a shared library produces an XML file that makes the shared library
+ // usable from an AndroidManifest.xml's <uses-library> entry. That XML file contains the name of
+ // the APEX and so it needs a unique variation per APEX.
+ return c.sharedLibrary()
+}
+
func (c *commonToSdkLibraryAndImport) generateCommonBuildActions(ctx android.ModuleContext) {
c.doctagPaths = android.PathsForModuleSrc(ctx, c.commonSdkLibraryProperties.Doctag_files)
}
@@ -913,15 +925,19 @@ func (c *commonToSdkLibraryAndImport) SdkRemovedTxtFile(ctx android.BaseModuleCo
func (c *commonToSdkLibraryAndImport) sdkComponentPropertiesForChildLibrary() interface{} {
componentProps := &struct {
+ SdkLibraryName *string
SdkLibraryToImplicitlyTrack *string
}{}
+ namePtr := proptools.StringPtr(c.module.BaseModuleName())
+ componentProps.SdkLibraryName = namePtr
+
if c.sharedLibrary() {
// Mark the stubs library as being components of this java_sdk_library so that
// any app that includes code which depends (directly or indirectly) on the stubs
// library will have the appropriate <uses-library> invocation inserted into its
// manifest if necessary.
- componentProps.SdkLibraryToImplicitlyTrack = proptools.StringPtr(c.module.BaseModuleName())
+ componentProps.SdkLibraryToImplicitlyTrack = namePtr
}
return componentProps
@@ -940,6 +956,8 @@ func (c *commonToSdkLibraryAndImport) stubLibrariesCompiledForDex() bool {
// Properties related to the use of a module as an component of a java_sdk_library.
type SdkLibraryComponentProperties struct {
+ // The name of the java_sdk_library/_import module.
+ SdkLibraryName *string `blueprint:"mutated"`
// The name of the java_sdk_library/_import to add to a <uses-library> entry
// in the AndroidManifest.xml of any Android app that includes code that references
@@ -958,6 +976,11 @@ func (e *EmbeddableSdkLibraryComponent) initSdkLibraryComponent(module android.M
}
// to satisfy SdkLibraryComponentDependency
+func (e *EmbeddableSdkLibraryComponent) SdkLibraryName() *string {
+ return e.sdkLibraryComponentProperties.SdkLibraryName
+}
+
+// to satisfy SdkLibraryComponentDependency
func (e *EmbeddableSdkLibraryComponent) OptionalImplicitSdkLibrary() *string {
return e.sdkLibraryComponentProperties.SdkLibraryToImplicitlyTrack
}
@@ -973,6 +996,9 @@ func (e *EmbeddableSdkLibraryComponent) OptionalSdkLibraryImplementation() *stri
type SdkLibraryComponentDependency interface {
UsesLibraryDependency
+ // SdkLibraryName returns the name of the java_sdk_library/_import module.
+ SdkLibraryName() *string
+
// The optional name of the sdk library that should be implicitly added to the
// AndroidManifest of an app that contains code which references the sdk library.
//
@@ -1528,6 +1554,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
mctx.CreateModule(DroidstubsFactory, &props)
}
+// Implements android.ApexModule
func (module *SdkLibrary) DepIsInSameApex(mctx android.BaseModuleContext, dep android.Module) bool {
depTag := mctx.OtherModuleDependencyTag(dep)
if depTag == xmlPermissionsFileTag {
@@ -1536,6 +1563,11 @@ func (module *SdkLibrary) DepIsInSameApex(mctx android.BaseModuleContext, dep an
return module.Library.DepIsInSameApex(mctx, dep)
}
+// Implements android.ApexModule
+func (module *SdkLibrary) UniqueApexVariations() bool {
+ return module.uniqueApexVariations()
+}
+
// Creates the xml file that publicizes the runtime library
func (module *SdkLibrary) createXmlFile(mctx android.DefaultableHookContext) {
props := struct {
@@ -2090,6 +2122,11 @@ func (module *SdkLibraryImport) ShouldSupportSdkVersion(ctx android.BaseModuleCo
return nil
}
+// Implements android.ApexModule
+func (module *SdkLibraryImport) UniqueApexVariations() bool {
+ return module.uniqueApexVariations()
+}
+
func (module *SdkLibraryImport) OutputFiles(tag string) (android.Paths, error) {
return module.commonOutputFiles(tag)
}