Convert licensesPropertyFlattener to use ModuleProxy.
Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: Iff8fd64e3938cde8950d8144f03a5fbde8bdfe6e
diff --git a/android/licenses.go b/android/licenses.go
index 53d0555..77f563f 100644
--- a/android/licenses.go
+++ b/android/licenses.go
@@ -227,16 +227,16 @@
}
var licenses []string
- for _, module := range ctx.GetDirectDepsWithTag(licensesTag) {
- if l, ok := module.(*licenseModule); ok {
+ for _, module := range ctx.GetDirectDepsProxyWithTag(licensesTag) {
+ if l, ok := OtherModuleProvider(ctx, module, LicenseInfoProvider); ok {
licenses = append(licenses, ctx.OtherModuleName(module))
- if m.base().commonProperties.Effective_package_name == nil && l.properties.Package_name != nil {
- m.base().commonProperties.Effective_package_name = l.properties.Package_name
+ if m.base().commonProperties.Effective_package_name == nil && l.PackageName != nil {
+ m.base().commonProperties.Effective_package_name = l.PackageName
}
- mergeStringProps(&m.base().commonProperties.Effective_licenses, module.base().commonProperties.Effective_licenses...)
- mergeNamedPathProps(&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...)
+ mergeStringProps(&m.base().commonProperties.Effective_licenses, l.EffectiveLicenses...)
+ mergeNamedPathProps(&m.base().commonProperties.Effective_license_text, l.EffectiveLicenseText...)
+ mergeStringProps(&m.base().commonProperties.Effective_license_kinds, l.EffectiveLicenseKinds...)
+ mergeStringProps(&m.base().commonProperties.Effective_license_conditions, l.EffectiveLicenseConditions...)
} else {
propertyName := "licenses"
primaryProperty := m.base().primaryLicensesProperty
@@ -248,10 +248,10 @@
}
// Make the license information available for other modules.
- licenseInfo := LicenseInfo{
+ licenseInfo := LicensesInfo{
Licenses: licenses,
}
- SetProvider(ctx, LicenseInfoProvider, licenseInfo)
+ SetProvider(ctx, LicensesInfoProvider, licenseInfo)
}
// Update a property string array with a distinct union of its values and a list of new values.
@@ -336,14 +336,14 @@
return true
}
-// LicenseInfo contains information about licenses for a specific module.
-type LicenseInfo struct {
+// LicensesInfo contains information about licenses for a specific module.
+type LicensesInfo struct {
// The list of license modules this depends upon, either explicitly or through default package
// configuration.
Licenses []string
}
-var LicenseInfoProvider = blueprint.NewProvider[LicenseInfo]()
+var LicensesInfoProvider = blueprint.NewProvider[LicensesInfo]()
func init() {
RegisterMakeVarsProvider(pctx, licensesMakeVarsProvider)