Add native_bridge target to Android.bp

This allows us to build guest libraries for the native bridge for
arm/arm64 architectures.

Bug: http://b/77159578
Test: make
Change-Id: I35520ca456105ddadd456c78a4eb1e6de39147c5
This commit is contained in:
dimitry
2019-03-26 12:39:31 +01:00
parent 0e7dbebe7e
commit 1f33e40972
10 changed files with 128 additions and 24 deletions

View File

@@ -28,6 +28,10 @@ import (
"github.com/google/blueprint/bootstrap"
)
var (
NativeBridgeSuffix = ".native_bridge"
)
func init() {
RegisterSingletonType("androidmk", AndroidMkSingleton)
}
@@ -161,6 +165,10 @@ func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod bluep
}
}
if amod.Target().NativeBridge {
a.SubName += NativeBridgeSuffix
}
fmt.Fprintln(&a.header, "\ninclude $(CLEAR_VARS)")
// Collect make variable assignment entries.
@@ -190,7 +198,22 @@ func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod bluep
case Device:
// Make cannot identify LOCAL_MODULE_TARGET_ARCH:= common.
if archStr != "common" {
a.SetString("LOCAL_MODULE_TARGET_ARCH", archStr)
if amod.Target().NativeBridge {
// TODO: Unhardcode these rules.
guestArchStr := archStr
hostArchStr := ""
if guestArchStr == "arm" {
hostArchStr = "x86"
} else if guestArchStr == "arm64" {
hostArchStr = "x86_64"
}
if hostArchStr != "" {
a.SetString("LOCAL_MODULE_TARGET_ARCH", hostArchStr)
}
} else {
a.SetString("LOCAL_MODULE_TARGET_ARCH", archStr)
}
}
a.AddStrings("LOCAL_INIT_RC", amod.commonProperties.Init_rc...)