Merge "Fix droiddoc disting when WITHOUT_CHECK_API is true."

This commit is contained in:
Jingwen Chen
2020-08-10 05:22:24 +00:00
committed by Gerrit Code Review
3 changed files with 19 additions and 4 deletions

View File

@@ -183,12 +183,15 @@ func (a *AndroidMkEntries) GetDistForGoals(mod blueprint.Module) []string {
name := amod.BaseModuleName() name := amod.BaseModuleName()
var ret []string var ret []string
var availableTaggedDists TaggedDistFiles
availableTaggedDists := TaggedDistFiles{}
if a.DistFiles != nil { if a.DistFiles != nil {
availableTaggedDists = a.DistFiles availableTaggedDists = a.DistFiles
} else if a.OutputFile.Valid() { } else if a.OutputFile.Valid() {
availableTaggedDists = MakeDefaultDistFiles(a.OutputFile.Path()) availableTaggedDists = MakeDefaultDistFiles(a.OutputFile.Path())
} else {
// Nothing dist-able for this module.
return nil
} }
// Iterate over this module's dist structs, merged from the dist and dists properties. // Iterate over this module's dist structs, merged from the dist and dists properties.

View File

@@ -569,6 +569,12 @@ type commonProperties struct {
type TaggedDistFiles map[string]Paths type TaggedDistFiles map[string]Paths
func MakeDefaultDistFiles(paths ...Path) TaggedDistFiles { func MakeDefaultDistFiles(paths ...Path) TaggedDistFiles {
for _, path := range paths {
if path == nil {
panic("The path to a dist file cannot be nil.")
}
}
// The default OutputFile tag is the empty "" string. // The default OutputFile tag is the empty "" string.
return TaggedDistFiles{"": paths} return TaggedDistFiles{"": paths}
} }

View File

@@ -559,15 +559,21 @@ func (dstubs *Droidstubs) AndroidMkEntries() []android.AndroidMkEntries {
// are created in make if only the api txt file is being generated. This is // 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 // needed because an invalid output file would prevent the make entries from
// being written. // being written.
//
// Note that dstubs.apiFile can be also be nil if WITHOUT_CHECKS_API is true.
// TODO(b/146727827): Revert when we do not need to generate stubs and API separately. // TODO(b/146727827): Revert when we do not need to generate stubs and API separately.
distFile := dstubs.apiFile
var distFiles android.TaggedDistFiles
if dstubs.apiFile != nil {
distFiles = android.MakeDefaultDistFiles(dstubs.apiFile)
}
outputFile := android.OptionalPathForPath(dstubs.stubsSrcJar) outputFile := android.OptionalPathForPath(dstubs.stubsSrcJar)
if !outputFile.Valid() { if !outputFile.Valid() {
outputFile = android.OptionalPathForPath(distFile) outputFile = android.OptionalPathForPath(dstubs.apiFile)
} }
return []android.AndroidMkEntries{android.AndroidMkEntries{ return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES", Class: "JAVA_LIBRARIES",
DistFiles: android.MakeDefaultDistFiles(distFile), DistFiles: distFiles,
OutputFile: outputFile, OutputFile: outputFile,
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{