summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/androidmk.go2
-rw-r--r--android/license.go8
-rw-r--r--android/licenses.go27
-rw-r--r--android/licenses_test.go2
-rw-r--r--android/module.go2
5 files changed, 20 insertions, 21 deletions
diff --git a/android/androidmk.go b/android/androidmk.go
index 590eceba4..557e7bac8 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -501,7 +501,7 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint
a.SetString("LOCAL_MODULE", name+a.SubName)
a.AddStrings("LOCAL_LICENSE_KINDS", amod.commonProperties.Effective_license_kinds...)
a.AddStrings("LOCAL_LICENSE_CONDITIONS", amod.commonProperties.Effective_license_conditions...)
- a.AddStrings("LOCAL_NOTICE_FILE", amod.commonProperties.Effective_license_text...)
+ a.AddStrings("LOCAL_NOTICE_FILE", amod.commonProperties.Effective_license_text.Strings()...)
// TODO(b/151177513): Does this code need to set LOCAL_MODULE_IS_CONTAINER ?
if amod.commonProperties.Effective_package_name != nil {
a.SetString("LOCAL_LICENSE_PACKAGE_NAME", *amod.commonProperties.Effective_package_name)
diff --git a/android/license.go b/android/license.go
index d571b1f35..8bfd3baa2 100644
--- a/android/license.go
+++ b/android/license.go
@@ -62,12 +62,12 @@ func (m *licenseModule) DepsMutator(ctx BottomUpMutatorContext) {
func (m *licenseModule) GenerateAndroidBuildActions(ctx ModuleContext) {
// license modules have no licenses, but license_kinds must refer to license_kind modules
- mergeProps(&m.base().commonProperties.Effective_licenses, ctx.ModuleName())
- mergeProps(&m.base().commonProperties.Effective_license_text, PathsForModuleSrc(ctx, m.properties.License_text).Strings()...)
+ mergeStringProps(&m.base().commonProperties.Effective_licenses, ctx.ModuleName())
+ mergePathProps(&m.base().commonProperties.Effective_license_text, PathsForModuleSrc(ctx, m.properties.License_text)...)
for _, module := range ctx.GetDirectDepsWithTag(licenseKindTag) {
if lk, ok := module.(*licenseKindModule); ok {
- mergeProps(&m.base().commonProperties.Effective_license_conditions, lk.properties.Conditions...)
- mergeProps(&m.base().commonProperties.Effective_license_kinds, ctx.OtherModuleName(module))
+ mergeStringProps(&m.base().commonProperties.Effective_license_conditions, lk.properties.Conditions...)
+ mergeStringProps(&m.base().commonProperties.Effective_license_kinds, ctx.OtherModuleName(module))
} else {
ctx.ModuleErrorf("license_kinds property %q is not a license_kind module", ctx.OtherModuleName(module))
}
diff --git a/android/licenses.go b/android/licenses.go
index 933c2f7df..c9e1da40f 100644
--- a/android/licenses.go
+++ b/android/licenses.go
@@ -196,10 +196,10 @@ func licensesPropertyFlattener(ctx ModuleContext) {
if m.base().commonProperties.Effective_package_name == nil && l.properties.Package_name != nil {
m.base().commonProperties.Effective_package_name = l.properties.Package_name
}
- mergeProps(&m.base().commonProperties.Effective_licenses, module.base().commonProperties.Effective_licenses...)
- mergeProps(&m.base().commonProperties.Effective_license_text, module.base().commonProperties.Effective_license_text...)
- mergeProps(&m.base().commonProperties.Effective_license_kinds, module.base().commonProperties.Effective_license_kinds...)
- mergeProps(&m.base().commonProperties.Effective_license_conditions, module.base().commonProperties.Effective_license_conditions...)
+ mergeStringProps(&m.base().commonProperties.Effective_licenses, module.base().commonProperties.Effective_licenses...)
+ mergePathProps(&m.base().commonProperties.Effective_license_text, module.base().commonProperties.Effective_license_text...)
+ mergeStringProps(&m.base().commonProperties.Effective_license_kinds, module.base().commonProperties.Effective_license_kinds...)
+ mergeStringProps(&m.base().commonProperties.Effective_license_conditions, module.base().commonProperties.Effective_license_conditions...)
} else {
propertyName := "licenses"
primaryProperty := m.base().primaryLicensesProperty
@@ -212,16 +212,15 @@ func licensesPropertyFlattener(ctx ModuleContext) {
}
// Update a property string array with a distinct union of its values and a list of new values.
-func mergeProps(prop *[]string, values ...string) {
- s := make(map[string]bool)
- for _, v := range *prop {
- s[v] = true
- }
- for _, v := range values {
- s[v] = true
- }
- *prop = []string{}
- *prop = append(*prop, SortedStringKeys(s)...)
+func mergeStringProps(prop *[]string, values ...string) {
+ *prop = append(*prop, values...)
+ *prop = SortedUniqueStrings(*prop)
+}
+
+// Update a property Path array with a distinct union of its values and a list of new values.
+func mergePathProps(prop *Paths, values ...Path) {
+ *prop = append(*prop, values...)
+ *prop = SortedUniquePaths(*prop)
}
// Get the licenses property falling back to the package default.
diff --git a/android/licenses_test.go b/android/licenses_test.go
index 9b2e06c17..85033100f 100644
--- a/android/licenses_test.go
+++ b/android/licenses_test.go
@@ -658,7 +658,7 @@ func checkEffectiveNotices(t *testing.T, result *TestResult, effectiveNotices ma
if base == nil {
return
}
- actualNotices[m.Name()] = base.commonProperties.Effective_license_text
+ actualNotices[m.Name()] = base.commonProperties.Effective_license_text.Strings()
})
for moduleName, expectedNotices := range effectiveNotices {
diff --git a/android/module.go b/android/module.go
index 99606d165..9bc27a749 100644
--- a/android/module.go
+++ b/android/module.go
@@ -688,7 +688,7 @@ type commonProperties struct {
// Override of module name when reporting licenses
Effective_package_name *string `blueprint:"mutated"`
// Notice files
- Effective_license_text []string `blueprint:"mutated"`
+ Effective_license_text Paths `blueprint:"mutated"`
// License names
Effective_license_kinds []string `blueprint:"mutated"`
// License conditions