summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2020-04-14 13:43:46 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-04-14 13:43:46 +0000
commite152ada4e760a7b9064ad262ceb581160e7f436e (patch)
tree5262bc5be9b0c9f8143a13fd921c9a13c3e1478e
parente5fce6cdbf1190ee172d5623716be4a9c3113ad1 (diff)
parentbf37d165f086982fad418c318f10949c514e8155 (diff)
Merge "Fix missing NOTICE targets for static libs that aren't available to platform."
-rw-r--r--cc/androidmk.go4
-rw-r--r--cc/cc.go9
-rw-r--r--cc/installer.go4
-rw-r--r--cc/library.go12
-rw-r--r--cc/prebuilt.go5
5 files changed, 34 insertions, 0 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 19c71826f..5438b149d 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -271,6 +271,10 @@ func (library *libraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries
entries.SubName = "." + library.stubsVersion()
}
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
+ // Note library.skipInstall() has a special case to get here for static
+ // libraries that otherwise would have skipped installation and hence not
+ // have executed AndroidMkEntries at all. The reason is to ensure they get
+ // a NOTICE file make target which other libraries might depend on.
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
if library.buildStubs() {
entries.SetBool("LOCAL_NO_NOTICE_FILE", true)
diff --git a/cc/cc.go b/cc/cc.go
index 8c21941e5..02014049b 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -404,6 +404,7 @@ type installer interface {
inSanitizerDir() bool
hostToolPath() android.OptionalPath
relativeInstallPath() string
+ skipInstall(mod *Module)
}
type xref interface {
@@ -2639,6 +2640,14 @@ func (c *Module) InstallInRecovery() bool {
return c.InRecovery()
}
+func (c *Module) SkipInstall() {
+ if c.installer == nil {
+ c.ModuleBase.SkipInstall()
+ return
+ }
+ c.installer.skipInstall(c)
+}
+
func (c *Module) HostToolPath() android.OptionalPath {
if c.installer == nil {
return android.OptionalPath{}
diff --git a/cc/installer.go b/cc/installer.go
index 200d59e9f..0b4a68cc8 100644
--- a/cc/installer.go
+++ b/cc/installer.go
@@ -106,3 +106,7 @@ func (installer *baseInstaller) hostToolPath() android.OptionalPath {
func (installer *baseInstaller) relativeInstallPath() string {
return String(installer.Properties.Relative_install_path)
}
+
+func (installer *baseInstaller) skipInstall(mod *Module) {
+ mod.ModuleBase.SkipInstall()
+}
diff --git a/cc/library.go b/cc/library.go
index 140f87a0a..94fffb951 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1329,6 +1329,18 @@ func (library *libraryDecorator) availableFor(what string) bool {
return android.CheckAvailableForApex(what, list)
}
+func (library *libraryDecorator) skipInstall(mod *Module) {
+ if library.static() && library.buildStatic() && !library.buildStubs() {
+ // If we're asked to skip installation of a static library (in particular
+ // when it's not //apex_available:platform) we still want an AndroidMk entry
+ // for it to ensure we get the relevant NOTICE file targets (cf.
+ // notice_files.mk) that other libraries might depend on. AndroidMkEntries
+ // always sets LOCAL_UNINSTALLABLE_MODULE for these entries.
+ return
+ }
+ mod.ModuleBase.SkipInstall()
+}
+
var versioningMacroNamesListKey = android.NewOnceKey("versioningMacroNamesList")
func versioningMacroNamesList(config android.Config) *map[string]string {
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index fc9cc17d3..2ef31950e 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -155,6 +155,10 @@ func (p *prebuiltLibraryLinker) disablePrebuilt() {
p.properties.Srcs = nil
}
+func (p *prebuiltLibraryLinker) skipInstall(mod *Module) {
+ mod.ModuleBase.SkipInstall()
+}
+
func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDecorator) {
module, library := NewLibrary(hod)
module.compiler = nil
@@ -163,6 +167,7 @@ func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDec
libraryDecorator: library,
}
module.linker = prebuilt
+ module.installer = prebuilt
module.AddProperties(&prebuilt.properties)