Handle arch/cpu variants in mixed builds
Test: mixed_libc.sh Change-Id: Ib5084060199b8e1a5955bd51bc3fd793bb83a1eb
This commit is contained in:
@@ -50,8 +50,8 @@ type cqueryRequest interface {
|
||||
|
||||
// Portion of cquery map key to describe target configuration.
|
||||
type configKey struct {
|
||||
archType ArchType
|
||||
osType OsType
|
||||
arch string
|
||||
osType OsType
|
||||
}
|
||||
|
||||
// Map key to describe bazel cquery requests.
|
||||
@@ -862,7 +862,7 @@ func getCqueryId(key cqueryKey) string {
|
||||
}
|
||||
|
||||
func getConfigString(key cqueryKey) string {
|
||||
arch := key.configKey.archType.Name
|
||||
arch := key.configKey.arch
|
||||
if len(arch) == 0 || arch == "common" {
|
||||
// Use host platform, which is currently hardcoded to be x86_64.
|
||||
arch = "x86_64"
|
||||
@@ -876,5 +876,9 @@ func getConfigString(key cqueryKey) string {
|
||||
}
|
||||
|
||||
func GetConfigKey(ctx ModuleContext) configKey {
|
||||
return configKey{archType: ctx.Arch().ArchType, osType: ctx.Os()}
|
||||
return configKey{
|
||||
// use string because Arch is not a valid key in go
|
||||
arch: ctx.Arch().String(),
|
||||
osType: ctx.Os(),
|
||||
}
|
||||
}
|
||||
|
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
func TestRequestResultsAfterInvokeBazel(t *testing.T) {
|
||||
label := "//foo:bar"
|
||||
cfg := configKey{Arm64, Android}
|
||||
cfg := configKey{"arm64_armv8-a", Android}
|
||||
bazelContext, _ := testBazelContext(t, map[bazelCommand]string{
|
||||
bazelCommand{command: "cquery", expression: "deps(@soong_injection//mixed_builds:buildroot, 2)"}: `//foo:bar|arm64|android>>out/foo/bar.txt`,
|
||||
bazelCommand{command: "cquery", expression: "deps(@soong_injection//mixed_builds:buildroot, 2)"}: `//foo:bar|arm64_armv8-a|android>>out/foo/bar.txt`,
|
||||
})
|
||||
g, ok := bazelContext.GetOutputFiles(label, cfg)
|
||||
if ok {
|
||||
|
@@ -119,12 +119,12 @@ func (fg *fileGroup) maybeGenerateBazelBuildActions(ctx ModuleContext) {
|
||||
return
|
||||
}
|
||||
|
||||
archVariant := ctx.Arch().ArchType
|
||||
archVariant := ctx.Arch().String()
|
||||
osVariant := ctx.Os()
|
||||
if len(fg.Srcs()) == 1 && fg.Srcs()[0].Base() == fg.Name() {
|
||||
// This will be a regular file target, not filegroup, in Bazel.
|
||||
// See FilegroupBp2Build for more information.
|
||||
archVariant = Common
|
||||
archVariant = Common.String()
|
||||
osVariant = CommonOS
|
||||
}
|
||||
|
||||
|
@@ -86,6 +86,7 @@ function create_mock_soong {
|
||||
|
||||
symlink_directory prebuilts/go
|
||||
symlink_directory prebuilts/build-tools
|
||||
symlink_directory prebuilts/clang/host
|
||||
symlink_directory external/go-cmp
|
||||
symlink_directory external/golang-protobuf
|
||||
|
||||
|
Reference in New Issue
Block a user