Merge pull request #2615 from hzeller/feature-20260918-simplify-bant
Streamline cold-project build clean and compilation db
diff --git a/.github/bin/make-compilation-db.sh b/.github/bin/make-compilation-db.sh
index 5038893..7aab755 100755
--- a/.github/bin/make-compilation-db.sh
+++ b/.github/bin/make-compilation-db.sh
@@ -21,22 +21,20 @@
BAZEL_OPTS="-c opt --noshow_progress --remote_download_outputs=all"
+# Trigger necessary fetches from MODULE.bazel
+for f in abseil-cpp nlohmann_json protobuf re2 rules_flex zlib googletest ; do
+ "${BAZEL}" fetch --repo "@$f" > /dev/null 2>&1
+done
+
# Bazel-build all targets that generate files, so that they can be
# seen in dependency analysis.
-${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
-# and some test that triggers fetching nlohmann_json and gtest
-${BAZEL} build -k ${BAZEL_OPTS} //verible/verilog/parser:verilog-y-final \
- //verible/verilog/tools/kythe:verible-verilog-kythe-kzip-writer \
- //verible/common/lsp:json-rpc-dispatcher_test
+"${BAZEL}" build ${BAZEL_OPTS} \
+ $(${BANT} list-targets -g "genrule|cc_proto_library" -m -c3 ...)
# bant does not distinguish the compile flags per file yet, so instead of
# a compile_commands.json, we can just as well create a simpler
# compile_flags.txt which is easier to digest for all kinds of tools anyway.
-${BANT} compile-flags 2>/dev/null > compile_flags.txt
+${BANT} compile-flags -o compile_flags.txt
# Bant does not see the flex dependency inside the toolchain yet.
for d in bazel-out/../../../external/*flex*/src/FlexLexer.h ; do
diff --git a/.github/bin/run-build-cleaner.sh b/.github/bin/run-build-cleaner.sh
index e372646..f449fea 100755
--- a/.github/bin/run-build-cleaner.sh
+++ b/.github/bin/run-build-cleaner.sh
@@ -26,7 +26,8 @@
done
"${BAZEL}" build -k --remote_download_outputs=all \
- $(${BANT} genrule-outputs ... -c2) > /dev/null 2>&1
+ $(${BANT} list-targets -g "genrule|cc_proto_library" -m -c3 ...) \
+ > /dev/null 2>&1
if "${BANT}" dwyu $@; then
echo "Dependencies ok." >&2