java_sdk_library: Correct stubs source generation classpath

The stubs source should be generated using the same classpath that is
used to compile the implementation library, i.e. sdk_version,
system_modules and libs/static_libs.

Previously, the sdk_version used to generate the stubs was different.
It provided access to a wider API surface than was necessary. This
change fixes that.

Test: m checkapi
Bug: 155164730
Change-Id: I7bc54dc4ad12a7d6c7503111d1322ee35c56d713
This commit is contained in:
Paul Duffin 2020-04-28 14:08:32 +01:00
parent 260bd316bf
commit 7b78b4d404

View file

@ -498,17 +498,15 @@ func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiSc
}
}{}
sdkDep := decodeSdkDep(mctx, sdkContext(&module.Library))
// Use the platform API if standard libraries were requested, otherwise use
// no default libraries.
sdkVersion := ""
if !sdkDep.hasStandardLibs() {
sdkVersion = "none"
}
// The stubs source processing uses the same compile time classpath when extracting the
// API from the implementation library as it does when compiling it. i.e. the same
// * sdk version
// * system_modules
// * libs (static_libs/libs)
props.Name = proptools.StringPtr(module.docsName(apiScope))
props.Srcs = append(props.Srcs, module.Library.Module.properties.Srcs...)
props.Sdk_version = proptools.StringPtr(sdkVersion)
props.Sdk_version = module.Library.Module.deviceProperties.Sdk_version
props.System_modules = module.Library.Module.deviceProperties.System_modules
props.Installable = proptools.BoolPtr(false)
// A droiddoc module has only one Libs property and doesn't distinguish between