Make sure dist files have license metadata.

Bug: 151177513
Bug: 210912771

Test: m droid dist reportmissinglicenses

Change-Id: I0c85f6c49a3e9d9bb3219ed6ddfb939d90f80656
This commit is contained in:
Bob Badour
2022-04-13 11:27:19 -07:00
parent 44b368df87
commit 5180438478
5 changed files with 27 additions and 2 deletions

View File

@@ -288,6 +288,8 @@ func (a *AndroidMkEntries) AddCompatibilityTestSuites(suites ...string) {
// The contributions to the dist.
type distContributions struct {
// Path to license metadata file.
licenseMetadataFile Path
// List of goals and the dist copy instructions.
copiesForGoals []*copiesForGoals
}
@@ -364,6 +366,8 @@ func (a *AndroidMkEntries) getDistContributions(mod blueprint.Module) *distContr
// Collate the contributions this module makes to the dist.
distContributions := &distContributions{}
distContributions.licenseMetadataFile = amod.licenseMetadataFile
// Iterate over this module's dist structs, merged from the dist and dists properties.
for _, dist := range amod.Dists() {
// Get the list of goals this dist should be enabled for. e.g. sdk, droidcore
@@ -454,6 +458,10 @@ 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()))
ret = append(
ret,
fmt.Sprintf("$(call dist-for-goals,%s,%s:%s)\n", d.goals, c.from.String(), c.dest))