From 0c0509578f01b460abee10ec453bae44cf2b6a7f Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Mon, 10 Nov 2025 23:44:57 +0900 Subject: [PATCH 1/3] add ci config to test 7, 8 and 9 for bcr like setup --- .bazelci/presubmit.yml | 158 +++++++++++++---------------------------- 1 file changed, 50 insertions(+), 108 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 1cb3a01365..09d38f3146 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -87,7 +87,57 @@ buildifier: - //tests:version_3_11_test - //tests:version_3_9_test - //tests:version_default_test + +matrix: + platform: + - ubuntu2204 + - macos + - windows + bazel: [7.*, 8.*, 9.*] + bcr_variant: + - examples/bzlmod + - gazelle/examples/bzlmod_build_file_generation tasks: + # Keep in sync with .bcr/presubmit.yml + bcr_tests: + name: BCR test module + platform: ${{ platform }} + bazel: ${{ bazel }} + working_directory: ${{ bcr_variant }} + platform: ${{ platform }} + bazel: ${{ bazel }} + shell_commands: + - "bazel vendor --vendor_dir=./vendor //..." + - "bazel build --vendor_dir=./vendor //..." + - "rm -rf ./vendor" + coverage_targets: ["//:test"] + test_flags: + - "--keep_going" + # Without these cxxopts, BCR's Mac builds fail + - '--cxxopt=-std=c++14' + - '--host_cxxopt=-std=c++14' + test_targets: + - "//..." + bcr_gazelle_tests: + # Keep in sync with .bcr/gazelle/presubmit.yml + name: BCR gazelle test module + platform: ${{ platform }} + bazel: ${{ bazel }} + working_directory: ${{ bcr_variant }} + # Regenerate the BUILD files for the test module using Gazelle. + # Also verify -repo_config are generated correctly in gazelle.bash + shell_commands: + - "echo 'common --override_module=rules_python=' >> .bazelrc" + - bazel run //:gazelle + batch_commands: + - "echo common --override_module=rules_python= >> .bazelrc" + - bazel run //:gazelle + build_targets: + - "//..." + - ":modules_map" + test_targets: + - "//..." + gazelle_extension_min: <<: *common_workspace_flags_min_bazel <<: *minimum_supported_version @@ -258,114 +308,6 @@ tasks: working_directory: examples/build_file_generation platform: windows - integration_test_bzlmod_ubuntu_min: - <<: *minimum_supported_version - <<: *reusable_build_test_all - coverage_targets: ["//:test"] - name: "examples/bzlmod: Ubuntu, minimum Bazel" - working_directory: examples/bzlmod - platform: ubuntu2204 - bazel: 7.x - integration_test_bzlmod_ubuntu: - <<: *reusable_build_test_all - <<: *coverage_targets_example_bzlmod - name: "examples/bzlmod: Ubuntu" - working_directory: examples/bzlmod - platform: ubuntu2204 - bazel: 7.x - integration_test_bzlmod_ubuntu_upcoming: - <<: *reusable_build_test_all - <<: *coverage_targets_example_bzlmod - name: "examples/bzlmod: Ubuntu, upcoming Bazel" - working_directory: examples/bzlmod - platform: ubuntu2204 - bazel: last_rc - integration_test_bzlmod_debian: - <<: *reusable_build_test_all - <<: *coverage_targets_example_bzlmod - name: "examples/bzlmod: Debian" - working_directory: examples/bzlmod - platform: debian11 - bazel: 7.x - integration_test_bzlmod_ubuntu_vendor: - <<: *reusable_build_test_all - name: "examples/bzlmod: bazel vendor" - working_directory: examples/bzlmod - platform: ubuntu2204 - shell_commands: - - "bazel vendor --vendor_dir=./vendor //..." - - "bazel build --vendor_dir=./vendor //..." - - "rm -rf ./vendor" - integration_test_bzlmod_macos: - <<: *reusable_build_test_all - <<: *coverage_targets_example_bzlmod - name: "examples/bzlmod: macOS" - working_directory: examples/bzlmod - platform: macos - bazel: 7.x - integration_test_bzlmod_macos_upcoming: - <<: *reusable_build_test_all - <<: *coverage_targets_example_bzlmod - name: "examples/bzlmod: macOS, upcoming Bazel" - working_directory: examples/bzlmod - platform: macos - bazel: last_rc - integration_test_bzlmod_windows: - <<: *reusable_build_test_all - # coverage is not supported on Windows - name: "examples/bzlmod: Windows" - working_directory: examples/bzlmod - platform: windows - bazel: 7.x - integration_test_bzlmod_windows_upcoming: - <<: *reusable_build_test_all - # coverage is not supported on Windows - name: "examples/bzlmod: Windows, upcoming Bazel" - working_directory: examples/bzlmod - platform: windows - bazel: last_rc - - integration_test_bzlmod_generate_build_file_generation_ubuntu_min: - <<: *minimum_supported_version - <<: *reusable_build_test_all - <<: *coverage_targets_example_bzlmod_build_file_generation - name: "gazelle/examples/bzlmod_build_file_generation: Ubuntu, minimum Bazel" - working_directory: gazelle/examples/bzlmod_build_file_generation - platform: ubuntu2204 - bazel: 7.x - integration_test_bzlmod_generation_build_files_ubuntu: - <<: *reusable_build_test_all - <<: *coverage_targets_example_bzlmod_build_file_generation - name: "gazelle/examples/bzlmod_build_file_generation: Ubuntu" - working_directory: gazelle/examples/bzlmod_build_file_generation - platform: ubuntu2204 - integration_test_bzlmod_generation_build_files_ubuntu_run: - <<: *reusable_build_test_all - name: "gazelle/examples/bzlmod_build_file_generation: Ubuntu, Gazelle and pip" - working_directory: gazelle/examples/bzlmod_build_file_generation - platform: ubuntu2204 - shell_commands: - - "bazel run //:gazelle_python_manifest.update" - - "bazel run //:gazelle -- update" - integration_test_bzlmod_build_file_generation_debian: - <<: *reusable_build_test_all - <<: *coverage_targets_example_bzlmod_build_file_generation - name: "gazelle/examples/bzlmod_build_file_generation: Debian" - working_directory: gazelle/examples/bzlmod_build_file_generation - platform: debian11 - integration_test_bzlmod_build_file_generation_macos: - <<: *reusable_build_test_all - <<: *coverage_targets_example_bzlmod_build_file_generation - name: "gazelle/examples/bzlmod_build_file_generation: MacOS" - working_directory: gazelle/examples/bzlmod_build_file_generation - platform: macos - integration_test_bzlmod_build_file_generation_windows: - <<: *reusable_build_test_all - # coverage is not supported on Windows - name: "gazelle/examples/bzlmod_build_file_generation: Windows" - working_directory: gazelle/examples/bzlmod_build_file_generation - platform: windows - integration_test_multi_python_versions_ubuntu_workspace: <<: *reusable_build_test_all <<: *common_workspace_flags From 7080341dbb823ecb91137fe4f65c62796fa94c34 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Mon, 10 Nov 2025 23:58:50 +0900 Subject: [PATCH 2/3] bump gazelle and rules_go for bazel 9 compatibility --- MODULE.bazel | 2 +- gazelle/MODULE.bazel | 4 ++-- gazelle/examples/bzlmod_build_file_generation/.bazelrc | 2 +- .../examples/bzlmod_build_file_generation/MODULE.bazel | 4 ++-- gazelle/go.mod | 10 ++++++---- gazelle/go.sum | 6 ++++++ 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 6e9b725c53..7162911398 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -226,7 +226,7 @@ bazel_dep(name = "another_module", version = "0", dev_dependency = True) # Extra gazelle plugin deps so that WORKSPACE.bzlmod can continue including it for e2e tests. # We use `WORKSPACE.bzlmod` because it is impossible to have dev-only local overrides. -bazel_dep(name = "rules_go", version = "0.41.0", dev_dependency = True, repo_name = "io_bazel_rules_go") +bazel_dep(name = "rules_go", version = "0.59.0", dev_dependency = True, repo_name = "io_bazel_rules_go") bazel_dep(name = "rules_python_gazelle_plugin", version = "0", dev_dependency = True) bazel_dep(name = "gazelle", version = "0.40.0", dev_dependency = True, repo_name = "bazel_gazelle") diff --git a/gazelle/MODULE.bazel b/gazelle/MODULE.bazel index add5986903..cff6341a2b 100644 --- a/gazelle/MODULE.bazel +++ b/gazelle/MODULE.bazel @@ -6,8 +6,8 @@ module( bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "rules_python", version = "0.18.0") -bazel_dep(name = "rules_go", version = "0.55.1", repo_name = "io_bazel_rules_go") -bazel_dep(name = "gazelle", version = "0.36.0", repo_name = "bazel_gazelle") +bazel_dep(name = "rules_go", version = "0.59.0", repo_name = "io_bazel_rules_go") +bazel_dep(name = "gazelle", version = "0.47.0", repo_name = "bazel_gazelle") bazel_dep(name = "rules_cc", version = "0.0.16") local_path_override( diff --git a/gazelle/examples/bzlmod_build_file_generation/.bazelrc b/gazelle/examples/bzlmod_build_file_generation/.bazelrc index d58665596b..31097b41de 100644 --- a/gazelle/examples/bzlmod_build_file_generation/.bazelrc +++ b/gazelle/examples/bzlmod_build_file_generation/.bazelrc @@ -3,7 +3,7 @@ test --test_output=errors --enable_runfiles # Windows requires these for multi-python support: build --enable_runfiles -common --experimental_enable_bzlmod +common --enable_bzlmod coverage --java_runtime_version=remotejdk_11 common:bazel7.x --incompatible_python_disallow_native_rules diff --git a/gazelle/examples/bzlmod_build_file_generation/MODULE.bazel b/gazelle/examples/bzlmod_build_file_generation/MODULE.bazel index ce779627f5..1f92ea3826 100644 --- a/gazelle/examples/bzlmod_build_file_generation/MODULE.bazel +++ b/gazelle/examples/bzlmod_build_file_generation/MODULE.bazel @@ -31,7 +31,7 @@ local_path_override( # The following stanza defines the dependency for gazelle # See here https://github.com/bazelbuild/bazel-gazelle/releases/ for the # latest version. -bazel_dep(name = "gazelle", version = "0.36.0", repo_name = "bazel_gazelle") +bazel_dep(name = "gazelle", version = "0.47.0", repo_name = "bazel_gazelle") # The following stanze returns a proxy object representing a module extension; # its methods can be invoked to create module extension tags. @@ -84,4 +84,4 @@ local_path_override( ) # Only needed to make rules_python's CI happy -bazel_dep(name = "rules_java", version = "8.3.1") +bazel_dep(name = "rules_java", version = "8.16.1") diff --git a/gazelle/go.mod b/gazelle/go.mod index 7623079af9..4d27ed3fbd 100644 --- a/gazelle/go.mod +++ b/gazelle/go.mod @@ -1,12 +1,14 @@ module github.com/bazel-contrib/rules_python/gazelle -go 1.21.13 +go 1.22.9 + +toolchain go1.23.6 require ( - github.com/bazelbuild/bazel-gazelle v0.36.0 - github.com/bazelbuild/buildtools v0.0.0-20240313121412-66c605173954 + github.com/bazelbuild/bazel-gazelle v0.47.0 + github.com/bazelbuild/buildtools v0.0.0-20250930140053-2eb4fccefb52 github.com/bazelbuild/rules_go v0.55.1 - github.com/bmatcuk/doublestar/v4 v4.7.1 + github.com/bmatcuk/doublestar/v4 v4.9.1 github.com/emirpasic/gods v1.18.1 github.com/ghodss/yaml v1.0.0 github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82 diff --git a/gazelle/go.sum b/gazelle/go.sum index 5a4d42d46a..2bda8af105 100644 --- a/gazelle/go.sum +++ b/gazelle/go.sum @@ -2,12 +2,18 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/bazelbuild/bazel-gazelle v0.36.0 h1:n41ODckCkU9D2BEwBxYN+xu5E92Vd0gaW6QmsIW9l00= github.com/bazelbuild/bazel-gazelle v0.36.0/go.mod h1:5wGHbkRpDUdz4LxREtPYwXstrWfnkV+oDmOuxNAxW1s= +github.com/bazelbuild/bazel-gazelle v0.47.0 h1:g3Rr1ZbkC1Pk20aOgBITxSD/efS1WbaSty5jC786Z3Q= +github.com/bazelbuild/bazel-gazelle v0.47.0/go.mod h1:8Ozf20jhv+in87nCUHdmUPPcVGTfKg/gotZ/hce3T+w= github.com/bazelbuild/buildtools v0.0.0-20240313121412-66c605173954 h1:VNqmvOfFzn2Hrtoni8vqgXlIQ4C2Zt22fxeZ9gOOkp0= github.com/bazelbuild/buildtools v0.0.0-20240313121412-66c605173954/go.mod h1:689QdV3hBP7Vo9dJMmzhoYIyo/9iMhEmHkJcnaPRCbo= +github.com/bazelbuild/buildtools v0.0.0-20250930140053-2eb4fccefb52 h1:njQAmjTv/YHRm/0Lfv9DXHFZ4MdT2IA/RKHTnqZkgDw= +github.com/bazelbuild/buildtools v0.0.0-20250930140053-2eb4fccefb52/go.mod h1:PLNUetjLa77TCCziPsz0EI8a6CUxgC+1jgmWv0H25tg= github.com/bazelbuild/rules_go v0.55.1 h1:cQYGcunY8myOB+0Ym6PGQRhc/milkRcNv0my3XgxaDU= github.com/bazelbuild/rules_go v0.55.1/go.mod h1:T90Gpyq4HDFlsrvtQa2CBdHNJ2P4rAu/uUTmQbanzf0= github.com/bmatcuk/doublestar/v4 v4.7.1 h1:fdDeAqgT47acgwd9bd9HxJRDmc9UAmPpc+2m0CXv75Q= github.com/bmatcuk/doublestar/v4 v4.7.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= +github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= From f2b68763095cc40c60ecb34ac5ab317625ee6841 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius <240938+aignas@users.noreply.github.com> Date: Tue, 11 Nov 2025 00:00:44 +0900 Subject: [PATCH 3/3] fix the matrix --- .bazelci/presubmit.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 09d38f3146..eba03f394c 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -94,16 +94,13 @@ matrix: - macos - windows bazel: [7.*, 8.*, 9.*] - bcr_variant: - - examples/bzlmod - - gazelle/examples/bzlmod_build_file_generation tasks: # Keep in sync with .bcr/presubmit.yml bcr_tests: name: BCR test module platform: ${{ platform }} bazel: ${{ bazel }} - working_directory: ${{ bcr_variant }} + working_directory: examples/bzlmod platform: ${{ platform }} bazel: ${{ bazel }} shell_commands: @@ -123,7 +120,7 @@ tasks: name: BCR gazelle test module platform: ${{ platform }} bazel: ${{ bazel }} - working_directory: ${{ bcr_variant }} + working_directory: gazelle/examples/bzlmod_build_file_generation # Regenerate the BUILD files for the test module using Gazelle. # Also verify -repo_config are generated correctly in gazelle.bash shell_commands: