java_sdk_library: Expose implementation within APEX am: 9b879594ed
am: af853b758f
Change-Id: I428d88113401ab9e6befef2574a01d8579e91c55
This commit is contained in:
@@ -1295,6 +1295,24 @@ func PrebuiltJars(ctx android.BaseModuleContext, baseName string, s sdkSpec) and
|
||||
return android.Paths{jarPath.Path()}
|
||||
}
|
||||
|
||||
// Get the apex name for module, "" if it is for platform.
|
||||
func getApexNameForModule(module android.Module) string {
|
||||
if apex, ok := module.(android.ApexModule); ok {
|
||||
return apex.ApexName()
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// Check to see if the other module is within the same named APEX as this module.
|
||||
//
|
||||
// If either this or the other module are on the platform then this will return
|
||||
// false.
|
||||
func (module *SdkLibrary) withinSameApexAs(other android.Module) bool {
|
||||
name := module.ApexName()
|
||||
return name != "" && getApexNameForModule(other) == name
|
||||
}
|
||||
|
||||
func (module *SdkLibrary) sdkJars(ctx android.BaseModuleContext, sdkVersion sdkSpec, headerJars bool) android.Paths {
|
||||
|
||||
// Only provide access to the implementation library if it is actually built.
|
||||
@@ -1303,7 +1321,8 @@ func (module *SdkLibrary) sdkJars(ctx android.BaseModuleContext, sdkVersion sdkS
|
||||
//
|
||||
// Only allow access to the implementation library in the following condition:
|
||||
// * No sdk_version specified on the referencing module.
|
||||
if sdkVersion.kind == sdkPrivate {
|
||||
// * The referencing module is in the same apex as this.
|
||||
if sdkVersion.kind == sdkPrivate || module.withinSameApexAs(ctx.Module()) {
|
||||
if headerJars {
|
||||
return module.HeaderJars()
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user