Return false in DirectlyInAnyApex for host libraries.
Host doesn't have apexes. Bug: 122947954 Test: build dex2oat, check that libnativebridge is installed. Change-Id: I3548e3f155a200e56d71e88631b71511bad84161
This commit is contained in:
@@ -178,8 +178,16 @@ func DirectlyInApex(apexName string, moduleName string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type hostContext interface {
|
||||||
|
Host() bool
|
||||||
|
}
|
||||||
|
|
||||||
// Tests whether a module named moduleName is directly depended on by any APEX.
|
// Tests whether a module named moduleName is directly depended on by any APEX.
|
||||||
func DirectlyInAnyApex(moduleName string) bool {
|
func DirectlyInAnyApex(ctx hostContext, moduleName string) bool {
|
||||||
|
if ctx.Host() {
|
||||||
|
// Host has no APEX.
|
||||||
|
return false
|
||||||
|
}
|
||||||
apexNamesMapMutex.Lock()
|
apexNamesMapMutex.Lock()
|
||||||
defer apexNamesMapMutex.Unlock()
|
defer apexNamesMapMutex.Unlock()
|
||||||
if apexNames, ok := apexNamesMap()[moduleName]; ok {
|
if apexNames, ok := apexNamesMap()[moduleName]; ok {
|
||||||
|
@@ -32,6 +32,9 @@ type AndroidMkContext interface {
|
|||||||
Name() string
|
Name() string
|
||||||
Target() android.Target
|
Target() android.Target
|
||||||
subAndroidMk(*android.AndroidMkData, interface{})
|
subAndroidMk(*android.AndroidMkData, interface{})
|
||||||
|
Arch() android.Arch
|
||||||
|
Os() android.OsType
|
||||||
|
Host() bool
|
||||||
useVndk() bool
|
useVndk() bool
|
||||||
static() bool
|
static() bool
|
||||||
inRecovery() bool
|
inRecovery() bool
|
||||||
@@ -189,9 +192,9 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if len(library.Properties.Stubs.Versions) > 0 &&
|
||||||
if len(library.Properties.Stubs.Versions) > 0 && android.DirectlyInAnyApex(ctx.Name()) &&
|
android.DirectlyInAnyApex(ctx, ctx.Name()) && !ctx.inRecovery() && !ctx.useVndk() &&
|
||||||
!ctx.inRecovery() && !ctx.useVndk() && !ctx.static() {
|
!ctx.static() {
|
||||||
if !library.buildStubs() {
|
if !library.buildStubs() {
|
||||||
ret.SubName = ".bootstrap"
|
ret.SubName = ".bootstrap"
|
||||||
}
|
}
|
||||||
|
5
cc/cc.go
5
cc/cc.go
@@ -874,7 +874,8 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
// force anything in the make world to link against the stubs library.
|
// force anything in the make world to link against the stubs library.
|
||||||
// (unless it is explicitly referenced via .bootstrap suffix or the
|
// (unless it is explicitly referenced via .bootstrap suffix or the
|
||||||
// module is marked with 'bootstrap: true').
|
// module is marked with 'bootstrap: true').
|
||||||
if c.HasStubsVariants() && android.DirectlyInAnyApex(ctx.baseModuleName()) &&
|
if c.HasStubsVariants() &&
|
||||||
|
android.DirectlyInAnyApex(ctx, ctx.baseModuleName()) &&
|
||||||
!c.inRecovery() && !c.useVndk() && !c.static() && c.IsStubs() {
|
!c.inRecovery() && !c.useVndk() && !c.static() && c.IsStubs() {
|
||||||
c.Properties.HideFromMake = false // unhide
|
c.Properties.HideFromMake = false // unhide
|
||||||
// Note: this is still non-installable
|
// Note: this is still non-installable
|
||||||
@@ -1456,7 +1457,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
depIsStubs := dependentLibrary.buildStubs()
|
depIsStubs := dependentLibrary.buildStubs()
|
||||||
depHasStubs := ccDep.HasStubsVariants()
|
depHasStubs := ccDep.HasStubsVariants()
|
||||||
depInSameApex := android.DirectlyInApex(c.ApexName(), depName)
|
depInSameApex := android.DirectlyInApex(c.ApexName(), depName)
|
||||||
depInPlatform := !android.DirectlyInAnyApex(depName)
|
depInPlatform := !android.DirectlyInAnyApex(ctx, depName)
|
||||||
|
|
||||||
var useThisDep bool
|
var useThisDep bool
|
||||||
if depIsStubs && explicitlyVersioned {
|
if depIsStubs && explicitlyVersioned {
|
||||||
|
Reference in New Issue
Block a user