From c227a9ddf0bbd9a0146c32a3d708b960836d7cd0 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 22 Jun 2026 10:32:36 -0700 Subject: [PATCH] Remove -release suffix from Rust Crates.io release if minor version >= 36 This change signals that we actually will subscribe the library semver going forward. PiperOrigin-RevId: 936130634 --- .../substitute_rust_release_version.bzl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rust/release_crates/substitute_rust_release_version.bzl b/rust/release_crates/substitute_rust_release_version.bzl index e0ea9ce5f8952..cfe2cc8ff5e88 100644 --- a/rust/release_crates/substitute_rust_release_version.bzl +++ b/rust/release_crates/substitute_rust_release_version.bzl @@ -2,10 +2,20 @@ load("//:protobuf_version.bzl", "PROTOBUF_RUST_VERSION") +def _get_minor_version(version_str): + parts = version_str.split(".") + if len(parts) < 2: + return 0 + return int(parts[1]) + +_minor_version = _get_minor_version(PROTOBUF_RUST_VERSION) + # Temporarily append a -release suffix to non-RC versions until we consider the # release stable. Since "release" lexicographically comes after "rc", Cargo # will understand that 4.31.0-release is newer than all 4.31.0-rc.N releases. -PROTOBUF_RUST_VERSION_SUFFIX = "-release" if PROTOBUF_RUST_VERSION.find("-rc") == -1 else "" +# Remove the -release tag only if the minor version number is >= 36. +_should_append_release = _minor_version < 36 and PROTOBUF_RUST_VERSION.find("-rc") == -1 +PROTOBUF_RUST_VERSION_SUFFIX = "-release" if _should_append_release else "" def substitute_rust_release_version(src, out, name = None): version = PROTOBUF_RUST_VERSION + PROTOBUF_RUST_VERSION_SUFFIX