Update bant to latest.
And use latest features
* list-targets requires a bazel pattern now. Also make use of the
`-c` option to select a colunm and `-g` to grep out the relevant
rulse. Entirely eliminates the need for awk
* Use a more robust way to extract the binary path of bant by
`bazel run --run_under'echo'` .
* use remote download=all for build artifacts that bant needs to
inspect in the build output. Depending on settings with a remote
cache, this is necessary to materialize these.
diff --git a/.github/bin/get-bant-path.sh b/.github/bin/get-bant-path.sh
index 9011aea..f1a0cac 100755
--- a/.github/bin/get-bant-path.sh
+++ b/.github/bin/get-bant-path.sh
@@ -21,8 +21,7 @@
# Bant not given, compile from bzlmod dep.
if [ "${BANT}" = "needs-to-be-compiled-locally" ]; then
- "${BAZEL}" build -c opt --cxxopt=-std=c++20 @bant//bant:bant 2>/dev/null
- BANT=$(realpath bazel-bin/external/bant*/bant/bant | tail -1)
+ BANT="$("${BAZEL}" run -c opt --cxxopt=-std=c++20 --run_under='echo' @bant//bant:bant 2>/dev/null)"
fi
echo $BANT
diff --git a/.github/bin/make-compilation-db.sh b/.github/bin/make-compilation-db.sh
index e35a55d..5038893 100755
--- a/.github/bin/make-compilation-db.sh
+++ b/.github/bin/make-compilation-db.sh
@@ -19,11 +19,12 @@
BAZEL=${BAZEL:-bazel}
BANT=$($(dirname $0)/get-bant-path.sh)
-BAZEL_OPTS="-c opt --noshow_progress"
+BAZEL_OPTS="-c opt --noshow_progress --remote_download_outputs=all"
+
# Bazel-build all targets that generate files, so that they can be
# seen in dependency analysis.
-${BAZEL} build -k ${BAZEL_OPTS} $(${BANT} list-targets \
- | awk '/genrule|cc_proto_library|genlex|genyacc/ {print $3}')
+${BAZEL} build -k ${BAZEL_OPTS} $(${BANT} list-targets ... \
+ -g 'genrule|cc_proto_library|genlex|genyacc' -c3)
# Some selected targets to trigger all dependency fetches from MODULE.bazel
# verilog-y-final to create a header, kzip creator to trigger build of any.pb.h
@@ -41,8 +42,3 @@
for d in bazel-out/../../../external/*flex*/src/FlexLexer.h ; do
echo "-I$(dirname $d)" >> compile_flags.txt
done
-
-# clang-tidy sometimes has issues figuring out if a file is c++,
-# so let's tell it. Bant can't always exctract that yet from --config redirects
-# in .bazelrc
-echo "-xc++" >> compile_flags.txt
diff --git a/MODULE.bazel b/MODULE.bazel
index 998aa87..463c634 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -20,4 +20,4 @@
bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True)
# To build compilation DB and run build-cleaning
-bazel_dep(name = "bant", version = "0.2.10", dev_dependency = True)
+bazel_dep(name = "bant", version = "0.3.4", dev_dependency = True)