11load ("@bazel_skylib//:bzl_library.bzl" , "bzl_library" )
22load ("@cui//:defs.bzl" , "aliases" , "all_crate_deps" )
33load ("@rules_rust//rust:defs.bzl" , "rust_binary" , "rust_doc" , "rust_doc_test" , "rust_library" , "rust_test" )
4- load ("//crate_universe:version.bzl" , "VERSION" )
4+ load ("//cargo:defs.bzl" , "cargo_toml_env_vars" )
5+
6+ cargo_toml_env_vars (
7+ name = "cargo_toml_env_vars" ,
8+ src = "Cargo.toml" ,
9+ )
510
611exports_files (
712 glob ([
@@ -72,7 +77,7 @@ rust_library(
7277 # for more information). Set stamp = -1 to indicate that it should respect
7378 # the value of the --stamp commandline flag.
7479 stamp = - 1 ,
75- version = VERSION ,
80+ rustc_env_files = [ ":cargo_toml_env_vars" ] ,
7681 visibility = ["//visibility:public" ],
7782 deps = all_crate_deps (normal = True ),
7883)
@@ -81,7 +86,6 @@ rust_binary(
8186 name = "cargo_bazel_bin" ,
8287 srcs = ["src/main.rs" ],
8388 edition = "2021" ,
84- version = VERSION ,
8589 visibility = ["//visibility:public" ],
8690 deps = [":cargo_bazel" ],
8791)
@@ -156,6 +160,8 @@ rust_test(
156160 ),
157161)
158162
163+ # TODO(zbarsky): At this point version.bzl only exists to trigger `cargo_bazel_release` GH workflow.
164+ # Consider swapping that to the main repo's `version.bzl` and remove this.
159165rust_test (
160166 name = "versions_test" ,
161167 srcs = ["tests/version_test.rs" ],
0 commit comments