Auto insert the version number into the Cargo.toml files.

PiperOrigin-RevId: 698432644
pull/19299/head
Protobuf Team Bot 3 months ago committed by Copybara-Service
parent 3781f45f39
commit 03d24e3805
  1. 14
      rust/BUILD
  2. 14
      rust/cargo/BUILD
  3. 4
      rust/cargo/Cargo-template.toml
  4. 13
      rust/protobuf_codegen/BUILD
  5. 4
      rust/protobuf_codegen/Cargo-template.toml

@ -69,6 +69,18 @@ PROTOBUF_SHARED = [
# go/keep-sorted end
]
# All Rust source files; this is used for packaging up a crate.
ALL_RUST_SRCS = PROTOBUF_SHARED + [
# go/keep-sorted start
"cpp.rs",
"gtest_matchers.rs",
"gtest_matchers_impl.rs",
"protobuf.rs",
"upb.rs",
"utf8.rs",
# go/keep-sorted end
]
# The Rust Protobuf runtime using the upb kernel.
#
# `rust_upb_proto_library` implicitly depends on this target. This target cannot depend on
@ -255,7 +267,7 @@ SRC_ROOT = "rust"
pkg_files(
name = "rust_protobuf_src",
srcs = glob(["*"]),
srcs = ALL_RUST_SRCS,
strip_prefix = strip_prefix.from_root(SRC_ROOT),
)

@ -1,5 +1,17 @@
load("//:protobuf_version.bzl", "PROTOBUF_RUST_VERSION")
genrule(
name = "gen_cargo_toml",
srcs = ["Cargo-template.toml"],
outs = ["Cargo.toml"],
cmd = "cat $(SRCS) | sed -e 's/{{VERSION}}/{0}-beta/g' > $(OUTS)".format(PROTOBUF_RUST_VERSION),
)
filegroup(
name = "srcs",
srcs = glob(["**/*"]),
srcs = [
"build.rs",
":gen_cargo_toml",
],
visibility = ["//rust:__subpackages__"],
)

@ -7,8 +7,8 @@
[package]
name = "protobuf"
version = "4.27.3-beta.0"
edition = "2021"
version = "{VERSION}"
edition = "2021" # The Rust edition (not to be confused with Protobuf Edition).
links = "libupb"
license = "BSD-3-Clause"
rust-version = "1.74"

@ -1,5 +1,16 @@
load("//:protobuf_version.bzl", "PROTOBUF_RUST_VERSION")
genrule(
name = "gen_cargo_toml",
srcs = ["Cargo-template.toml"],
outs = ["Cargo.toml"],
cmd = "cat $(SRCS) | sed -e 's/{{VERSION}}/{0}-beta/g' > $(OUTS)".format(PROTOBUF_RUST_VERSION),
)
filegroup(
name = "srcs",
srcs = glob(["**/*"]),
srcs = [
":gen_cargo_toml",
] + glob(["src/**/*"]),
visibility = ["//rust:__subpackages__"],
)

@ -1,8 +1,8 @@
[package]
edition = "2021"
edition = "2021" # The Rust edition (not to be confused with Protobuf Edition).
name = "protobuf-codegen"
readme = "README.md"
version = "4.27.3-beta.0"
version = "{VERSION}"
description = "Code generator for Rust Protocol Buffers bindings"
license = "BSD-3-Clause"
rust-version = "1.74"
Loading…
Cancel
Save