From d6c55357ae532699dfa61ce13b1581bbfcf10b3e Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Mon, 27 May 2024 23:10:35 -0700 Subject: [PATCH] Add http://bant.build/ BUILD file dependency checker. ... and fix some superfluous dependencies it found. Fixes #655 --- .github/workflows/verible-ci.yml | 41 ++++++++++++++++++++++++++++++++ common/analysis/BUILD | 3 --- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml index 1a4eb48ad..ece8ca553 100644 --- a/.github/workflows/verible-ci.yml +++ b/.github/workflows/verible-ci.yml @@ -124,6 +124,47 @@ jobs: name: "diag" path: "**/plot_*.svg" + RunBantBuildCleaneer: + # Running http://bant.build/ to check all dependencies in BUILD files. + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build Project genrules + run: | + # Fetch all dependency and run genrules for bant to see every file + # that makes it into the compile. + bazel fetch ... + bazel build \ + //common/analysis:command-file-lexer \ + //common/lsp:jcxxgen-testfile-gen \ + //common/lsp:lsp-protocol-gen \ + //common/util:version-header \ + //verilog/CST:verilog-nonterminals-foreach-gen \ + //verilog/parser:gen-verilog-token-enum \ + //verilog/parser:verilog-lex \ + //verilog/parser:verilog-parse-interface \ + //verilog/parser:verilog-y \ + //verilog/parser:verilog-y-final \ + //verilog/tools/kythe:verilog-extractor-indexing-fact-type-foreach-gen + + - name: Get Bant + run: | + # TODO: provide this as action where we simply say with version=... + VERSION="v0.1.3" + STATIC_VERSION="bant-${VERSION}-linux-static-x86_64" + wget "https://github.com/hzeller/bant/releases/download/${VERSION}/${STATIC_VERSION}.tar.gz" + tar xvzf "${STATIC_VERSION}.tar.gz" + mkdir -p bin + ln -sf ../"${STATIC_VERSION}/bin/bant" bin/ + bin/bant -V + + - name: Run bant build-cleaner + run: | + bin/bant dwyu ... Check: container: ubuntu:jammy diff --git a/common/analysis/BUILD b/common/analysis/BUILD index 8525ccb6e..c6a7ff9be 100644 --- a/common/analysis/BUILD +++ b/common/analysis/BUILD @@ -199,7 +199,6 @@ cc_library( "//common/util:algorithm", "//common/util:logging", "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", # for library testonly ], ) @@ -266,7 +265,6 @@ cc_library( "//common/text:text-structure", "//common/util:logging", "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", # for library testonly ], ) @@ -322,7 +320,6 @@ cc_library( "//common/text:text-structure", "//common/util:logging", "@com_google_absl//absl/strings:string_view", - "@com_google_googletest//:gtest", # for library testonly ], )