Fix droiddoc disting when WITHOUT_CHECK_API is true.

When WITHOUT_CHECK_API=true, the droidstubs apiFile can be nil. Fix this
by defensively checking for nil paths when making the TaggedDistFiles,
and also in android.MakeDefaultDistFiles.

The error message reported in r.android.com/1335521 was:

"internal error: panic in GenerateBuildActions for singleton androidmk
  Dist file should not be nil for the default tag in
  android.net.ipsec.ike.stubs.source in translateAndroidMkModule for
  module android.net.ipsec.ike.stubs.source variant android_common"

Test: WITHOUT_CHECK_API=true m droid dist

Bug: 152834186
Signed-off-by: Jingwen Chen <jingwen@google.com>
Change-Id: I1b1f7c0b7a0e1c0ed5e15957d0162c47fd3ec197
This commit is contained in:
Jingwen Chen
2020-07-24 09:13:49 +00:00
parent 3992b7c486
commit 7b27ca7dad
3 changed files with 19 additions and 4 deletions

View File

@@ -163,12 +163,15 @@ func (a *AndroidMkEntries) GetDistForGoals(mod blueprint.Module) []string {
name := amod.BaseModuleName()
var ret []string
var availableTaggedDists TaggedDistFiles
availableTaggedDists := TaggedDistFiles{}
if a.DistFiles != nil {
availableTaggedDists = a.DistFiles
} else if a.OutputFile.Valid() {
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.