diff --git a/rust/release_crates/protobuf_example/BUILD b/rust/release_crates/protobuf_example/BUILD index 6e4cd58951e1..7c0c33890368 100644 --- a/rust/release_crates/protobuf_example/BUILD +++ b/rust/release_crates/protobuf_example/BUILD @@ -1,5 +1,6 @@ load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +load("//:protobuf_version.bzl", "PROTOBUF_RUST_VERSION") pkg_tar( name = "protobuf_example_crate", @@ -16,8 +17,15 @@ pkg_files( strip_prefix = strip_prefix.from_root("rust/release_crates/protobuf_example"), ) +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(["**/*"]), visibility = ["//rust:__subpackages__"], ) diff --git a/rust/release_crates/protobuf_example/Cargo-template.toml b/rust/release_crates/protobuf_example/Cargo-template.toml new file mode 100644 index 000000000000..1ea0b0264a04 --- /dev/null +++ b/rust/release_crates/protobuf_example/Cargo-template.toml @@ -0,0 +1,10 @@ +[package] +name = "protobuf-example" +version = "{VERSION}" +edition = "2021" + +[dependencies] +protobuf = { version = "{VERSION}", path = "../protobuf" } + +[build-dependencies] +protobuf-codegen = { version = "{VERSION}", path = "../protobuf_codegen" } \ No newline at end of file diff --git a/rust/release_crates/protobuf_example/Cargo.toml b/rust/release_crates/protobuf_example/Cargo.toml deleted file mode 100644 index e95d55900dd5..000000000000 --- a/rust/release_crates/protobuf_example/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "protobuf-codegen-example" -version = "0.1.0" -edition = "2021" - -[dependencies] -protobuf = { path = "../protobuf" } - -[build-dependencies] -protobuf-codegen = { path = "../protobuf_codegen" } \ No newline at end of file