diff options
author | 2021-01-06 18:08:07 +0000 | |
---|---|---|
committer | 2021-01-06 18:08:07 +0000 | |
commit | 659f11fcfcc55f97b5d6ca6e75668fecbeaa01c3 (patch) | |
tree | 114ba80c3c6fa81ee49de3c25df1da1b054d6730 /apex/androidmk.go | |
parent | 5542859c312bac47097a116d5d439727fefa24a1 (diff) | |
parent | 13351b2c7d181f6d100001e86ca3faa6cabb92eb (diff) |
Merge changes from topic "metalics"
* changes:
Define the standard license_kind rules.
Export soong license data to make.
Add ability to declare licenses in soong.
Diffstat (limited to 'apex/androidmk.go')
-rw-r--r-- | apex/androidmk.go | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/apex/androidmk.go b/apex/androidmk.go index e7f8b7ff1..0b114f83b 100644 --- a/apex/androidmk.go +++ b/apex/androidmk.go @@ -63,6 +63,16 @@ func (class apexFileClass) nameInMake() string { } } +// Return the full module name for a dependency module, which appends the apex module name unless re-using a system lib. +func (a *apexBundle) fullModuleName(apexBundleName string, fi *apexFile) string { + linkToSystemLib := a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform() + + if linkToSystemLib { + return fi.androidMkModuleName + } + return fi.androidMkModuleName + "." + apexBundleName + a.suffix +} + func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, moduleDir string, apexAndroidMkData android.AndroidMkData) []string { @@ -114,12 +124,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo linkToSystemLib := a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform() - var moduleName string - if linkToSystemLib { - moduleName = fi.androidMkModuleName - } else { - moduleName = fi.androidMkModuleName + "." + apexBundleName + a.suffix - } + moduleName := a.fullModuleName(apexBundleName, &fi) if !android.InList(moduleName, moduleNames) { moduleNames = append(moduleNames, moduleName) @@ -311,14 +316,16 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo return moduleNames } -func (a *apexBundle) writeRequiredModules(w io.Writer) { +func (a *apexBundle) writeRequiredModules(w io.Writer, apexBundleName string) { var required []string var targetRequired []string var hostRequired []string + 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 { @@ -330,6 +337,11 @@ func (a *apexBundle) writeRequiredModules(w io.Writer) { 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 { @@ -347,16 +359,18 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData { fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)") fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir) fmt.Fprintln(w, "LOCAL_MODULE :=", name+a.suffix) + data.Entries.WriteLicenseVariables(w) if len(moduleNames) > 0 { fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " ")) } - a.writeRequiredModules(w) + a.writeRequiredModules(w, name) fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)") } else { fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)") fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir) fmt.Fprintln(w, "LOCAL_MODULE :=", name+a.suffix) + data.Entries.WriteLicenseVariables(w) fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC") // do we need a new class? fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", a.outputFile.String()) fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.ToMakePath().String()) @@ -389,7 +403,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) + a.writeRequiredModules(w, name) var postInstallCommands []string if a.prebuiltFileToDelete != "" { postInstallCommands = append(postInstallCommands, "rm -rf "+ |