Build license metadata files in Soong

Soong has enough information to build the license metadata files
without resorting to the fixups required in Make.

Bug: 207445310
Test: m checkbuild
Change-Id: I8e74108376162b8fdb87ba098ebe94350aa1f7c4
This commit is contained in:
Colin Cross
2021-11-08 11:52:49 -08:00
parent 1c35f243c5
commit 3dd2ff28ed
7 changed files with 286 additions and 23 deletions

View File

@@ -309,19 +309,17 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
return moduleNames
}
func (a *apexBundle) writeRequiredModules(w io.Writer, apexBundleName string) {
func (a *apexBundle) writeRequiredModules(w io.Writer) {
var required []string
var targetRequired []string
var hostRequired []string
required = append(required, a.RequiredModuleNames()...)
targetRequired = append(targetRequired, a.TargetRequiredModuleNames()...)
hostRequired = append(hostRequired, a.HostRequiredModuleNames()...)
installMapSet := make(map[string]bool) // set of dependency module:location mappings
for _, fi := range a.filesInfo {
required = append(required, fi.requiredModuleNames...)
targetRequired = append(targetRequired, fi.targetRequiredModuleNames...)
hostRequired = append(hostRequired, fi.hostRequiredModuleNames...)
installMapSet[a.fullModuleName(apexBundleName, &fi)+":"+fi.installDir+"/"+fi.builtFile.Base()] = true
}
if len(required) > 0 {
@@ -333,11 +331,6 @@ func (a *apexBundle) writeRequiredModules(w io.Writer, apexBundleName string) {
if len(hostRequired) > 0 {
fmt.Fprintln(w, "LOCAL_HOST_REQUIRED_MODULES +=", strings.Join(hostRequired, " "))
}
if len(installMapSet) > 0 {
var installs []string
installs = append(installs, android.SortedStringKeys(installMapSet)...)
fmt.Fprintln(w, "LOCAL_LICENSE_INSTALL_MAP +=", strings.Join(installs, " "))
}
}
func (a *apexBundle) androidMkForType() android.AndroidMkData {
@@ -359,7 +352,7 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
if len(moduleNames) > 0 {
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " "))
}
a.writeRequiredModules(w, name)
a.writeRequiredModules(w)
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
} else {
@@ -401,7 +394,7 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
if len(a.requiredDeps) > 0 {
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(a.requiredDeps, " "))
}
a.writeRequiredModules(w, name)
a.writeRequiredModules(w)
if a.mergedNotices.Merged.Valid() {
fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", a.mergedNotices.Merged.Path().String())