Skip to content

Commit

Permalink
Merge pull request #2343 from hzeller/feature-20250122-bant-reporting
Browse files Browse the repository at this point in the history
build cleaner, compilation db making: simplify
  • Loading branch information
hzeller authored Jan 27, 2025
2 parents 931a691 + 2749793 commit 19aee2c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/bin/make-compilation-db.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2021 The Verible Authors.
# Copyright 2021-2025 The Verible Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,8 +32,8 @@ fi
BAZEL_OPTS="-c opt --noshow_progress"
# Bazel-build all targets that generate files, so that they can be
# seen in dependency analysis.
${BAZEL} build ${BAZEL_OPTS} $(${BANT} list-targets | \
egrep "genrule|cc_proto_library|genlex|genyacc" | awk '{print $3}')
${BAZEL} build ${BAZEL_OPTS} $(${BANT} list-targets \
| awk '/genrule|cc_proto_library|genlex|genyacc/ {print $3}')

# 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
Expand All @@ -42,7 +42,7 @@ ${BAZEL} build ${BAZEL_OPTS} //verible/verilog/parser:verilog-y-final \
//verible/verilog/tools/kythe:verible-verilog-kythe-kzip-writer \
//verible/common/lsp:json-rpc-dispatcher_test

# bant does not distinguish the includes per file yet, so instead of
# 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
Expand Down
14 changes: 9 additions & 5 deletions .github/bin/run-build-cleaner.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2024 The Verible Authors.
# Copyright 2024-2025 The Verible Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -23,15 +23,19 @@ BANT=${BANT:-needs-to-be-compiled-locally}
if [ "${BANT}" = "needs-to-be-compiled-locally" ]; then
# Bant not given, compile from bzlmod dep.
${BAZEL} build -c opt --cxxopt=-std=c++20 @bant//bant:bant >/dev/null 2>&1
BANT=$(realpath bazel-bin/external/bant*/bant/bant)
BANT=$(realpath bazel-bin/external/bant*/bant/bant | head -1)
fi

DWYU_OUT="${TMPDIR:-/tmp}/dwyu.out"

if "${BANT}" -q dwyu ... ; then
echo "Dependencies ok"
echo "Dependencies ok." >&2
else
echo
echo "^ Please run buildozer commands to fix the dependencies and amend PR"
cat >&2 <<EOF
Build dependency issues found, the following one-liner will fix it. Amend PR.
source <(.github/bin/run-build-cleaner.sh)
EOF
exit 1
fi
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_proto", version = "6.0.0-rc2")

# To build compilation DB and run build-cleaning
bazel_dep(name = "bant", version = "0.1.11", dev_dependency = True)
bazel_dep(name = "bant", version = "0.1.13", dev_dependency = True)

0 comments on commit 19aee2c

Please sign in to comment.