From bb422b1fd5e2f7f75ce5d1aeb0283d1337eb6f89 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 2 Apr 2025 11:18:45 -0700 Subject: [PATCH] Move `previous_release` dependency out of `WORKSPACE.bzlmod` and into `MODULE.bazel` While I was at it, I upgraded the previous release to 29.0. `PROTOBUF_PREVIOUS_RELEASE` is not currently getting updated, and I deleted it because I don't see an obvious way of referring to it from `MODULE.bazel`. Hopefully soon we can drop it from `WORKSPACE` and then the only place to update will be `MODULE.bazel`. PiperOrigin-RevId: 743211189 --- MODULE.bazel | 12 ++++++++++++ WORKSPACE | 7 +++---- WORKSPACE.bzlmod | 13 ------------- patches/protobuf_v29/0001-Update-module-name.patch | 13 +++++++++++++ protobuf_version.bzl | 1 - 5 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 patches/protobuf_v29/0001-Update-module-name.patch diff --git a/MODULE.bazel b/MODULE.bazel index c89fd3820c..0623335a68 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -237,3 +237,15 @@ archive_override( "@com_google_protobuf//:patches/protobuf_v25/0006-Add-repo_name.patch", ], ) + +bazel_dep(name = "com_google_protobuf_previous_release", version = "29.0", dev_dependency = True) +archive_override( + module_name = "com_google_protobuf_previous_release", + integrity = "sha256-EKDVjzmhqQnpXgDougtbHcZNApl/dBFRlTorNln254w=", + strip_prefix = "protobuf-29.0", + urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v29.0/protobuf-29.0.tar.gz"], + patch_strip = 1, + patches = [ + "@com_google_protobuf//:patches/protobuf_v29/0001-Update-module-name.patch", + ], +) diff --git a/WORKSPACE b/WORKSPACE index 2acda5f1e8..34a7b1a424 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -317,12 +317,11 @@ http_archive( ) # For checking breaking changes to well-known types from the previous release version. -load("//:protobuf_version.bzl", "PROTOBUF_PREVIOUS_RELEASE") - http_archive( name = "com_google_protobuf_previous_release", - strip_prefix = "protobuf-" + PROTOBUF_PREVIOUS_RELEASE, - url = "https://github.com/protocolbuffers/protobuf/releases/download/v{0}/protobuf-{0}.tar.gz".format(PROTOBUF_PREVIOUS_RELEASE), + integrity = "sha256-EKDVjzmhqQnpXgDougtbHcZNApl/dBFRlTorNln254w=", + strip_prefix = "protobuf-29.0", + urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v29.0/protobuf-29.0.tar.gz"], ) http_archive( diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod index 4bc769714d..4f78c73fac 100644 --- a/WORKSPACE.bzlmod +++ b/WORKSPACE.bzlmod @@ -1,16 +1,3 @@ # This is a WORKSPACE file used by bzlmod in combination with MODULE.bazel. # It's used for a gradual migration and it should be empty. # Don't remove this file. If the file doesn't exist, bzlmod falls back to WORKSPACE file. - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# Following are just needed to run conformance tests, not really needed to support them via MODULE.bazel - -# Needed for checking breaking changes from the previous release version. -load("//:protobuf_version.bzl", "PROTOBUF_PREVIOUS_RELEASE") - -http_archive( - name = "com_google_protobuf_previous_release", - strip_prefix = "protobuf-" + PROTOBUF_PREVIOUS_RELEASE, - url = "https://github.com/protocolbuffers/protobuf/releases/download/v{0}/protobuf-{0}.tar.gz".format(PROTOBUF_PREVIOUS_RELEASE), -) diff --git a/patches/protobuf_v29/0001-Update-module-name.patch b/patches/protobuf_v29/0001-Update-module-name.patch new file mode 100644 index 0000000000..858475ad02 --- /dev/null +++ b/patches/protobuf_v29/0001-Update-module-name.patch @@ -0,0 +1,13 @@ +diff --git a/MODULE.bazel b/MODULE.bazel +index 400186b53..1194db9ca 100644 +--- a/MODULE.bazel ++++ b/MODULE.bazel +@@ -2,7 +2,7 @@ + # https://github.com/protocolbuffers/protobuf/issues/14313 + + module( +- name = "protobuf", ++ name = "com_google_protobuf_previous_release", + version = "29.0", # Automatically updated on release + compatibility_level = 1, + repo_name = "com_google_protobuf", diff --git a/protobuf_version.bzl b/protobuf_version.bzl index eb02425d5f..1b62969998 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -5,4 +5,3 @@ PROTOBUF_PYTHON_VERSION = "6.31.0" PROTOBUF_PHP_VERSION = "4.31.0" PROTOBUF_RUBY_VERSION = "4.31.0" PROTOBUF_RUST_VERSION = "4.31.0" -PROTOBUF_PREVIOUS_RELEASE = "28.0-rc1"