Fix missing NOTICE targets for static libs that aren't available to

platform.

The NOTICE file generation depends on the NOTICE targets for all static
library dependencies. If such a dependency didn't have
//apex_available:platform it didn't get any AndroidMk entry and hence
no NOTICE target via soong_cc_prebuilt.mk. If it was then depended upon
by a binary or library that is accessible to platform, the NOTICE
dependency failed.

Normally such a dependency is invalid, but there are corner cases where
binaries go neither into platform nor any APEX module, and they can
legitimately have such dependencies (cf. b/152241137).

With this CL requests to skip installation of such a static libraries
are ignored so that they get AndroidMk entries, which will always have
LOCAL_UNINSTALLABLE_MODULE set.

Test: "m simpleperf_ndk" with https://r.android.com/1273016, which
  removes //apex_available:platform from libs that simpleperf_ndk
  depends on statically.
Bug: 152241137
Bug: 149217815
Change-Id: If36e85dd16ade56d4ec1d6744811df5a15b6242c
This commit is contained in:
Martin Stjernholm
2020-03-31 16:05:34 +01:00
parent 0ad0e940c0
commit bf37d165f0
5 changed files with 34 additions and 0 deletions

View File

@@ -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 {