aboutsummaryrefslogtreecommitdiff
path: root/bp2build
diff options
context:
space:
mode:
authorJingwen Chen <jingwen@google.com>2021-02-08 00:49:32 -0500
committerJingwen Chen <jingwen@google.com>2021-02-08 00:49:32 -0500
commit96af35bec670f3b59d0f24a561ccfc622f349fd7 (patch)
tree7403974b85636ea7ffc1271d64b27adeb243f0fc /bp2build
parentb7eab01167af0320e2552826381497111a4c66c6 (diff)
downloadsoong-96af35bec670f3b59d0f24a561ccfc622f349fd7.tar.gz
queryview: blocklist package module type.
The package module type was recently introduced, and its module name is the full package path. queryview uses the module name as the eventual target name in the generated BUILD files, so this causes a crash as seen in b/179605762. Workaround this by not generating package modules in the queryview directory. Test: m queryview && bazel query --config=queryview //... Fixes: 179605762 Change-Id: Iac2bd79d02bec47d6271583d106c184fb2f16e68
Diffstat (limited to 'bp2build')
-rw-r--r--bp2build/build_conversion.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/bp2build/build_conversion.go b/bp2build/build_conversion.go
index 2c293eae7..59af22dfc 100644
--- a/bp2build/build_conversion.go
+++ b/bp2build/build_conversion.go
@@ -173,6 +173,12 @@ func GenerateBazelTargets(ctx bpToBuildContext, codegenMode CodegenMode) map[str
}
t = generateBazelTarget(ctx, m)
case QueryView:
+ // Blocklist certain module types from being generated.
+ if canonicalizeModuleType(ctx.ModuleType(m)) == "package" {
+ // package module name contain slashes, and thus cannot
+ // be mapped cleanly to a bazel label.
+ return
+ }
t = generateSoongModuleTarget(ctx, m)
default:
panic(fmt.Errorf("Unknown code-generation mode: %s", codegenMode))