2024-12-20 10:25:28 -08:00
|
|
|
"""A rule to textually replace {{VERSION}} with the Rust release version in files."""
|
|
|
|
|
|
2026-08-12 15:10:45 -07:00
|
|
|
load("//:protobuf_version.bzl", "PROTOBUF_LEGACY_RUST_VERSION", "PROTOBUF_RUST_VERSION")
|
2024-12-20 10:25:28 -08:00
|
|
|
|
|
|
|
|
def substitute_rust_release_version(src, out, name = None):
|
|
|
|
|
native.genrule(
|
|
|
|
|
name = name or ("gen_%s" % out),
|
|
|
|
|
srcs = [src],
|
|
|
|
|
outs = [out],
|
2026-08-12 15:10:45 -07:00
|
|
|
cmd = "cat $(SRCS) | sed -e 's/{{PROTOBUF_RUST_VERSION}}/{0}/g' -e 's/{{PROTOBUF_LEGACY_VERSION}}/{1}/g' > $(OUTS)".format(PROTOBUF_RUST_VERSION, PROTOBUF_LEGACY_RUST_VERSION),
|
2024-12-20 10:25:28 -08:00
|
|
|
)
|