From ff2d97d58bc40da27b9d7f2ee8edfa5eb15cf323 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Thu, 21 Nov 2024 13:21:11 +0100 Subject: [PATCH 01/13] fix: flags on CI workspace setups --- .bazelci/presubmit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 1808824109..ed01049540 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -132,6 +132,7 @@ tasks: bazel: last_rc ubuntu_workspace: <<: *reusable_config + <<: *common_workspace_flags name: "Default: Ubuntu, workspace" platform: ubuntu2004 mac_workspace: @@ -141,6 +142,7 @@ tasks: platform: macos windows_workspace: <<: *reusable_config + <<: *common_workspace_flags name: "Default: Windows, workspace" platform: windows From 0d3ea782534b95b13e4fa0f3fba0c5bc1938dc48 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Thu, 21 Nov 2024 13:57:52 +0100 Subject: [PATCH 02/13] Skip integration tests on Windows workspace mode. --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index ed01049540..3375b1f95d 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -142,7 +142,7 @@ tasks: platform: macos windows_workspace: <<: *reusable_config - <<: *common_workspace_flags + <<: *common_workspace_flags_min_bazel name: "Default: Windows, workspace" platform: windows From dacd3e58f153def287d77c71c0383907fa24308b Mon Sep 17 00:00:00 2001 From: Ivo List Date: Wed, 20 Nov 2024 14:23:20 +0100 Subject: [PATCH 03/13] fix: use com_google_protobuf in WORKSPACE The only way to support both workspace and bzlmod mode, is to call protobuf com_google_protobuf. Upgrade rules_cc to 0.0.16 and rules_java to 8.3.1. Those are minimal versions that are also calling protobuf again com_google_protobuf. --- MODULE.bazel | 2 +- examples/bzlmod/MODULE.bazel | 2 +- examples/bzlmod/MODULE.bazel.lock | 12 ++++++------ examples/bzlmod_build_file_generation/MODULE.bazel | 2 +- examples/multi_python_versions/MODULE.bazel | 2 +- gazelle/MODULE.bazel | 1 + internal_deps.bzl | 12 ++++++------ python/private/py_repositories.bzl | 8 ++++---- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index d3edb0356c..913a7c49cb 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -6,7 +6,7 @@ module( bazel_dep(name = "bazel_features", version = "1.9.1") bazel_dep(name = "bazel_skylib", version = "1.7.1") -bazel_dep(name = "rules_cc", version = "0.0.14") +bazel_dep(name = "rules_cc", version = "0.0.16") bazel_dep(name = "platforms", version = "0.0.4") # Those are loaded only when using py_proto_library diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel index 27dd513762..0a31c3beb8 100644 --- a/examples/bzlmod/MODULE.bazel +++ b/examples/bzlmod/MODULE.bazel @@ -19,7 +19,7 @@ bazel_dep(name = "protobuf", version = "27.0", repo_name = "com_google_protobuf" # Only needed to make rules_python's CI happy. rules_java 8.3.0+ is needed so # that --java_runtime_version=remotejdk_11 works with Bazel 8. -bazel_dep(name = "rules_java", version = "8.3.0") +bazel_dep(name = "rules_java", version = "8.3.1") # Only needed to make rules_python's CI happy. A test verifies that # MODULE.bazel.lock is cross-platform friendly, and there are transitive diff --git a/examples/bzlmod/MODULE.bazel.lock b/examples/bzlmod/MODULE.bazel.lock index 6e4d6e180b..41c52e888c 100644 --- a/examples/bzlmod/MODULE.bazel.lock +++ b/examples/bzlmod/MODULE.bazel.lock @@ -83,9 +83,9 @@ "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002", "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191", - "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac", "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc", - "https://bcr.bazel.build/modules/rules_cc/0.0.15/source.json": "48e606af0e02a716974a8b74fba6988d9f0c93af9177e28cf474bfc5fa26ab10", + "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87", + "https://bcr.bazel.build/modules/rules_cc/0.0.16/source.json": "227e83737046aa4f50015da48e98e0d8ab42fd0ec74d8d653b6cc9f9a357f200", "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f", "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", @@ -108,8 +108,8 @@ "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2", "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", "https://bcr.bazel.build/modules/rules_java/7.6.5/MODULE.bazel": "481164be5e02e4cab6e77a36927683263be56b7e36fef918b458d7a8a1ebadb1", - "https://bcr.bazel.build/modules/rules_java/8.3.0/MODULE.bazel": "cd0722696035d13523365e6a1eb1682c4b32c164aa3503f0731ef97bfad3df1e", - "https://bcr.bazel.build/modules/rules_java/8.3.0/source.json": "a2d2246ed61ea6391ca946b164d87c57644d4705072eda5b74531b48fb99b7d0", + "https://bcr.bazel.build/modules/rules_java/8.3.1/MODULE.bazel": "6df154d6cd5f9ede100d40621cc2f487071017f539caee021b24ecd91cf21034", + "https://bcr.bazel.build/modules/rules_java/8.3.1/source.json": "560c2e0e9586d38b3fe93e59ee1dee6ec39c194548eea4e619a5b37ebe6324af", "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909", "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036", @@ -1350,8 +1350,8 @@ }, "@@rules_java~//java:extensions.bzl%compatibility_proxy": { "general": { - "bzlTransitiveDigest": "tOgQSybDmdV5ILDExAWYtVmkUV75YJN0iaLnD+0RizQ=", - "usagesDigest": "0/TyZruTcO4Acns2lBIfsdJDXcTS869yRn0gpAYMGww=", + "bzlTransitiveDigest": "4UrimEM7gTMnaF+uFyxkxI5Rm+iPRtuuQcf5X3BCIes=", + "usagesDigest": "xpjtNTHKNTxqBkAIM8kCjwvcMhXBoxJptRhR8vXpaoE=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, diff --git a/examples/bzlmod_build_file_generation/MODULE.bazel b/examples/bzlmod_build_file_generation/MODULE.bazel index 2ba52466ae..30ad567879 100644 --- a/examples/bzlmod_build_file_generation/MODULE.bazel +++ b/examples/bzlmod_build_file_generation/MODULE.bazel @@ -87,4 +87,4 @@ local_path_override( ) # Only needed to make rules_python's CI happy -bazel_dep(name = "rules_java", version = "8.3.0") +bazel_dep(name = "rules_java", version = "8.3.1") diff --git a/examples/multi_python_versions/MODULE.bazel b/examples/multi_python_versions/MODULE.bazel index 51ed6f134d..578315741f 100644 --- a/examples/multi_python_versions/MODULE.bazel +++ b/examples/multi_python_versions/MODULE.bazel @@ -62,4 +62,4 @@ bazel_dep(name = "rules_shell", version = "0.2.0", dev_dependency = True) # Only needed to make rules_python's CI happy. rules_java 8.3.0+ is needed so # that --java_runtime_version=remotejdk_11 works with Bazel 8. -bazel_dep(name = "rules_java", version = "8.3.0") +bazel_dep(name = "rules_java", version = "8.3.1") diff --git a/gazelle/MODULE.bazel b/gazelle/MODULE.bazel index 0418b39036..d216ad5dc1 100644 --- a/gazelle/MODULE.bazel +++ b/gazelle/MODULE.bazel @@ -8,6 +8,7 @@ bazel_dep(name = "bazel_skylib", version = "1.6.1") bazel_dep(name = "rules_python", version = "0.18.0") bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go") bazel_dep(name = "gazelle", version = "0.33.0", repo_name = "bazel_gazelle") +bazel_dep(name = "rules_cc", version = "0.0.16") local_path_override( module_name = "rules_python", diff --git a/internal_deps.bzl b/internal_deps.bzl index 33decba9fc..488dd445bb 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -189,10 +189,10 @@ def rules_python_internal_deps(): http_archive( name = "rules_java", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_java/releases/download/6.3.0/rules_java-6.3.0.tar.gz", - "https://github.com/bazelbuild/rules_java/releases/download/6.3.0/rules_java-6.3.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/rules_java/releases/download/8.3.1/rules_java-8.3.1.tar.gz", + "https://github.com/bazelbuild/rules_java/releases/download/8.3.1/rules_java-8.3.1.tar.gz", ], - sha256 = "29ba147c583aaf5d211686029842c5278e12aaea86f66bd4a9eb5e525b7f2701", + sha256 = "ee786b943e00da4fea7c233e70e5f5b8a01cc69b9341b3f49169f174fe0df1c5", ) RULES_JVM_EXTERNAL_TAG = "5.2" @@ -224,9 +224,9 @@ def rules_python_internal_deps(): http_archive( name = "rules_cc", - urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.14/rules_cc-0.0.14.tar.gz"], - sha256 = "906e89286acc67c20819c3c88b3283de0d5868afda33635d70acae0de9777bb7", - strip_prefix = "rules_cc-0.0.14", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.16/rules_cc-0.0.16.tar.gz"], + sha256 = "bbf1ae2f83305b7053b11e4467d317a7ba3517a12cef608543c1b1c5bf48a4df", + strip_prefix = "rules_cc-0.0.16", ) http_archive( diff --git a/python/private/py_repositories.bzl b/python/private/py_repositories.bzl index 6283ad7cbc..ee21cddba0 100644 --- a/python/private/py_repositories.bzl +++ b/python/private/py_repositories.bzl @@ -55,14 +55,14 @@ def py_repositories(): ) http_archive( name = "rules_cc", - sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80", - strip_prefix = "rules_cc-0.0.13", - urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"], + sha256 = "bbf1ae2f83305b7053b11e4467d317a7ba3517a12cef608543c1b1c5bf48a4df", + strip_prefix = "rules_cc-0.0.16", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.16/rules_cc-0.0.16.tar.gz"], ) # Needed by rules_cc, triggerred by @rules_java_prebuilt in Bazel by using @rules_cc//cc:defs.bzl http_archive( - name = "protobuf", + name = "com_google_protobuf", sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", strip_prefix = "protobuf-27.0", url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", From e520948abf98e54836de0c4f726361143a95bfd2 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Wed, 20 Nov 2024 14:36:23 +0100 Subject: [PATCH 04/13] Set up rules_java in WORKSPACE --- internal_setup.bzl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal_setup.bzl b/internal_setup.bzl index b28c0e28b7..03b3c02e98 100644 --- a/internal_setup.bzl +++ b/internal_setup.bzl @@ -20,6 +20,7 @@ load("@cgrindel_bazel_starlib//:deps.bzl", "bazel_starlib_dependencies") load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") load("@rules_bazel_integration_test//bazel_integration_test:deps.bzl", "bazel_integration_test_rules_dependencies") load("@rules_bazel_integration_test//bazel_integration_test:repo_defs.bzl", "bazel_binaries") +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains") load("//:version.bzl", "SUPPORTED_BAZEL_VERSIONS") @@ -52,6 +53,9 @@ def rules_python_internal_setup(): protobuf_deps() + rules_java_dependencies() + rules_java_toolchains() + bazel_integration_test_rules_dependencies() bazel_starlib_dependencies() bazel_binaries(versions = SUPPORTED_BAZEL_VERSIONS) From f41f51ce716e2d8cc566652446921fc84afb27c1 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Wed, 20 Nov 2024 16:16:08 +0100 Subject: [PATCH 05/13] Match WORKSPACE protobuf version with bzlmod version --- python/private/py_repositories.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/private/py_repositories.bzl b/python/private/py_repositories.bzl index ee21cddba0..52a72ded7b 100644 --- a/python/private/py_repositories.bzl +++ b/python/private/py_repositories.bzl @@ -63,8 +63,8 @@ def py_repositories(): # Needed by rules_cc, triggerred by @rules_java_prebuilt in Bazel by using @rules_cc//cc:defs.bzl http_archive( name = "com_google_protobuf", - sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", - strip_prefix = "protobuf-27.0", - url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", + sha256 = "23082dca1ca73a1e9c6cbe40097b41e81f71f3b4d6201e36c134acc30a1b3660", + url = "https://github.com/protocolbuffers/protobuf/releases/download/v29.0-rc2/protobuf-29.0-rc2.zip", + strip_prefix = "protobuf-29.0-rc2", ) pypi_deps() From f5adc3a7c73efb59b399996745522e3d19189abe Mon Sep 17 00:00:00 2001 From: Ivo List Date: Wed, 20 Nov 2024 16:56:40 +0100 Subject: [PATCH 06/13] Upgrade protobuf in internal setup --- internal_deps.bzl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/internal_deps.bzl b/internal_deps.bzl index 488dd445bb..f7c363c8c6 100644 --- a/internal_deps.bzl +++ b/internal_deps.bzl @@ -178,11 +178,9 @@ def rules_python_internal_deps(): http_archive( name = "com_google_protobuf", - sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", - strip_prefix = "protobuf-27.0", - urls = [ - "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz", - ], + sha256 = "23082dca1ca73a1e9c6cbe40097b41e81f71f3b4d6201e36c134acc30a1b3660", + url = "https://github.com/protocolbuffers/protobuf/releases/download/v29.0-rc2/protobuf-29.0-rc2.zip", + strip_prefix = "protobuf-29.0-rc2", ) # Needed for stardoc From 0d9c3e5603a0556647e408c2609c5c412058a598 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Wed, 20 Nov 2024 17:36:26 +0100 Subject: [PATCH 07/13] Upgrade bazel_skylib to 1.7.0, required by protobuf --- python/private/py_repositories.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/private/py_repositories.bzl b/python/private/py_repositories.bzl index 52a72ded7b..7da61a31d6 100644 --- a/python/private/py_repositories.bzl +++ b/python/private/py_repositories.bzl @@ -47,10 +47,10 @@ def py_repositories(): ) http_archive( name = "bazel_skylib", - sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", + sha256 = "d00f1389ee20b60018e92644e0948e16e350a7707219e7a390fb0a99b6ec9262", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.0/bazel-skylib-1.7.0.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.0/bazel-skylib-1.7.0.tar.gz", ], ) http_archive( From 1312ff931892bcb4625d7463ab3b7736dc1be472 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Wed, 20 Nov 2024 10:34:32 -0800 Subject: [PATCH 08/13] Update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5d045edc..c378043acb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,12 +70,15 @@ Unreleased changes template. bzlmod extension. * (bzlmod) `pip.parse.parse_all_requirements_files` attribute has been removed. See notes in the previous versions about what to do. +* (deps) rules_cc 0.0.16 +* (deps) protobuf 29.0-rc2 (workspace; bzlmod already specifying that version) Other changes: * (python_repository) Start honoring the `strip_prefix` field for `zstd` archives. * (pypi) {bzl:obj}`pip_parse.extra_hub_aliases` now works in WORKSPACE files. * (binaries/tests) For {obj}`--bootstrap_impl=script`, a binary-specific (but otherwise empty) virtual env is used to customize `sys.path` initialization. +* (deps) bazel_skylib 1.7.0 (workspace; bzlmod already specifying that version) {#v0-0-0-fixed} ### Fixed @@ -88,6 +91,8 @@ Other changes: * (binaries/tests) ({obj}`--bootstrap_impl=scipt`) Using `sys.executable` will use the same `sys.path` setup as the calling binary. ([2169](https://github.com/bazelbuild/rules_python/issues/2169)). +* (workspace): Corrected protobuf's name to com_google_protobuf, the name is + hardcoded in Bazel, WORKSPACE mode. {#v0-0-0-added} ### Added From 1e43ae6507895f062bbe23580529d47ded6329d8 Mon Sep 17 00:00:00 2001 From: Ivo List Date: Thu, 21 Nov 2024 14:09:23 +0100 Subject: [PATCH 09/13] Upgrade rules_cc to 0.1.0 in WORKSPACE --- python/private/py_repositories.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/private/py_repositories.bzl b/python/private/py_repositories.bzl index 7da61a31d6..8a856aad38 100644 --- a/python/private/py_repositories.bzl +++ b/python/private/py_repositories.bzl @@ -55,9 +55,9 @@ def py_repositories(): ) http_archive( name = "rules_cc", - sha256 = "bbf1ae2f83305b7053b11e4467d317a7ba3517a12cef608543c1b1c5bf48a4df", - strip_prefix = "rules_cc-0.0.16", - urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.16/rules_cc-0.0.16.tar.gz"], + sha256 = "4b12149a041ddfb8306a8fd0e904e39d673552ce82e4296e96fac9cbf0780e59", + strip_prefix = "rules_cc-0.1.0", + urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.1.0/rules_cc-0.1.0.tar.gz"], ) # Needed by rules_cc, triggerred by @rules_java_prebuilt in Bazel by using @rules_cc//cc:defs.bzl From ffb3798d1ba6bbc2a4fac04a16a4cd6396eda44e Mon Sep 17 00:00:00 2001 From: Ivo List Date: Thu, 21 Nov 2024 14:32:13 +0100 Subject: [PATCH 10/13] Disable doc targets in workspace mode --- .bazelci/presubmit.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 3375b1f95d..a5fbd6d711 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -40,6 +40,20 @@ buildifier: - "..." test_flags: - "--test_tag_filters=-integration-test" +.disable_docs: &disable_docs + build_targets: + - "--" + - "..." + # As a regression test for #225, check that wheel targets still build when + # their package path is qualified with the repo name. + - "@rules_python//examples/wheel/..." + - "-//sphinxdocs/..." + - "-//docs/..." + test_targets: + - "--" + - "..." + - "-//sphinxdocs/..." + - "-//docs/..." .common_workspace_flags_min_bazel: &common_workspace_flags_min_bazel build_flags: - "--noenable_bzlmod" @@ -131,12 +145,12 @@ tasks: platform: ubuntu2004 bazel: last_rc ubuntu_workspace: - <<: *reusable_config + <<: *disable_docs <<: *common_workspace_flags name: "Default: Ubuntu, workspace" platform: ubuntu2004 mac_workspace: - <<: *reusable_config + <<: *disable_docs <<: *common_workspace_flags name: "Default: Mac, workspace" platform: macos From 7771c0dc6b1dcb00ac81572dcec716a045f7ac3f Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Thu, 21 Nov 2024 09:16:35 -0800 Subject: [PATCH 11/13] fix changlog, add note about com_google_protobuf repo name --- CHANGELOG.md | 6 +++--- python/private/py_repositories.bzl | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c378043acb..5d8398b835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,8 +70,8 @@ Unreleased changes template. bzlmod extension. * (bzlmod) `pip.parse.parse_all_requirements_files` attribute has been removed. See notes in the previous versions about what to do. -* (deps) rules_cc 0.0.16 -* (deps) protobuf 29.0-rc2 (workspace; bzlmod already specifying that version) +* (deps) rules_cc 0.1.0 (workspace) and 0.0.16 (bzlmod). +* (deps) protobuf 29.0-rc2 (workspace; bzlmod already specifying that version). Other changes: * (python_repository) Start honoring the `strip_prefix` field for `zstd` archives. @@ -91,7 +91,7 @@ Other changes: * (binaries/tests) ({obj}`--bootstrap_impl=scipt`) Using `sys.executable` will use the same `sys.path` setup as the calling binary. ([2169](https://github.com/bazelbuild/rules_python/issues/2169)). -* (workspace): Corrected protobuf's name to com_google_protobuf, the name is +* (workspace) Corrected protobuf's name to com_google_protobuf, the name is hardcoded in Bazel, WORKSPACE mode. {#v0-0-0-added} diff --git a/python/private/py_repositories.bzl b/python/private/py_repositories.bzl index 8a856aad38..46ca903df4 100644 --- a/python/private/py_repositories.bzl +++ b/python/private/py_repositories.bzl @@ -60,7 +60,9 @@ def py_repositories(): urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.1.0/rules_cc-0.1.0.tar.gz"], ) - # Needed by rules_cc, triggerred by @rules_java_prebuilt in Bazel by using @rules_cc//cc:defs.bzl + # Needed by rules_cc, triggered by @rules_java_prebuilt in Bazel by using @rules_cc//cc:defs.bzl + # NOTE: This name must be com_google_protobuf until Bazel drops WORKSPACE + # support; Bazel itself has references to com_google_protobuf. http_archive( name = "com_google_protobuf", sha256 = "23082dca1ca73a1e9c6cbe40097b41e81f71f3b4d6201e36c134acc30a1b3660", From f2cf35cf8c18b9dd41da88d860db51cb6e1b051c Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Thu, 21 Nov 2024 09:32:27 -0800 Subject: [PATCH 12/13] Set docs as incompatible for workspace builds --- docs/BUILD.bazel | 2 +- sphinxdocs/docs/BUILD.bazel | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index a4b6a5a440..a9a1db02a8 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -36,7 +36,7 @@ _TARGET_COMPATIBLE_WITH = select({ "@platforms//os:linux": [], "@platforms//os:macos": [], "//conditions:default": ["@platforms//:incompatible"], -}) if IS_BAZEL_7_OR_HIGHER else ["@platforms//:incompatible"] +}) if BZLMOD_ENABLED else ["@platforms//:incompatible"] # See README.md for instructions. Short version: # * `bazel run //docs:docs.serve` in a separate terminal diff --git a/sphinxdocs/docs/BUILD.bazel b/sphinxdocs/docs/BUILD.bazel index 6af908dc4c..070e0485d7 100644 --- a/sphinxdocs/docs/BUILD.bazel +++ b/sphinxdocs/docs/BUILD.bazel @@ -1,4 +1,4 @@ -load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility +load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility load("//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") load("//sphinxdocs:sphinx_stardoc.bzl", "sphinx_stardocs") @@ -14,7 +14,7 @@ _TARGET_COMPATIBLE_WITH = select({ "@platforms//os:linux": [], "@platforms//os:macos": [], "//conditions:default": ["@platforms//:incompatible"], -}) if IS_BAZEL_7_OR_HIGHER else ["@platforms//:incompatible"] +}) if BZLMOD_ENABLED else ["@platforms//:incompatible"] sphinx_docs_library( name = "docs_lib", From 9b63950b3487cf48f2096d1bfb9715419c39641e Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Thu, 21 Nov 2024 09:39:20 -0800 Subject: [PATCH 13/13] remove disable_docs config from presubmit; target_compatible_with skips docs instead now --- .bazelci/presubmit.yml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index a5fbd6d711..ed01049540 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -40,20 +40,6 @@ buildifier: - "..." test_flags: - "--test_tag_filters=-integration-test" -.disable_docs: &disable_docs - build_targets: - - "--" - - "..." - # As a regression test for #225, check that wheel targets still build when - # their package path is qualified with the repo name. - - "@rules_python//examples/wheel/..." - - "-//sphinxdocs/..." - - "-//docs/..." - test_targets: - - "--" - - "..." - - "-//sphinxdocs/..." - - "-//docs/..." .common_workspace_flags_min_bazel: &common_workspace_flags_min_bazel build_flags: - "--noenable_bzlmod" @@ -145,18 +131,18 @@ tasks: platform: ubuntu2004 bazel: last_rc ubuntu_workspace: - <<: *disable_docs + <<: *reusable_config <<: *common_workspace_flags name: "Default: Ubuntu, workspace" platform: ubuntu2004 mac_workspace: - <<: *disable_docs + <<: *reusable_config <<: *common_workspace_flags name: "Default: Mac, workspace" platform: macos windows_workspace: <<: *reusable_config - <<: *common_workspace_flags_min_bazel + <<: *common_workspace_flags name: "Default: Windows, workspace" platform: windows