Integrate gen_notice with Make for dist.

Most exempt module types have no output. Support exempt module types
with output by requiring they must be 0p and have no license metadata.

Disallow `licenses: []` property on gen_notice.

Test: m cts dist

Change-Id: Ic992bd6420fa6898495866eac43495002ef4b6c8
Merged-in: Ic992bd6420fa6898495866eac43495002ef4b6c8
This commit is contained in:
Bob Badour
2022-09-12 16:06:03 -07:00
parent 2ba6d37e7b
commit 4660a9824c
3 changed files with 35 additions and 5 deletions

View File

@@ -366,7 +366,9 @@ func (a *AndroidMkEntries) getDistContributions(mod blueprint.Module) *distContr
// Collate the contributions this module makes to the dist.
distContributions := &distContributions{}
distContributions.licenseMetadataFile = amod.licenseMetadataFile
if !exemptFromRequiredApplicableLicensesProperty(mod.(Module)) {
distContributions.licenseMetadataFile = amod.licenseMetadataFile
}
// Iterate over this module's dist structs, merged from the dist and dists properties.
for _, dist := range amod.Dists() {
@@ -458,10 +460,12 @@ func generateDistContributionsForMake(distContributions *distContributions) []st
ret = append(ret, fmt.Sprintf(".PHONY: %s\n", d.goals))
// Create dist-for-goals calls for each of the copy instructions.
for _, c := range d.copies {
ret = append(
ret,
fmt.Sprintf("$(if $(strip $(ALL_TARGETS.%s.META_LIC)),,$(eval ALL_TARGETS.%s.META_LIC := %s))\n",
c.from.String(), c.from.String(), distContributions.licenseMetadataFile.String()))
if distContributions.licenseMetadataFile != nil {
ret = append(
ret,
fmt.Sprintf("$(if $(strip $(ALL_TARGETS.%s.META_LIC)),,$(eval ALL_TARGETS.%s.META_LIC := %s))\n",
c.from.String(), c.from.String(), distContributions.licenseMetadataFile.String()))
}
ret = append(
ret,
fmt.Sprintf("$(call dist-for-goals,%s,%s:%s)\n", d.goals, c.from.String(), c.dest))