From 96af35bec670f3b59d0f24a561ccfc622f349fd7 Mon Sep 17 00:00:00 2001 From: Jingwen Chen Date: Mon, 8 Feb 2021 00:49:32 -0500 Subject: [PATCH] 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 --- bp2build/build_conversion.go | 6 ++++++ 1 file changed, 6 insertions(+) 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))