Skip to content

Commit 91a2787

Browse files
authored
Moved @rules_rust//tools/runfiles to @rules_rust//rust/runfiles (#3294)
This is to conform to where other rules place their runfiles libraries. E.g. - [@rules_cc//cc/runfiles](https://github.com/bazelbuild/rules_cc/tree/283d572e0e1f4fe864f1f94db2c2cd27cb1dcc6e/cc/runfiles) - [@rules_java//java/runfiles](https://github.com/bazelbuild/rules_java/tree/3d757492427c10c73e48cbd0aa0623f12bfb769a/java/runfiles) - [@rules_python//python/runfiles](https://github.com/bazelbuild/rules_python/tree/fa882817a7a69ae1e6bc3a63530ce158b64d2efd/python/runfiles) - [@rules_shell//shell/runfiles](https://github.com/bazelbuild/rules_shell/tree/8120a5186fd67f6248245ba28f2f76c899a83c07/shell/runfiles)
1 parent 6244226 commit 91a2787

File tree

21 files changed

+64
-49
lines changed

21 files changed

+64
-49
lines changed

.bazelci/presubmit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ default_windows_no_runfiles_targets: &default_windows_no_runfiles_targets
7272
- "-//test/test_env:test_run"
7373
- "-//test/unit/pipelined_compilation/..."
7474
- "-//test/unit/rustdoc/..."
75-
- "-//tools/runfiles/..."
75+
- "-//rust/runfiles/..."
7676
# Runfiles used by the test only.
7777
- "-//test/empty_suite:deps_test"
7878
crate_universe_vendor_example_targets: &crate_universe_vendor_example_targets
@@ -293,7 +293,7 @@ tasks:
293293
- "--enable_bzlmod"
294294
build_targets:
295295
- "//crate_universe:cargo_bazel_bin"
296-
- "//tools/runfiles"
296+
- "//rust/runfiles"
297297
- "//util/import"
298298
ubuntu2004_clang:
299299
name: With Clang

crate_universe/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ rust_test(
110110
"RUSTC": "$(rootpath @rules_rust//rust/toolchain:current_rustc_files)",
111111
},
112112
deps = [
113-
"@rules_rust//tools/runfiles",
113+
"@rules_rust//rust/runfiles",
114114
] + all_crate_deps(
115115
normal_dev = True,
116116
),
@@ -138,7 +138,7 @@ rust_test(
138138
tags = ["requires-network"],
139139
deps = [
140140
":cargo_bazel",
141-
"@rules_rust//tools/runfiles",
141+
"@rules_rust//rust/runfiles",
142142
] + all_crate_deps(
143143
normal = True,
144144
),

examples/bindgen_toolchain/MODULE.bazel

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
module(name = "bindgen_toolchain_example")
22

33
bazel_dep(name = "rules_rust_bindgen")
4-
local_path_override(module_name = "rules_rust_bindgen", path = "../../extensions/bindgen")
4+
local_path_override(
5+
module_name = "rules_rust_bindgen",
6+
path = "../../extensions/bindgen",
7+
)
58

69
bazel_dep(name = "bazel_skylib", version = "1.7.1")
710
bazel_dep(name = "rules_cc", version = "0.0.17")
811
bazel_dep(name = "rules_rust")
9-
local_path_override(module_name = "rules_rust", path = "../..")
12+
local_path_override(
13+
module_name = "rules_rust",
14+
path = "../..",
15+
)
1016

1117
bazel_dep(name = "toolchains_llvm", version = "1.3.0")
18+
1219
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
1320
llvm.toolchain(llvm_version = "17.0.6")
1421
use_repo(llvm, "llvm_toolchain_llvm")

examples/sys/basic/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ rust_test(
3232
edition = "2021",
3333
rustc_env = {"HELLO_SYS_RLOCATIONPATH": "$(rlocationpath :hello_sys)"},
3434
deps = [
35-
"@rules_rust//tools/runfiles",
35+
"@rules_rust//rust/runfiles",
3636
],
3737
)

extensions/bindgen/MODULE.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ use_repo(
2424
"rules_rust_bindgen_deps__env_logger-0.10.2",
2525
)
2626

27-
register_toolchains("//:default_bindgen_toolchain", dev_dependency = True)
27+
register_toolchains(
28+
"//:default_bindgen_toolchain",
29+
dev_dependency = True,
30+
)
2831

2932
bazel_dep(name = "rules_testing", version = "0.7.0", dev_dependency = True)
3033
bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)

extensions/mdbook/private/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ rust_binary(
1515
edition = "2021",
1616
visibility = ["//visibility:public"],
1717
deps = [
18+
"@rules_rust//rust/runfiles",
1819
"@rules_rust//util/action_args",
19-
"@rules_rust//tools/runfiles",
2020
],
2121
)
2222

extensions/mdbook/test/generated_srcs/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ rust_test(
3131
data = [":generated_srcs"],
3232
edition = "2021",
3333
rustc_env = {"MDBOOK_OUTPUT_RLOCATIONPATH": "$(rlocationpath :generated_srcs)"},
34-
deps = ["@rules_rust//tools/runfiles"],
34+
deps = ["@rules_rust//rust/runfiles"],
3535
)

rust/private/rustdoc/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ rust_binary(
77
srcs = ["rustdoc_test_writer.rs"],
88
edition = "2018",
99
deps = [
10-
"//tools/runfiles",
10+
"//rust/runfiles",
1111
],
1212
)

rust/runfiles/BUILD.bazel

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
load(
2+
"//rust:defs.bzl",
3+
"rust_doc",
4+
"rust_library",
5+
"rust_test",
6+
)
7+
8+
rust_library(
9+
name = "runfiles",
10+
srcs = ["runfiles.rs"],
11+
edition = "2018",
12+
visibility = ["//visibility:public"],
13+
)
14+
15+
rust_test(
16+
name = "runfiles_test",
17+
crate = ":runfiles",
18+
data = ["data/sample.txt"],
19+
)
20+
21+
rust_doc(
22+
name = "runfiles_doc",
23+
crate = ":runfiles",
24+
)
File renamed without changes.

tools/runfiles/runfiles.rs renamed to rust/runfiles/runfiles.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! name = "my_binary",
99
//! ...
1010
//! data = ["//path/to/my/data.txt"],
11-
//! deps = ["@rules_rust//tools/runfiles"],
11+
//! deps = ["@rules_rust//rust/runfiles"],
1212
//! )
1313
//! ```
1414
//!
@@ -351,8 +351,8 @@ mod test {
351351
let r = Runfiles::create().unwrap();
352352

353353
let d = rlocation!(r, "rules_rust").unwrap();
354-
let f = rlocation!(r, "rules_rust/tools/runfiles/data/sample.txt").unwrap();
355-
assert_eq!(d.join("tools/runfiles/data/sample.txt"), f);
354+
let f = rlocation!(r, "rules_rust/rust/runfiles/data/sample.txt").unwrap();
355+
assert_eq!(d.join("rust/runfiles/data/sample.txt"), f);
356356

357357
let mut f = File::open(f).unwrap();
358358

@@ -373,8 +373,8 @@ mod test {
373373
env::remove_var(MANIFEST_FILE_ENV_VAR);
374374
let r = Runfiles::create().unwrap();
375375

376-
let mut f = File::open(rlocation!(r, "rules_rust/tools/runfiles/data/sample.txt").unwrap())
377-
.unwrap();
376+
let mut f =
377+
File::open(rlocation!(r, "rules_rust/rust/runfiles/data/sample.txt").unwrap()).unwrap();
378378

379379
let mut buffer = String::new();
380380
f.read_to_string(&mut buffer).unwrap();
@@ -399,8 +399,8 @@ mod test {
399399

400400
let r = Runfiles::create().unwrap();
401401

402-
let mut f = File::open(rlocation!(r, "rules_rust/tools/runfiles/data/sample.txt").unwrap())
403-
.unwrap();
402+
let mut f =
403+
File::open(rlocation!(r, "rules_rust/rust/runfiles/data/sample.txt").unwrap()).unwrap();
404404

405405
let mut buffer = String::new();
406406
f.read_to_string(&mut buffer).unwrap();

test/bzl_version/bzl_ext_version_test.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def bzl_ext_version_test(name, module_bazel, **kwargs):
2424
"MODULE_BAZEL": "$(rlocationpath {})".format(module_bazel),
2525
},
2626
deps = [
27-
Label("//tools/runfiles"),
27+
Label("//rust/runfiles"),
2828
],
2929
**kwargs
3030
)

test/bzl_version/bzl_version_test.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def bzl_version_test(name, module_bazel, **kwargs):
2424
"VERSION": VERSION,
2525
},
2626
deps = [
27-
Label("//tools/runfiles"),
27+
Label("//rust/runfiles"),
2828
],
2929
**kwargs
3030
)

test/bzlmod_repo_mapping/module_b/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ rust_library(
55
srcs = ["lib.rs"],
66
data = ["@aliased_c//:MODULE.bazel"],
77
visibility = ["//visibility:public"],
8-
deps = ["@rules_rust//tools/runfiles"],
8+
deps = ["@rules_rust//rust/runfiles"],
99
)

test/process_wrapper/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,5 @@ rust_test(
168168
"FAKE_RUSTC_RLOCATIONPATH": "$(rlocationpath :fake_rustc)",
169169
"PROCESS_WRAPPER_RLOCATIONPATH": "$(rlocationpath //util/process_wrapper)",
170170
},
171-
deps = ["//tools/runfiles"],
171+
deps = ["//rust/runfiles"],
172172
)

test/process_wrapper_bootstrap/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ rust_test(
66
srcs = ["bootstrap_process_wrapper_test.rs"],
77
data = ["//util/process_wrapper/private:process_wrapper.sh"],
88
edition = "2021",
9-
deps = ["//tools/runfiles"],
9+
deps = ["//rust/runfiles"],
1010
)
1111

1212
process_wrapper_bootstrap_test_suite(name = "process_wrapper_bootstrap_test_suite")

test/rust/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rust_library(
1111
],
1212
data = ["greeting.txt"],
1313
edition = "2018",
14-
deps = ["//tools/runfiles"],
14+
deps = ["//rust/runfiles"],
1515
)
1616

1717
rust_binary(

tools/runfiles/BUILD.bazel

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
1-
load(
2-
"//rust:defs.bzl",
3-
"rust_doc",
4-
"rust_library",
5-
"rust_test",
6-
)
7-
8-
rust_library(
1+
alias(
92
name = "runfiles",
10-
srcs = ["runfiles.rs"],
11-
edition = "2018",
3+
actual = "//rust/runfiles",
124
visibility = ["//visibility:public"],
135
)
14-
15-
rust_test(
16-
name = "runfiles_test",
17-
crate = ":runfiles",
18-
data = ["data/sample.txt"],
19-
)
20-
21-
rust_doc(
22-
name = "runfiles_doc",
23-
crate = ":runfiles",
24-
)

tools/rust_analyzer/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ rust_library(
3131
],
3232
edition = "2018",
3333
deps = [
34-
"//tools/runfiles",
34+
"//rust/runfiles",
3535
"//tools/rust_analyzer/3rdparty/crates:anyhow",
3636
"//tools/rust_analyzer/3rdparty/crates:log",
3737
"//tools/rust_analyzer/3rdparty/crates:serde",

tools/rustfmt/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ rust_library(
2828
"RUSTFMT_CONFIG": "$(rlocationpath //rust/settings:rustfmt.toml)",
2929
},
3030
deps = [
31-
"//tools/runfiles",
31+
"//rust/runfiles",
3232
],
3333
)
3434

@@ -72,7 +72,7 @@ rust_binary(
7272
visibility = ["//visibility:public"],
7373
deps = [
7474
":rustfmt_lib",
75-
"//tools/runfiles",
75+
"//rust/runfiles",
7676
],
7777
)
7878

tools/upstream_wrapper/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ all_tools = [target for target in tools.values()]
2626
toolchains = ["@rules_rust//rust/toolchain:current_rust_toolchain"],
2727
visibility = ["//visibility:public"],
2828
deps = [
29-
"//tools/runfiles",
29+
"//rust/runfiles",
3030
],
3131
)
3232
for (tool_name, target) in tools.items()

0 commit comments

Comments
 (0)