Merge "Make relative path for native_bridge binaries configurable" am: 2ca7a8835e
am: 1866802e07
Change-Id: I49f854acc05be48cd69669a1b4e4102c0b94df9e
This commit is contained in:
commit
ddf273bcd4
|
@ -191,15 +191,7 @@ func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod bluep
|
|||
// Make cannot identify LOCAL_MODULE_TARGET_ARCH:= common.
|
||||
if archStr != "common" {
|
||||
if amod.Target().NativeBridge {
|
||||
// TODO: Unhardcode these rules.
|
||||
guestArchStr := archStr
|
||||
hostArchStr := ""
|
||||
if guestArchStr == "arm" {
|
||||
hostArchStr = "x86"
|
||||
} else if guestArchStr == "arm64" {
|
||||
hostArchStr = "x86_64"
|
||||
}
|
||||
|
||||
hostArchStr := amod.Target().NativeBridgeHostArchName
|
||||
if hostArchStr != "" {
|
||||
a.SetString("LOCAL_MODULE_TARGET_ARCH", hostArchStr)
|
||||
}
|
||||
|
|
|
@ -691,9 +691,11 @@ const (
|
|||
)
|
||||
|
||||
type Target struct {
|
||||
Os OsType
|
||||
Arch Arch
|
||||
NativeBridge NativeBridgeSupport
|
||||
Os OsType
|
||||
Arch Arch
|
||||
NativeBridge NativeBridgeSupport
|
||||
NativeBridgeHostArchName string
|
||||
NativeBridgeRelativePath string
|
||||
}
|
||||
|
||||
func (target Target) String() string {
|
||||
|
@ -1403,7 +1405,8 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
|
|||
var targetErr error
|
||||
|
||||
addTarget := func(os OsType, archName string, archVariant, cpuVariant *string, abi []string,
|
||||
nativeBridgeEnabled NativeBridgeSupport) {
|
||||
nativeBridgeEnabled NativeBridgeSupport, nativeBridgeHostArchName *string,
|
||||
nativeBridgeRelativePath *string) {
|
||||
if targetErr != nil {
|
||||
return
|
||||
}
|
||||
|
@ -1413,12 +1416,21 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
|
|||
targetErr = err
|
||||
return
|
||||
}
|
||||
nativeBridgeRelativePathStr := String(nativeBridgeRelativePath)
|
||||
nativeBridgeHostArchNameStr := String(nativeBridgeHostArchName)
|
||||
|
||||
// Use guest arch as relative install path by default
|
||||
if nativeBridgeEnabled && nativeBridgeRelativePathStr == "" {
|
||||
nativeBridgeRelativePathStr = arch.ArchType.String()
|
||||
}
|
||||
|
||||
targets[os] = append(targets[os],
|
||||
Target{
|
||||
Os: os,
|
||||
Arch: arch,
|
||||
NativeBridge: nativeBridgeEnabled,
|
||||
Os: os,
|
||||
Arch: arch,
|
||||
NativeBridge: nativeBridgeEnabled,
|
||||
NativeBridgeHostArchName: nativeBridgeHostArchNameStr,
|
||||
NativeBridgeRelativePath: nativeBridgeRelativePathStr,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1426,14 +1438,14 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
|
|||
return nil, fmt.Errorf("No host primary architecture set")
|
||||
}
|
||||
|
||||
addTarget(BuildOs, *variables.HostArch, nil, nil, nil, NativeBridgeDisabled)
|
||||
addTarget(BuildOs, *variables.HostArch, nil, nil, nil, NativeBridgeDisabled, nil, nil)
|
||||
|
||||
if variables.HostSecondaryArch != nil && *variables.HostSecondaryArch != "" {
|
||||
addTarget(BuildOs, *variables.HostSecondaryArch, nil, nil, nil, NativeBridgeDisabled)
|
||||
addTarget(BuildOs, *variables.HostSecondaryArch, nil, nil, nil, NativeBridgeDisabled, nil, nil)
|
||||
}
|
||||
|
||||
if Bool(config.Host_bionic) {
|
||||
addTarget(LinuxBionic, "x86_64", nil, nil, nil, NativeBridgeDisabled)
|
||||
addTarget(LinuxBionic, "x86_64", nil, nil, nil, NativeBridgeDisabled, nil, nil)
|
||||
}
|
||||
|
||||
if String(variables.CrossHost) != "" {
|
||||
|
@ -1446,10 +1458,10 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
|
|||
return nil, fmt.Errorf("No cross-host primary architecture set")
|
||||
}
|
||||
|
||||
addTarget(crossHostOs, *variables.CrossHostArch, nil, nil, nil, NativeBridgeDisabled)
|
||||
addTarget(crossHostOs, *variables.CrossHostArch, nil, nil, nil, NativeBridgeDisabled, nil, nil)
|
||||
|
||||
if variables.CrossHostSecondaryArch != nil && *variables.CrossHostSecondaryArch != "" {
|
||||
addTarget(crossHostOs, *variables.CrossHostSecondaryArch, nil, nil, nil, NativeBridgeDisabled)
|
||||
addTarget(crossHostOs, *variables.CrossHostSecondaryArch, nil, nil, nil, NativeBridgeDisabled, nil, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1460,12 +1472,12 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
|
|||
}
|
||||
|
||||
addTarget(target, *variables.DeviceArch, variables.DeviceArchVariant,
|
||||
variables.DeviceCpuVariant, variables.DeviceAbi, NativeBridgeDisabled)
|
||||
variables.DeviceCpuVariant, variables.DeviceAbi, NativeBridgeDisabled, nil, nil)
|
||||
|
||||
if variables.DeviceSecondaryArch != nil && *variables.DeviceSecondaryArch != "" {
|
||||
addTarget(Android, *variables.DeviceSecondaryArch,
|
||||
variables.DeviceSecondaryArchVariant, variables.DeviceSecondaryCpuVariant,
|
||||
variables.DeviceSecondaryAbi, NativeBridgeDisabled)
|
||||
variables.DeviceSecondaryAbi, NativeBridgeDisabled, nil, nil)
|
||||
|
||||
deviceArches := targets[Android]
|
||||
if deviceArches[0].Arch.ArchType.Multilib == deviceArches[1].Arch.ArchType.Multilib {
|
||||
|
@ -1476,7 +1488,8 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
|
|||
if variables.NativeBridgeArch != nil && *variables.NativeBridgeArch != "" {
|
||||
addTarget(Android, *variables.NativeBridgeArch,
|
||||
variables.NativeBridgeArchVariant, variables.NativeBridgeCpuVariant,
|
||||
variables.NativeBridgeAbi, NativeBridgeEnabled)
|
||||
variables.NativeBridgeAbi, NativeBridgeEnabled, variables.DeviceArch,
|
||||
variables.NativeBridgeRelativePath)
|
||||
}
|
||||
|
||||
if variables.DeviceSecondaryArch != nil && *variables.DeviceSecondaryArch != "" &&
|
||||
|
@ -1484,7 +1497,10 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
|
|||
addTarget(Android, *variables.NativeBridgeSecondaryArch,
|
||||
variables.NativeBridgeSecondaryArchVariant,
|
||||
variables.NativeBridgeSecondaryCpuVariant,
|
||||
variables.NativeBridgeSecondaryAbi, NativeBridgeEnabled)
|
||||
variables.NativeBridgeSecondaryAbi,
|
||||
NativeBridgeEnabled,
|
||||
variables.DeviceSecondaryArch,
|
||||
variables.NativeBridgeSecondaryRelativePath)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -240,10 +240,10 @@ func TestArchConfigNativeBridge(buildDir string, env map[string]string) Config {
|
|||
config := testConfig.config
|
||||
|
||||
config.Targets[Android] = []Target{
|
||||
{Android, Arch{ArchType: X86_64, ArchVariant: "silvermont", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled},
|
||||
{Android, Arch{ArchType: X86, ArchVariant: "silvermont", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridgeDisabled},
|
||||
{Android, Arch{ArchType: Arm64, ArchVariant: "armv8-a", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridgeEnabled},
|
||||
{Android, Arch{ArchType: Arm, ArchVariant: "armv7-a-neon", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridgeEnabled},
|
||||
{Android, Arch{ArchType: X86_64, ArchVariant: "silvermont", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", ""},
|
||||
{Android, Arch{ArchType: X86, ArchVariant: "silvermont", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridgeDisabled, "", ""},
|
||||
{Android, Arch{ArchType: Arm64, ArchVariant: "armv8-a", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridgeEnabled, "x86_64", "arm64"},
|
||||
{Android, Arch{ArchType: Arm, ArchVariant: "armv7-a-neon", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridgeEnabled, "x86", "arm"},
|
||||
}
|
||||
|
||||
return testConfig
|
||||
|
@ -255,10 +255,10 @@ func TestArchConfigFuchsia(buildDir string, env map[string]string) Config {
|
|||
|
||||
config.Targets = map[OsType][]Target{
|
||||
Fuchsia: []Target{
|
||||
{Fuchsia, Arch{ArchType: Arm64, ArchVariant: "", Native: true}, NativeBridgeDisabled},
|
||||
{Fuchsia, Arch{ArchType: Arm64, ArchVariant: "", Native: true}, NativeBridgeDisabled, "", ""},
|
||||
},
|
||||
BuildOs: []Target{
|
||||
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled},
|
||||
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", ""},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -272,12 +272,12 @@ func TestArchConfig(buildDir string, env map[string]string) Config {
|
|||
|
||||
config.Targets = map[OsType][]Target{
|
||||
Android: []Target{
|
||||
{Android, Arch{ArchType: Arm64, ArchVariant: "armv8-a", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled},
|
||||
{Android, Arch{ArchType: Arm, ArchVariant: "armv7-a-neon", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridgeDisabled},
|
||||
{Android, Arch{ArchType: Arm64, ArchVariant: "armv8-a", Native: true, Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", ""},
|
||||
{Android, Arch{ArchType: Arm, ArchVariant: "armv7-a-neon", Native: true, Abi: []string{"armeabi-v7a"}}, NativeBridgeDisabled, "", ""},
|
||||
},
|
||||
BuildOs: []Target{
|
||||
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled},
|
||||
{BuildOs, Arch{ArchType: X86}, NativeBridgeDisabled},
|
||||
{BuildOs, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", ""},
|
||||
{BuildOs, Arch{ArchType: X86}, NativeBridgeDisabled, "", ""},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -165,15 +165,17 @@ type productVariables struct {
|
|||
DeviceSecondaryCpuVariant *string `json:",omitempty"`
|
||||
DeviceSecondaryAbi []string `json:",omitempty"`
|
||||
|
||||
NativeBridgeArch *string `json:",omitempty"`
|
||||
NativeBridgeArchVariant *string `json:",omitempty"`
|
||||
NativeBridgeCpuVariant *string `json:",omitempty"`
|
||||
NativeBridgeAbi []string `json:",omitempty"`
|
||||
NativeBridgeArch *string `json:",omitempty"`
|
||||
NativeBridgeArchVariant *string `json:",omitempty"`
|
||||
NativeBridgeCpuVariant *string `json:",omitempty"`
|
||||
NativeBridgeAbi []string `json:",omitempty"`
|
||||
NativeBridgeRelativePath *string `json:",omitempty"`
|
||||
|
||||
NativeBridgeSecondaryArch *string `json:",omitempty"`
|
||||
NativeBridgeSecondaryArchVariant *string `json:",omitempty"`
|
||||
NativeBridgeSecondaryCpuVariant *string `json:",omitempty"`
|
||||
NativeBridgeSecondaryAbi []string `json:",omitempty"`
|
||||
NativeBridgeSecondaryArch *string `json:",omitempty"`
|
||||
NativeBridgeSecondaryArchVariant *string `json:",omitempty"`
|
||||
NativeBridgeSecondaryCpuVariant *string `json:",omitempty"`
|
||||
NativeBridgeSecondaryAbi []string `json:",omitempty"`
|
||||
NativeBridgeSecondaryRelativePath *string `json:",omitempty"`
|
||||
|
||||
HostArch *string `json:",omitempty"`
|
||||
HostSecondaryArch *string `json:",omitempty"`
|
||||
|
|
|
@ -656,8 +656,10 @@ func getCopyManifestForNativeLibrary(cc *cc.Module, handleSpecialLibs bool) (fil
|
|||
dirInApex = "lib64"
|
||||
}
|
||||
dirInApex = filepath.Join(dirInApex, cc.RelativeInstallPath())
|
||||
if cc.Target().NativeBridge == android.NativeBridgeEnabled || !cc.Arch().Native {
|
||||
if !cc.Arch().Native {
|
||||
dirInApex = filepath.Join(dirInApex, cc.Arch().ArchType.String())
|
||||
} else if cc.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||
dirInApex = filepath.Join(dirInApex, cc.Target().NativeBridgeRelativePath)
|
||||
}
|
||||
if handleSpecialLibs {
|
||||
switch cc.Name() {
|
||||
|
@ -681,8 +683,10 @@ func getCopyManifestForNativeLibrary(cc *cc.Module, handleSpecialLibs bool) (fil
|
|||
|
||||
func getCopyManifestForExecutable(cc *cc.Module) (fileToCopy android.Path, dirInApex string) {
|
||||
dirInApex = filepath.Join("bin", cc.RelativeInstallPath())
|
||||
if cc.Target().NativeBridge == android.NativeBridgeEnabled || !cc.Arch().Native {
|
||||
if !cc.Arch().Native {
|
||||
dirInApex = filepath.Join(dirInApex, cc.Arch().ArchType.String())
|
||||
} else if cc.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||
dirInApex = filepath.Join(dirInApex, cc.Target().NativeBridgeRelativePath)
|
||||
}
|
||||
fileToCopy = cc.OutputFile().Path()
|
||||
return
|
||||
|
|
|
@ -66,9 +66,12 @@ func (installer *baseInstaller) installDir(ctx ModuleContext) android.OutputPath
|
|||
if ctx.toolchain().Is64Bit() && installer.dir64 != "" {
|
||||
dir = installer.dir64
|
||||
}
|
||||
if (!ctx.Host() && !ctx.Arch().Native) || ctx.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||
if !ctx.Host() && !ctx.Arch().Native {
|
||||
dir = filepath.Join(dir, ctx.Arch().ArchType.String())
|
||||
}
|
||||
if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||
dir = filepath.Join(dir, ctx.Target().NativeBridgeRelativePath)
|
||||
}
|
||||
if installer.location == InstallInData && ctx.useVndk() {
|
||||
dir = filepath.Join(dir, "vendor")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue