java_sdk_library: Only expose impl jars when they are built am: daaa332827 am: d3320c8787

Change-Id: I708870ffee014e50c7bbeb018672bfb9bac03a91
This commit is contained in:
Paul Duffin
2020-05-26 22:08:22 +00:00
committed by Automerger Merge Worker
2 changed files with 38 additions and 9 deletions

View File

@@ -1297,15 +1297,18 @@ func PrebuiltJars(ctx android.BaseModuleContext, baseName string, s sdkSpec) and
func (module *SdkLibrary) sdkJars(ctx android.BaseModuleContext, sdkVersion sdkSpec, headerJars bool) android.Paths {
// Check any special cases for java_sdk_library.
//
// Only allow access to the implementation library in the following condition:
// * No sdk_version specified on the referencing module.
if sdkVersion.kind == sdkPrivate {
if headerJars {
return module.HeaderJars()
} else {
return module.ImplementationJars()
// Only provide access to the implementation library if it is actually built.
if module.requiresRuntimeImplementationLibrary() {
// Check any special cases for java_sdk_library.
//
// Only allow access to the implementation library in the following condition:
// * No sdk_version specified on the referencing module.
if sdkVersion.kind == sdkPrivate {
if headerJars {
return module.HeaderJars()
} else {
return module.ImplementationJars()
}
}
}