summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/bazel.go5
-rw-r--r--android/bazel_handler.go35
-rw-r--r--android/bazel_handler_test.go2
-rw-r--r--android/filegroup.go2
4 files changed, 35 insertions, 9 deletions
diff --git a/android/bazel.go b/android/bazel.go
index 692fbcdd2..373e292f2 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -182,6 +182,7 @@ var (
"external/jemalloc_new": Bp2BuildDefaultTrueRecursively,
"external/libcxx": Bp2BuildDefaultTrueRecursively,
"external/libcxxabi": Bp2BuildDefaultTrueRecursively,
+ "external/libcap": Bp2BuildDefaultTrueRecursively,
"external/scudo": Bp2BuildDefaultTrueRecursively,
"prebuilts/clang/host/linux-x86": Bp2BuildDefaultTrueRecursively,
}
@@ -231,6 +232,10 @@ var (
//external/brotli/...
"brotli-fuzzer-corpus", // "declared output 'external/brotli/c/fuzz/73231c6592f195ffd41100b8706d1138ff6893b9' was not created by genrule"
+ // //external/libcap/...
+ "libcap", // http://b/198595332, depends on _makenames, a cc_binary
+ "cap_names.h", // http://b/198596102, depends on _makenames, a cc_binary
+
// Tests. Handle later.
"libbionic_tests_headers_posix", // http://b/186024507, cc_library_static, sched.h, time.h not found
"libjemalloc5_integrationtest",
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 9c922dda4..50b79fa15 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -27,9 +27,9 @@ import (
"sync"
"android/soong/bazel/cquery"
+ "android/soong/shared"
"android/soong/bazel"
- "android/soong/shared"
)
type cqueryRequest interface {
@@ -492,6 +492,12 @@ config_node(name = "%s",
)
`
+ commonArchFilegroupString := `
+filegroup(name = "common",
+ srcs = [%s],
+)
+`
+
configNodesSection := ""
labelsByArch := map[string][]string{}
@@ -501,14 +507,22 @@ config_node(name = "%s",
labelsByArch[archString] = append(labelsByArch[archString], labelString)
}
- configNodeLabels := []string{}
+ allLabels := []string{}
for archString, labels := range labelsByArch {
- configNodeLabels = append(configNodeLabels, fmt.Sprintf("\":%s\"", archString))
- labelsString := strings.Join(labels, ",\n ")
- configNodesSection += fmt.Sprintf(configNodeFormatString, archString, archString, labelsString)
+ if archString == "common" {
+ // arch-less labels (e.g. filegroups) don't need a config_node
+ allLabels = append(allLabels, "\":common\"")
+ labelsString := strings.Join(labels, ",\n ")
+ configNodesSection += fmt.Sprintf(commonArchFilegroupString, labelsString)
+ } else {
+ // Create a config_node, and add the config_node's label to allLabels
+ allLabels = append(allLabels, fmt.Sprintf("\":%s\"", archString))
+ labelsString := strings.Join(labels, ",\n ")
+ configNodesSection += fmt.Sprintf(configNodeFormatString, archString, archString, labelsString)
+ }
}
- return []byte(fmt.Sprintf(formatString, configNodesSection, strings.Join(configNodeLabels, ",\n ")))
+ return []byte(fmt.Sprintf(formatString, configNodesSection, strings.Join(allLabels, ",\n ")))
}
func indent(original string) string {
@@ -573,6 +587,12 @@ def %s(target):
%s
def get_arch(target):
+ # TODO(b/199363072): filegroups and file targets aren't associated with any
+ # specific platform architecture in mixed builds. This is consistent with how
+ # Soong treats filegroups, but it may not be the case with manually-written
+ # filegroup BUILD targets.
+ if target.kind in ["filegroup", ""]:
+ return "common"
buildoptions = build_options(target)
platforms = build_options(target)["//command_line_option:platforms"]
if len(platforms) != 1:
@@ -671,11 +691,12 @@ func (context *bazelContext) InvokeBazel() error {
if err != nil {
return err
}
+
buildrootLabel := "@soong_injection//mixed_builds:buildroot"
cqueryOutput, cqueryErr, err = context.issueBazelCommand(
context.paths,
bazel.CqueryBuildRootRunName,
- bazelCommand{"cquery", fmt.Sprintf("kind(rule, deps(%s))", buildrootLabel)},
+ bazelCommand{"cquery", fmt.Sprintf("deps(%s)", buildrootLabel)},
"--output=starlark",
"--starlark:file="+absolutePath(cqueryFileRelpath))
err = ioutil.WriteFile(filepath.Join(soongInjectionPath, "cquery.out"),
diff --git a/android/bazel_handler_test.go b/android/bazel_handler_test.go
index 557faea21..cdf1a6316 100644
--- a/android/bazel_handler_test.go
+++ b/android/bazel_handler_test.go
@@ -11,7 +11,7 @@ func TestRequestResultsAfterInvokeBazel(t *testing.T) {
label := "//foo:bar"
arch := Arm64
bazelContext, _ := testBazelContext(t, map[bazelCommand]string{
- bazelCommand{command: "cquery", expression: "kind(rule, deps(@soong_injection//mixed_builds:buildroot))"}: `//foo:bar|arm64>>out/foo/bar.txt`,
+ bazelCommand{command: "cquery", expression: "deps(@soong_injection//mixed_builds:buildroot)"}: `//foo:bar|arm64>>out/foo/bar.txt`,
})
g, ok := bazelContext.GetOutputFiles(label, arch)
if ok {
diff --git a/android/filegroup.go b/android/filegroup.go
index cbb94b924..4db165f87 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -118,7 +118,7 @@ func (fg *fileGroup) GenerateBazelBuildActions(ctx ModuleContext) bool {
}
bazelCtx := ctx.Config().BazelContext
- filePaths, ok := bazelCtx.GetOutputFiles(fg.GetBazelLabel(ctx, fg), ctx.Arch().ArchType)
+ filePaths, ok := bazelCtx.GetOutputFiles(fg.GetBazelLabel(ctx, fg), Common)
if !ok {
return false
}