From 6622bfaf661d3694d5c354d4380998ea059c9c31 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Tue, 17 Dec 2024 18:53:18 -0800 Subject: [PATCH] Smallish cleanups here and there. * README: don't refer to obsolete bazel versions anymore. * check-potential-problems: check if there are files ending with -test * fix the one -test instance :) * generate coverage html: be more lenient in case of inconsitencies. * documentation of kythe indexing: also point out compilation DB. --- .github/bin/check-potential-problems.sh | 9 ++++++++- .github/bin/generate-coverage-html.sh | 2 +- README.md | 10 ++++------ bazel/jsonhpp.BUILD | 6 ++++++ doc/indexing.md | 3 +++ verible/common/tools/BUILD | 2 +- ...e-test.sh => verible-transform-interactive_test.sh} | 0 7 files changed, 23 insertions(+), 9 deletions(-) rename verible/common/tools/{verible-transform-interactive-test.sh => verible-transform-interactive_test.sh} (100%) diff --git a/.github/bin/check-potential-problems.sh b/.github/bin/check-potential-problems.sh index 042070ad7..ac70e2d0f 100755 --- a/.github/bin/check-potential-problems.sh +++ b/.github/bin/check-potential-problems.sh @@ -78,12 +78,19 @@ if [ $? -eq 0 ]; then EXIT_CODE=1 fi +find verible -name "*-test.cc" -o -name "*-test.sh" | grep test +if [ $? -eq 0 ]; then + echo "::error:: File naming-convention for tests is to end with _test; e.g. foo-bar.cc has test foo-bar_test.cc; similar with shell-script tests" + echo + EXIT_CODE=1 +fi + # bazelbuild/rules_python is broken as it downloads a dynamically # linked pre-built binary - This makes it _very_ platform specific. # This should either compile Python from scratch or use the local system Python. # So before rules_python() is added here, this needs to be fixed first upstream. # https://github.com/bazelbuild/rules_python/issues/1211 -grep rules_python WORKSPACE* MODULE.bazel +grep rules_python MODULE.bazel if [ $? -eq 0 ]; then echo "::error:: rules_python() breaks platform independence with shared libs." echo diff --git a/.github/bin/generate-coverage-html.sh b/.github/bin/generate-coverage-html.sh index 482efbe38..2f3e4969e 100755 --- a/.github/bin/generate-coverage-html.sh +++ b/.github/bin/generate-coverage-html.sh @@ -44,5 +44,5 @@ if [ ! -r "${COVERAGE_DATA}" ]; then exit fi -genhtml -o ${OUTPUT_DIR} ${COVERAGE_DATA} +genhtml --ignore-errors inconsistent -o ${OUTPUT_DIR} ${COVERAGE_DATA} echo "Output in $(realpath ${OUTPUT_DIR}/index.html)" diff --git a/README.md b/README.md index ca9b40e0a..a1390800a 100644 --- a/README.md +++ b/README.md @@ -172,10 +172,9 @@ guide and the [development resources](./doc/development.md). Verible's code base is written in C++. -To build, you need the [bazel] (>= 5.0 and <= 7) build system and a C++17 -compatible compiler (e.g. >= g++-10), as well as python3. Note, to build -Verible with bazel-7, so you need to add `--noenable_bzlmod` to every bazel -command. A lot of users of Verible have to work on pretty old installations, +To build, you need the [bazel] build system and a C++17 +compatible compiler (e.g. >= g++-10), as well as python3. +A lot of users of Verible have to work on pretty old installations, so we try to keep the requirements as minimal as possible. Use your package manager to install the dependencies; on a system with @@ -183,7 +182,6 @@ the nix package manager simply run `nix-shell` to get a build environment. ```bash # Build all tools and libraries -# bazel 6/7/8 bazel build -c opt //... ``` @@ -240,7 +238,7 @@ If you prefer to build and install the binaries locally yourself: ```bash bazel build -c opt :install-binaries -# install In your home directory +# Install in your home directory .github/bin/simple-install.sh ~/bin # For a system directory that requires root-access, call scfript with sudo. diff --git a/bazel/jsonhpp.BUILD b/bazel/jsonhpp.BUILD index 21a6ced12..0c3c5b3a5 100644 --- a/bazel/jsonhpp.BUILD +++ b/bazel/jsonhpp.BUILD @@ -1,4 +1,10 @@ # JSON for Modern C++ https://github.com/nlohmann/json +# +# This file is not directly needed anymore, but left +# here for now for projects still using a WORKSPACE +# reference. +# +# Should probably be removed around mid 2025. licenses(["unencumbered"]) # Public Domain or MIT diff --git a/doc/indexing.md b/doc/indexing.md index d4bab8964..ed8404c20 100644 --- a/doc/indexing.md +++ b/doc/indexing.md @@ -10,6 +10,9 @@ indexing Bazel-based projects. More information about indexing Bazel-based projects using Kythe [here](https://github.com/kythe/kythe/tree/master/kythe/cxx/extractor#bazel-c-extractor). +Note, if you just want to locally edit the code, no need to index, just use +the compilation DB by calling `.github/bin/make-compilation-db.sh` + ### Initializing Kythe Download the latest Kythe release from https://github.com/kythe/kythe/releases diff --git a/verible/common/tools/BUILD b/verible/common/tools/BUILD index b4cb74902..7f0b1e6bf 100644 --- a/verible/common/tools/BUILD +++ b/verible/common/tools/BUILD @@ -54,7 +54,7 @@ filegroup( sh_test_with_runfiles_lib( name = "verible-transform-interactive_test", size = "small", - srcs = ["verible-transform-interactive-test.sh"], + srcs = ["verible-transform-interactive_test.sh"], args = [ "$(location :verible-transform-interactive)", "$(location :verible-patch-tool)", diff --git a/verible/common/tools/verible-transform-interactive-test.sh b/verible/common/tools/verible-transform-interactive_test.sh similarity index 100% rename from verible/common/tools/verible-transform-interactive-test.sh rename to verible/common/tools/verible-transform-interactive_test.sh