From f0ad8638743c0fb9481d3a13eb8778ebf898b194 Mon Sep 17 00:00:00 2001 From: Martin Medler Date: Sat, 25 Jan 2025 17:32:07 +0100 Subject: [PATCH] test(examples): Drop hermetic Python toolchain Setting up the hermetic toolchains is superfluous noise in the examples. Also, it requires maintaining which rules_python version we use there. Plus, loading rules_python in the examples on top of the DWYU dependencies might hide problems with the rules_python version DWYU depends on. Given we never had any issue with supporting multiple Python versions, we believe using the host interpreter in the examples is fine. --- examples/MODULE.bazel | 21 +++------------------ examples/WORKSPACE | 30 +++--------------------------- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index 2500e7dd..1c5d706d 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -6,24 +6,9 @@ local_path_override( path = "../", ) -# -# One can use DWYU without the content below. The hermetic Python toolchain increases the reproducibility when -# executing the examples as integration test. -# - -# Keep in sync with //examples/WORKSPACE -bazel_dep(name = "rules_python", version = "0.27.1", dev_dependency = True) - -python = use_extension( - "@rules_python//python/extensions:python.bzl", - "python", - dev_dependency = True, -) -python.toolchain(python_version = "3.8") - -# -# Support to make the examples work -# +## +## One can use DWYU without the content below. We simply need some further things so all examples work. +## bazel_dep(name = "external_targets", dev_dependency = True) local_path_override( diff --git a/examples/WORKSPACE b/examples/WORKSPACE index 0bab054a..1bc8d868 100644 --- a/examples/WORKSPACE +++ b/examples/WORKSPACE @@ -13,33 +13,9 @@ load("@depend_on_what_you_use//:setup_step_2.bzl", "setup_step_2") setup_step_2() -# -# One can use DWYU without the content below. The hermetic Python toolchain increases the reproducibility when -# executing the examples as integration test. -# - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -# Keep in sync with //examples/MODULE.bazel -maybe( - http_archive, - name = "rules_python", - sha256 = "e85ae30de33625a63eca7fc40a94fea845e641888e52f32b6beea91e8b1b2793", - strip_prefix = "rules_python-0.27.1", - urls = ["https://github.com/bazelbuild/rules_python/releases/download/0.27.1/rules_python-0.27.1.tar.gz"], -) - -load("@rules_python//python:repositories.bzl", "python_register_toolchains") - -python_register_toolchains( - name = "python", - python_version = "3.8", -) - -# -# Support to make the examples work -# +## +## One can use DWYU without the content below. We simply need some further things so all examples work. +## load("//:support/external_targets.bzl", "load_external_targets")