Allow droidstubs to not generate any stubs
Needed to optimize the handling of the module_lib API surface which currently has to be generated with two separate droidstubs instances, one to generate the stubs and another to generate the .txt file. This allows the module generating the .txt file to avoid also wasting time generating stubs that are not used. This change: * Adds a generate_stubs property that defaults to true to allow the behavior to be customized on a per module basis. * Uses either the stubs srcjar or the api .txt file as the OutputFile for the AndroidMkEntries to ensure that they get written out properly. * Rearranges the code for generating stubs to make it easier to turn it off. Bug: 146727827 Test: m droid Check output dir of framework-sdkextensions-api-module_libs_api to make sure it does not contain any sources or srcjars. Change-Id: Ib8025019f8a7a8cf5fa8765d76b5ad470af20006
This commit is contained in:
@@ -545,10 +545,21 @@ func (ddoc *Droiddoc) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
}
|
||||
|
||||
func (dstubs *Droidstubs) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
// If the stubsSrcJar is not generated (because generate_stubs is false) then
|
||||
// use the api file as the output file to ensure the relevant phony targets
|
||||
// are created in make if only the api txt file is being generated. This is
|
||||
// needed because an invalid output file would prevent the make entries from
|
||||
// being written.
|
||||
// TODO(b/146727827): Revert when we do not need to generate stubs and API separately.
|
||||
distFile := android.OptionalPathForPath(dstubs.apiFile)
|
||||
outputFile := android.OptionalPathForPath(dstubs.stubsSrcJar)
|
||||
if !outputFile.Valid() {
|
||||
outputFile = distFile
|
||||
}
|
||||
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
||||
Class: "JAVA_LIBRARIES",
|
||||
DistFile: android.OptionalPathForPath(dstubs.apiFile),
|
||||
OutputFile: android.OptionalPathForPath(dstubs.stubsSrcJar),
|
||||
DistFile: distFile,
|
||||
OutputFile: outputFile,
|
||||
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
||||
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
||||
func(entries *android.AndroidMkEntries) {
|
||||
|
Reference in New Issue
Block a user