From aac047028f29d9ef8064ef3efb947e52a465915f Mon Sep 17 00:00:00 2001 From: Martin Medler Date: Sun, 25 Feb 2024 18:29:14 +0100 Subject: [PATCH 1/3] Improve releasing to the BCR - It is recommended to not use compatibility_level until there is a concrete reason - Dependencies in MODULE.bazel should be the minimum requirements, not the latest available versions. Thus, do not keep in sync with the WORKSPACE approach. In WORKSPACE, dependencies can overwrite each other and thus providing more flexibility (and problems). - We configure a proper presubmit check --- .bcr/presubmit.yml | 17 +++++++---------- MODULE.bazel | 4 ---- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index c0708749..2c7ebc07 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -1,16 +1,13 @@ -# We configure this at it seems to be mandatory, but instead of performing of executing integration tests as intended, -# we execute the unit tests. We trust our integration tests in our CI to ensure everything is fine for a release. -# Either way, our integration tests are basd on Python scripts and currently could not be executed by a bazel test -# command either way. bcr_test_module: - module_path: "e2e/bzlmod" + module_path: "examples" matrix: platform: [ "macos", "ubuntu2004", "windows" ] - bazel: [ 5.4.0, 6.x, 7.x ] + # DWYU supports Bazel 5.4.0, but only via WORKSPACE + bazel: [ 6.x, 7.x ] tasks: - run_tests: - name: "Run unit tests" + verify_examples: + name: "Verify examples" platform: ${{ platform }} bazel: ${{ bazel }} - test_targets: - - "//src/..." + shell_commands: + - python test.py diff --git a/MODULE.bazel b/MODULE.bazel index 5ba07b4b..1ae05f48 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -2,22 +2,18 @@ module( name = "depend_on_what_you_use", # Keep in sync with setup_step_2.bzl bazel_compatibility = [">=5.4.0"], - compatibility_level = 0, ) bazel_dep( name = "bazel_skylib", - # Keep in sync with //third_party/dependencies.bzl version = "1.5.0", ) bazel_dep( name = "rules_cc", - # Keep in sync with //third_party/dependencies.bzl version = "0.0.9", ) bazel_dep( name = "rules_python", - # Keep in sync with //third_party/dependencies.bzl # Keep in sync with //examples/MODULE.bazel # Keep in sync with //test/aspect/MODULE.bazel # Keep in sync with //test/apply_fixes/execution_logic.py From e76cf0238d7f10264e60047ef65b23c37e98627b Mon Sep 17 00:00:00 2001 From: Martin Medler Date: Wed, 28 Feb 2024 21:10:37 +0100 Subject: [PATCH 2/3] Reduce used rules_cc version MODULE.bazel should define the minimum version required. --- MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index 1ae05f48..653f344c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -10,7 +10,7 @@ bazel_dep( ) bazel_dep( name = "rules_cc", - version = "0.0.9", + version = "0.0.8", ) bazel_dep( name = "rules_python", From e7098fd301f4d4eb72a7ba367047f8d4d98e1ecc Mon Sep 17 00:00:00 2001 From: Martin Medler Date: Wed, 28 Feb 2024 21:17:22 +0100 Subject: [PATCH 3/3] Make skylib a dev dependency --- MODULE.bazel | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 653f344c..1a6e0428 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,10 +4,6 @@ module( bazel_compatibility = [">=5.4.0"], ) -bazel_dep( - name = "bazel_skylib", - version = "1.5.0", -) bazel_dep( name = "rules_cc", version = "0.0.8", @@ -30,6 +26,12 @@ use_repo(non_module_dependencies, "dwyu_pcpp") ### Development Dependencies ### +bazel_dep( + name = "bazel_skylib", + version = "1.5.0", + dev_dependency = True, +) + python = use_extension( "@rules_python//python/extensions:python.bzl", "python",