Clean up some of the code around effective license.
Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: I01f0407e4eb6050b556bfebc1cc4d1abd29ad4a6
diff --git a/android/license.go b/android/license.go
index ffda58b..7b4aeeb 100644
--- a/android/license.go
+++ b/android/license.go
@@ -19,7 +19,6 @@
)
type LicenseInfo struct {
- EffectiveLicenses []string
PackageName *string
EffectiveLicenseText NamedPaths
EffectiveLicenseKinds []string
@@ -79,23 +78,23 @@
func (m *licenseModule) GenerateAndroidBuildActions(ctx ModuleContext) {
// license modules have no licenses, but license_kinds must refer to license_kind modules
- mergeStringProps(&m.base().commonProperties.Effective_licenses, ctx.ModuleName())
namePathProps(&m.base().commonProperties.Effective_license_text, m.properties.Package_name, PathsForModuleSrc(ctx, m.properties.License_text)...)
+ var conditions []string
+ var kinds []string
for _, module := range ctx.GetDirectDepsProxyWithTag(licenseKindTag) {
if lk, ok := OtherModuleProvider(ctx, module, LicenseKindInfoProvider); ok {
- mergeStringProps(&m.base().commonProperties.Effective_license_conditions, lk.Conditions...)
- mergeStringProps(&m.base().commonProperties.Effective_license_kinds, ctx.OtherModuleName(module))
+ conditions = append(conditions, lk.Conditions...)
+ kinds = append(kinds, ctx.OtherModuleName(module))
} else {
ctx.ModuleErrorf("license_kinds property %q is not a license_kind module", ctx.OtherModuleName(module))
}
}
SetProvider(ctx, LicenseInfoProvider, LicenseInfo{
- EffectiveLicenses: m.base().commonProperties.Effective_licenses,
PackageName: m.properties.Package_name,
EffectiveLicenseText: m.base().commonProperties.Effective_license_text,
- EffectiveLicenseKinds: m.base().commonProperties.Effective_license_kinds,
- EffectiveLicenseConditions: m.base().commonProperties.Effective_license_conditions,
+ EffectiveLicenseKinds: SortedUniqueStrings(kinds),
+ EffectiveLicenseConditions: SortedUniqueStrings(conditions),
})
}