From abe86e2c693aa7a9964132622663f0a57831b854 Mon Sep 17 00:00:00 2001 From: helly25 Date: Thu, 13 Nov 2025 15:10:35 +0100 Subject: [PATCH 1/2] Drop workspace support: It creates too many issues in too many configurations. --- .bazelrc | 3 - .bcr/patches/bazelmod.patch | 4 +- .github/workflows/bazelmod.patch | 4 +- .github/workflows/main.yml | 12 --- .github/workflows/test.yml | 14 +-- CHANGELOG.md | 1 + WORKSPACE | 24 +----- bzl/workspace/BUILD.bazel | 18 ---- bzl/workspace/init_extras.bzl | 32 ------- bzl/workspace/init_extras_llvm.bzl | 23 ----- bzl/workspace/init_modules.bzl | 28 ------ bzl/workspace/load_extras.bzl | 50 ----------- bzl/workspace/load_modules.bzl | 131 ----------------------------- 13 files changed, 7 insertions(+), 337 deletions(-) delete mode 100644 bzl/workspace/BUILD.bazel delete mode 100644 bzl/workspace/init_extras.bzl delete mode 100644 bzl/workspace/init_extras_llvm.bzl delete mode 100644 bzl/workspace/init_modules.bzl delete mode 100644 bzl/workspace/load_extras.bzl delete mode 100644 bzl/workspace/load_modules.bzl diff --git a/.bazelrc b/.bazelrc index 42ea0d8..cd29b2e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -37,9 +37,6 @@ common:clang --host_cxxopt=-gmlt common:clang --linkopt=-fuse-ld=lld common:clang --host_linkopt=-fuse-ld=lld common:clang --define is_clang=true -# Some newer Clang versions really do not like '-c': -# https://github.com/llvm/llvm-project/issues/100909 -common:clang --cxxopt=-Wno-unused-command-line-argument common:symbolizer --strip=never common:symbolizer --run_under=//tools:run_under_symbolizer diff --git a/.bcr/patches/bazelmod.patch b/.bcr/patches/bazelmod.patch index fb1a4e8..1817dc3 100644 --- a/.bcr/patches/bazelmod.patch +++ b/.bcr/patches/bazelmod.patch @@ -11,5 +11,5 @@ index c298a32..658794e 100644 +# include("//bazelmod:dev.MODULE.bazel") +# include("//bazelmod:llvm.MODULE.bazel") - bazel_dep(name = "bazel_skylib", version = "1.7.1") - bazel_dep(name = "rules_cc", version = "0.1.1") + bazel_dep(name = "bazel_skylib", version = "1.8.2") + bazel_dep(name = "platforms", version = "1.0.0") diff --git a/.github/workflows/bazelmod.patch b/.github/workflows/bazelmod.patch index 7202e4d..be9e748 100644 --- a/.github/workflows/bazelmod.patch +++ b/.github/workflows/bazelmod.patch @@ -11,8 +11,8 @@ index c298a32..658794e 100644 +# include("//bazelmod:dev.MODULE.bazel") +# include("//bazelmod:llvm.MODULE.bazel") - bazel_dep(name = "bazel_skylib", version = "1.7.1") - bazel_dep(name = "rules_cc", version = "0.1.1") + bazel_dep(name = "bazel_skylib", version = "1.8.2") + bazel_dep(name = "platforms", version = "1.0.0") diff --git a/mbo/mope/mope.bzl b/mbo/mope/mope.bzl index d80d788..7aeac41 100644 --- a/mbo/mope/mope.bzl diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3696087..dca8067 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,18 +19,11 @@ jobs: strategy: matrix: os: [ubuntu-latest] - bazel_mode: [bzlmod, workspace] compiler: [gcc] gcc_version: [12, 13, 14] bazel_config: [asan, cpp23, opt] # Using `include` does not make the options show up in the generated config names... exclude: - - bazel_mode: bzlmod - gcc_version: 12 - - bazel_mode: workspace - gcc_version: 14 - - bazel_mode: workspace - gcc_version: 13 - bazel_config: asan gcc_version: 13 - bazel_config: asan @@ -44,7 +37,6 @@ jobs: with: continue-on-error: false os: ${{ matrix.os }} - bazel_mode: ${{ matrix.bazel_mode }} compiler: ${{ matrix.compiler }} gcc_version: ${{ matrix.gcc_version }} bazel_config: ${{ matrix.bazel_config }} @@ -55,7 +47,6 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-15] - bazel_mode: [bzlmod] compiler: [gcc, native, clang] gcc_version: [13] llvm_version: [16.0.4] @@ -71,7 +62,6 @@ jobs: with: continue-on-error: false os: ${{ matrix.os }} - bazel_mode: ${{ matrix.bazel_mode }} compiler: ${{ matrix.compiler }} gcc_version: ${{ matrix.gcc_version }} llvm_version: ${{ matrix.llvm_version }} @@ -84,7 +74,6 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-15] - bazel_mode: [bzlmod] compiler: [clang] # MacOS-15: Clang 16.0.0 # MacOS-25: Clang 17.0.0 @@ -114,7 +103,6 @@ jobs: with: continue-on-error: true os: ${{ matrix.os }} - bazel_mode: ${{ matrix.bazel_mode }} compiler: ${{ matrix.compiler }} llvm_version: ${{ matrix.llvm_version }} bazel_config: ${{ matrix.bazel_config }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20c4fc0..95f9624 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,10 +26,6 @@ on: description: 'The operating system the tests will be run on.' type: string default: ubuntu-latest - bazel_mode: - description: 'The Bazel operation mode (bzlmod, workspace).' - type: string - default: bzlmod compiler: description: 'The compiler to use (clang, gcc).' type: string @@ -56,7 +52,7 @@ on: default: '' env: - CACHE_KEY_PREFIX: ${{inputs.os}}-${{inputs.bazel_mode}}_${{inputs.compiler}}_${{inputs.compiler == 'clang' && inputs.llvm_version || ''}}_${{inputs.compiler == 'gcc' && inputs.gcc_version || ''}}_${{inputs.bazel_config}}_${{inputs.module_version}} + CACHE_KEY_PREFIX: ${{inputs.os}}-bzlmod_${{inputs.compiler}}_${{inputs.compiler == 'clang' && inputs.llvm_version || ''}}_${{inputs.compiler == 'gcc' && inputs.gcc_version || ''}}_${{inputs.bazel_config}}_${{inputs.module_version}} jobs: test: @@ -92,14 +88,6 @@ jobs: CACHE_ROOT=~/.cache BAZEL_INIT+=("--output_user_root=${CACHE_ROOT}/bazel") BAZEL_ARGS+=("--repository_cache=${CACHE_ROOT}/bazel_repo-cache") - if [ "${{inputs.bazel_mode}}" == "workspace" ]; then - BAZEL_ARGS+=("--noenable_bzlmod" "--enable_workspace") - elif [ "${{inputs.bazel_mode}}" == "bzlmod" ]; then - BAZEL_ARGS+=("--enable_bzlmod" "--noenable_workspace") - else - echo "ERROR: Matrix/Input var 'bazel_mode' must be one of [bzlmod, workspace]." - exit 1 - fi if [ "${{inputs.compiler}}" == "clang" ]; then BAZEL_ARGS+=("--config=clang") unset CC diff --git a/CHANGELOG.md b/CHANGELOG.md index e0ded4c..167a557 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ * Fixed bug in `mbo::strings::ParseString` with access past end of `string_view` for illegal hex and oct escape sequences (introduced in 0.9.0). * Updated various dependencies. * Renamed old dependency naming styles to new (matching bzlmod and other deps' needs) styles where possible. +* Removed WORKSPACE support. # 0.9.0 diff --git a/WORKSPACE b/WORKSPACE index 0c31588..9fd8ad3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -13,26 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace(name = "com_helly25_mbo") - -load("//bzl/workspace:load_modules.bzl", "helly25_mbo_load_modules") - -helly25_mbo_load_modules() - -load("//bzl/workspace:init_modules.bzl", "helly25_mbo_init_modules") - -helly25_mbo_init_modules() - -################################################################################ - -load("//bzl/workspace:load_extras.bzl", "helly25_mbo_load_extras") - -helly25_mbo_load_extras() # Adds Hedron + LLVM - -load("//bzl/workspace:init_extras.bzl", "helly25_mbo_init_extras") - -helly25_mbo_init_extras() # Init Hedron + LLVM - -load("//bzl/workspace:init_extras_llvm.bzl", "helly25_mbo_init_extras_llvm") - -helly25_mbo_init_extras_llvm() # Init LLVM/Part 2 +# NOT SUPPORTED diff --git a/bzl/workspace/BUILD.bazel b/bzl/workspace/BUILD.bazel deleted file mode 100644 index 5819593..0000000 --- a/bzl/workspace/BUILD.bazel +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) The helly25 authors (helly25.com) -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Empty package.""" - -#package(default_visibility = ["//visibility:private"]) diff --git a/bzl/workspace/init_extras.bzl b/bzl/workspace/init_extras.bzl deleted file mode 100644 index 9d62c7a..0000000 --- a/bzl/workspace/init_extras.bzl +++ /dev/null @@ -1,32 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) The helly25 authors (helly25.com) -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Initializes extra modules required by the workspace, requies helly25_mbo_init_extras_llvm.""" - -load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup") -load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies") -load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain") - -def helly25_mbo_init_extras(): - """Initializes all standard modules required by the workspace.""" - - hedron_compile_commands_setup() - - bazel_toolchain_dependencies() - - llvm_toolchain( - name = "llvm_toolchain", - llvm_version = "19.1.6", - ) diff --git a/bzl/workspace/init_extras_llvm.bzl b/bzl/workspace/init_extras_llvm.bzl deleted file mode 100644 index 2ac66c6..0000000 --- a/bzl/workspace/init_extras_llvm.bzl +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) The helly25 authors (helly25.com) -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Initializes components of extra modules in a second phase.""" - -load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains") - -def helly25_mbo_init_extras_llvm(): - """Initializes all standard modules required by the workspace.""" - - llvm_register_toolchains() diff --git a/bzl/workspace/init_modules.bzl b/bzl/workspace/init_modules.bzl deleted file mode 100644 index 575a969..0000000 --- a/bzl/workspace/init_modules.bzl +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) The helly25 authors (helly25.com) -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Initializes all standard modules required by the workspace.""" - -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") -load("@rules_python//python:repositories.bzl", "py_repositories") - -def helly25_mbo_init_modules(): - """Initializes all standard modules required by the workspace.""" - bazel_skylib_workspace() - rules_foreign_cc_dependencies() - py_repositories() - protobuf_deps() diff --git a/bzl/workspace/load_extras.bzl b/bzl/workspace/load_extras.bzl deleted file mode 100644 index 7e96ac1..0000000 --- a/bzl/workspace/load_extras.bzl +++ /dev/null @@ -1,50 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) The helly25 authors (helly25.com) -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Loads all extra modules used by the workspace.""" - -load("//bzl:archive.bzl", "github_archive", "http_archive") - -def helly25_mbo_load_extras(): - """Loads all extra modules required by the workspace.""" - - if not native.existing_rule("hedron_compile_commands"): - github_archive( - name = "hedron_compile_commands", - commit = "6dd21b47db481a70c61698742438230e2399b639", - repo = "https://github.com/helly25/bazel-compile-commands-extractor", - sha256 = "348a643defa9ab34ed9cb2ed1dc54b1c4ffef1282240aa24c457ebd8385ff2d5", - ) - - # Minimum requirements: - # * 2023.10.06: https://github.com/bazel-contrib/toolchains_llvm/pull/229: Move minimum supported version to Bazel - # * 2024.03.12: https://github.com/bazel-contrib/toolchains_llvm/pull/286: Support LLD linker for Darwin - # * 2025.01.22: https://github.com/bazel-contrib/toolchains_llvm/pull/446: Verion 1.3.0: - # b3c96d2dbc698eab752366bbe747e2a7df7fa504 / sha256-ZDefpvZja99JcCg37NO4dkdH11yN2zMrx2D77sWlWug= - # * 2025.02.15: https://github.com/bazel-contrib/toolchains_llvm/pull/461: Add LLVM 19.1.4...19.1.7: - # 0bd3bff40ab51a8e744ccddfd24f311a9df81c2d / sha256-YpBdoaSAXSatJwLcB2yzuZw5Ls/h5+dcWip+h+pVdUo= - # In order to go past version 1.0.0 we also add the actual fix: - # * 2024.06.06: https://github.com/bazel-contrib/toolchains_llvm/pull/337: Force Clang modules with LLVM >= 14 - # Versions: - # * 1.4.0 works - # * 1.5.0 fails work workspace builds - if not native.existing_rule("toolchains_llvm"): - http_archive( - name = "toolchains_llvm", - sha256 = "fded02569617d24551a0ad09c0750dc53a3097237157b828a245681f0ae739f8", - strip_prefix = "toolchains_llvm-v1.4.0", - canonical_id = "1.4.0", - url = "https://github.com/bazel-contrib/toolchains_llvm/releases/download/v1.4.0/toolchains_llvm-v1.4.0.tar.gz", - ) diff --git a/bzl/workspace/load_modules.bzl b/bzl/workspace/load_modules.bzl deleted file mode 100644 index 98d129e..0000000 --- a/bzl/workspace/load_modules.bzl +++ /dev/null @@ -1,131 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) The helly25 authors (helly25.com) -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Loads all standard modules required by the workspace.""" - -load("//bzl:archive.bzl", "github_archive", "http_archive") - -# buildifier: disable=unnamed-macro -def helly25_mbo_load_modules(): - """Loads all standard modules required by the workspace.""" - - if not native.existing_rule("platforms"): - http_archive( - name = "platforms", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/1.0.0/platforms-1.0.0.tar.gz", - "https://github.com/bazelbuild/platforms/releases/download/1.0.0/platforms-1.0.0.tar.gz", - ], - sha256 = "3384eb1c30762704fbe38e440204e114154086c8fc8a8c2e3e28441028c019a8", - ) - - if not native.existing_rule("rules_license"): - http_archive( - name = "rules_license", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/1.0.0/rules_license-1.0.0.tar.gz", - "https://github.com/bazelbuild/rules_license/releases/download/1.0.0/rules_license-1.0.0.tar.gz", - ], - sha256 = "26d4021f6898e23b82ef953078389dd49ac2b5618ac564ade4ef87cced147b38", - ) - - if not native.existing_rule("bazel_skylib"): - http_archive( - name = "bazel_skylib", - sha256 = "6e78f0e57de26801f6f564fa7c4a48dc8b36873e416257a92bbb0937eeac8446", - urls = [ - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.8.2/bazel-skylib-1.8.2.tar.gz", - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.8.2/bazel-skylib-1.8.2.tar.gz", - ], - ) - - if not native.existing_rule("bazel_features"): - http_archive( - name = "bazel_features", - sha256 = "07271d0f6b12633777b69020c4cb1eb67b1939c0cf84bb3944dc85cc250c0c01", - strip_prefix = "bazel_features-1.38.0", - url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.38.0/bazel_features-v1.38.0.tar.gz", - ) - - if not native.existing_rule("rules_foreign_cc"): - http_archive( - name = "rules_foreign_cc", - sha256 = "32759728913c376ba45b0116869b71b68b1c2ebf8f2bcf7b41222bc07b773d73", - strip_prefix = "rules_foreign_cc-0.15.1", - url = "https://github.com/bazelbuild/rules_foreign_cc/releases/download/0.15.1/rules_foreign_cc-0.15.1.tar.gz", - ) - - # Used for absl/GoogleTest - # Note GoogleTest uses "com_googlesource_code_re2" rather than "com_google_re2" - if not native.existing_rule("re2"): - http_archive( - name = "re2", - strip_prefix = "re2-2025-11-05", - urls = ["https://github.com/google/re2/archive/refs/tags/2025-11-05.tar.gz"], - sha256 = "87f6029d2f6de8aa023654240a03ada90e876ce9a4676e258dd01ea4c26ffd67", - ) - - # Abseil, LTS - # Used for GoogleTest through .bazelrc "build --define absl=1" - if not native.existing_rule("abseil-cpp"): - github_archive( - name = "abseil-cpp", - repo = "https://github.com/abseil/abseil-cpp", - tag = "20250814.1", - sha256 = "1692f77d1739bacf3f94337188b78583cf09bab7e420d2dc6c5605a4f86785a1", - ) - - # GoogleTest - if not native.existing_rule("googletest"): - github_archive( - name = "googletest", - repo = "https://github.com/google/googletest", - strip_prefix = "googletest-1.17.0", - sha256 = "65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c", - tag = "v1.17.0", - ) - - if not native.existing_rule("com_github_google_benchmark"): - github_archive( - name = "com_github_google_benchmark", - repo = "https://github.com/google/benchmark", - sha256 = "b334658edd35efcf06a99d9be21e4e93e092bd5f95074c1673d5c8705d95c104", - strip_prefix = "benchmark-1.9.4", - tag = "v1.9.4", - ) - - if not native.existing_rule("rules_python"): - http_archive( - name = "rules_python", - sha256 = "9c6e26911a79fbf510a8f06d8eedb40f412023cf7fa6d1461def27116bff022c", - strip_prefix = "rules_python-1.1.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/1.1.0/rules_python-1.1.0.tar.gz", - ) - - if not native.existing_rule("com_google_protobuf"): - http_archive( - name = "com_google_protobuf", - sha256 = "008a11cc56f9b96679b4c285fd05f46d317d685be3ab524b2a310be0fbad987e", - strip_prefix = "protobuf-29.3", - url = "https://github.com/protocolbuffers/protobuf/releases/download/v29.3/protobuf-29.3.tar.gz", - ) - - if not native.existing_rule("com_helly25_bashtest"): - http_archive( - name = "com_helly25_bashtest", - sha256 = "3f0314c2dbc6f780c02543c6355d07f98cd9935e54a07ec4477e3301434517d6", - strip_prefix = "bashtest-0.1.0", - url = "https://github.com/helly25/bashtest/releases/download/0.1.0/bashtest-0.1.0.tar.gz", - ) From eb711f9f3984c088f7b11d9731106a211cdd5345 Mon Sep 17 00:00:00 2001 From: helly25 Date: Thu, 13 Nov 2025 15:39:43 +0100 Subject: [PATCH 2/2] Still need the unused argument control for some configs. --- .bazelrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.bazelrc b/.bazelrc index cd29b2e..42ea0d8 100644 --- a/.bazelrc +++ b/.bazelrc @@ -37,6 +37,9 @@ common:clang --host_cxxopt=-gmlt common:clang --linkopt=-fuse-ld=lld common:clang --host_linkopt=-fuse-ld=lld common:clang --define is_clang=true +# Some newer Clang versions really do not like '-c': +# https://github.com/llvm/llvm-project/issues/100909 +common:clang --cxxopt=-Wno-unused-command-line-argument common:symbolizer --strip=never common:symbolizer --run_under=//tools:run_under_symbolizer