Fix dist(s)-with-tag and add tests to prevent regression.
While AndroidMkEntries' DistFiles were populated from java_library
properly, there was a bug in the conditionals that dropped the tagged
DistFiles.
Fixes b/152834186
Fixes b/161339864
Test: soong tests, m sdk dist (creates out/dist/test.jar with
aosp/1363578)
Signed-off-by: Jingwen Chen <jingwen@google.com>
Exempt-From-Owner-Approval: cherry-pick from master
Change-Id: Id895282256fd367b2f46dcb7a643465fa66c9456
Merged-In: Id895282256fd367b2f46dcb7a643465fa66c9456
(cherry picked from commit 8481186d56
)
This commit is contained in:
parent
8f9ff047e2
commit
06c3b41857
|
@ -185,7 +185,7 @@ func (a *AndroidMkEntries) GetDistForGoals(mod blueprint.Module) []string {
|
|||
var ret []string
|
||||
|
||||
availableTaggedDists := TaggedDistFiles{}
|
||||
if a.DistFiles != nil && len(a.DistFiles[""]) > 0 {
|
||||
if a.DistFiles != nil {
|
||||
availableTaggedDists = a.DistFiles
|
||||
} else if a.OutputFile.Valid() {
|
||||
availableTaggedDists = MakeDefaultDistFiles(a.OutputFile.Path())
|
||||
|
|
|
@ -45,6 +45,8 @@ func (m *customModule) OutputFiles(tag string) (Paths, error) {
|
|||
return PathsForTesting("one.out"), nil
|
||||
case ".multiple":
|
||||
return PathsForTesting("two.out", "three/four.out"), nil
|
||||
case ".another-tag":
|
||||
return PathsForTesting("another.out"), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
||||
}
|
||||
|
@ -119,6 +121,38 @@ func TestGetDistForGoals(t *testing.T) {
|
|||
"$(call dist-for-goals,my_goal,one.out:one.out)\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
bp: `
|
||||
custom {
|
||||
name: "foo",
|
||||
dist: {
|
||||
targets: ["my_goal"],
|
||||
tag: ".another-tag",
|
||||
}
|
||||
}
|
||||
`,
|
||||
expectedAndroidMkLines: []string{
|
||||
".PHONY: my_goal\n",
|
||||
"$(call dist-for-goals,my_goal,another.out:another.out)\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
bp: `
|
||||
custom {
|
||||
name: "foo",
|
||||
dists: [
|
||||
{
|
||||
targets: ["my_goal"],
|
||||
tag: ".another-tag",
|
||||
},
|
||||
],
|
||||
}
|
||||
`,
|
||||
expectedAndroidMkLines: []string{
|
||||
".PHONY: my_goal\n",
|
||||
"$(call dist-for-goals,my_goal,another.out:another.out)\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
bp: `
|
||||
custom {
|
||||
|
|
Loading…
Reference in New Issue