Stubs dependency is not installed
When the stubs variant of a library is dependend by a platform component
and the library is included in one or more APEX, the library is not
installed to the platform, because it is provided by APEX.
Bug: 120266448
Test: m
Test: add stubs: { versions: ["1"], }, to libnetd_resolv
then build netd. libnetd_resolv.so does not exist under /system.
Change-Id: I09b78e38df285033ef6e9c85f7ea4b0274e85070
This commit is contained in:
@@ -158,6 +158,14 @@ func DirectlyInAnyApex(config Config, moduleName string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests if moduleName is included in any APEX.
|
||||||
|
func InAnyApex(config Config, moduleName string) bool {
|
||||||
|
bundleNamesMapMutex.Lock()
|
||||||
|
defer bundleNamesMapMutex.Unlock()
|
||||||
|
bundleNames, ok := apexBundleNamesMap(config)[moduleName]
|
||||||
|
return ok && len(bundleNames) > 0
|
||||||
|
}
|
||||||
|
|
||||||
func InitApexModule(m ApexModule) {
|
func InitApexModule(m ApexModule) {
|
||||||
base := m.apexModuleBase()
|
base := m.apexModuleBase()
|
||||||
base.canHaveApexVariants = true
|
base.canHaveApexVariants = true
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ func (c *Module) AndroidMk() android.AndroidMkData {
|
|||||||
if len(c.Properties.AndroidMkWholeStaticLibs) > 0 {
|
if len(c.Properties.AndroidMkWholeStaticLibs) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_WHOLE_STATIC_LIBRARIES := "+strings.Join(c.Properties.AndroidMkWholeStaticLibs, " "))
|
fmt.Fprintln(w, "LOCAL_WHOLE_STATIC_LIBRARIES := "+strings.Join(c.Properties.AndroidMkWholeStaticLibs, " "))
|
||||||
}
|
}
|
||||||
|
if len(c.Properties.ApexesProvidingSharedLibs) > 0 {
|
||||||
|
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES := "+strings.Join(c.Properties.ApexesProvidingSharedLibs, " "))
|
||||||
|
}
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_LINK_TYPE :=", c.getMakeLinkType())
|
fmt.Fprintln(w, "LOCAL_SOONG_LINK_TYPE :=", c.getMakeLinkType())
|
||||||
if c.useVndk() {
|
if c.useVndk() {
|
||||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
||||||
|
|||||||
29
cc/cc.go
29
cc/cc.go
@@ -183,12 +183,13 @@ type BaseProperties struct {
|
|||||||
// Minimum sdk version supported when compiling against the ndk
|
// Minimum sdk version supported when compiling against the ndk
|
||||||
Sdk_version *string
|
Sdk_version *string
|
||||||
|
|
||||||
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
||||||
AndroidMkStaticLibs []string `blueprint:"mutated"`
|
AndroidMkStaticLibs []string `blueprint:"mutated"`
|
||||||
AndroidMkRuntimeLibs []string `blueprint:"mutated"`
|
AndroidMkRuntimeLibs []string `blueprint:"mutated"`
|
||||||
AndroidMkWholeStaticLibs []string `blueprint:"mutated"`
|
AndroidMkWholeStaticLibs []string `blueprint:"mutated"`
|
||||||
HideFromMake bool `blueprint:"mutated"`
|
HideFromMake bool `blueprint:"mutated"`
|
||||||
PreventInstall bool `blueprint:"mutated"`
|
PreventInstall bool `blueprint:"mutated"`
|
||||||
|
ApexesProvidingSharedLibs []string `blueprint:"mutated"`
|
||||||
|
|
||||||
UseVndk bool `blueprint:"mutated"`
|
UseVndk bool `blueprint:"mutated"`
|
||||||
|
|
||||||
@@ -1579,6 +1580,22 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
// Export the shared libs to Make.
|
// Export the shared libs to Make.
|
||||||
switch depTag {
|
switch depTag {
|
||||||
case sharedDepTag, sharedExportDepTag, lateSharedDepTag:
|
case sharedDepTag, sharedExportDepTag, lateSharedDepTag:
|
||||||
|
// Dependency to the stubs lib which is already included in an APEX
|
||||||
|
// is not added to the androidmk dependency
|
||||||
|
if dependentLibrary, ok := ccDep.linker.(*libraryDecorator); ok {
|
||||||
|
depNameWithTarget := depName + "-" + ccDep.Target().String()
|
||||||
|
if dependentLibrary.buildStubs() && android.InAnyApex(ctx.Config(), depNameWithTarget) {
|
||||||
|
// Also add the dependency to the APEX(es) providing the library so that
|
||||||
|
// m <module> can trigger building the APEXes as well.
|
||||||
|
apexNames := android.GetApexBundlesForModule(ctx, depNameWithTarget)
|
||||||
|
for an := range apexNames {
|
||||||
|
c.Properties.ApexesProvidingSharedLibs = append(
|
||||||
|
c.Properties.ApexesProvidingSharedLibs, an)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Note: the order of libs in this list is not important because
|
// Note: the order of libs in this list is not important because
|
||||||
// they merely serve as Make dependencies and do not affect this lib itself.
|
// they merely serve as Make dependencies and do not affect this lib itself.
|
||||||
c.Properties.AndroidMkSharedLibs = append(
|
c.Properties.AndroidMkSharedLibs = append(
|
||||||
|
|||||||
Reference in New Issue
Block a user