Skip to content

Commit d1d04eb

Browse files
authored
Moved related cargo_manifest_dir examples into the same directory (bazelbuild#473)
Minor reorganization of the examples to try and keep the relevant tests and dependencies together.
1 parent 6766c24 commit d1d04eb

File tree

9 files changed

+13
-11
lines changed

9 files changed

+13
-11
lines changed

.bazelignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
docs
22
examples
3-
examples/hello_cargo_manifest_dir
3+
examples/cargo_manifest_dir/external_crate

examples/.bazelignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
hello_cargo_manifest_dir
1+
cargo_manifest_dir/external_crate

examples/hello_cargo_manifest_dir/BUILD renamed to examples/cargo_manifest_dir/external_crate/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library")
22

33
rust_library(
4-
name = "hello_cargo_manifest_dir",
4+
name = "external_crate",
55
srcs = ["src/lib.rs"],
66
data = ["include/included_file.rs.inc"],
77
visibility = ["//visibility:public"],

examples/hello_cargo_manifest_dir/WORKSPACE renamed to examples/cargo_manifest_dir/external_crate/WORKSPACE.bazel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
workspace(name = "rules_rust_example_cargo_manifest_dir")
2+
13
local_repository(
24
name = "io_bazel_rules_rust",
3-
path = "../..",
5+
path = "../../../",
46
)
57

68
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_test")
22

33
rust_test(
4-
name = "hello_uses_cargo_manifest_dir",
4+
name = "cargo_manifest_dir_usage",
55
srcs = ["src/lib.rs"],
66
edition = "2018",
7-
deps = ["@hello_cargo_manifest_dir"],
7+
deps = ["@rules_rust_example_cargo_manifest_dir//:external_crate"],
88
)

examples/hello_uses_cargo_manifest_dir/src/lib.rs renamed to examples/cargo_manifest_dir/usage/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
use hello_cargo_manifest_dir::get_included_str;
2+
use external_crate::get_included_str;
33

44
#[test]
55
fn test_lib_with_include() {

examples/examples_transitive_deps.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ def transitive_deps(is_top_level = False):
2727
if is_top_level:
2828
maybe(
2929
native.local_repository,
30-
name = "hello_cargo_manifest_dir",
31-
path = "examples/hello_cargo_manifest_dir",
30+
name = "rules_rust_example_cargo_manifest_dir",
31+
path = "examples/cargo_manifest_dir/external_crate",
3232
)
3333
else:
3434
maybe(
3535
native.local_repository,
36-
name = "hello_cargo_manifest_dir",
37-
path = "hello_cargo_manifest_dir",
36+
name = "rules_rust_example_cargo_manifest_dir",
37+
path = "cargo_manifest_dir/external_crate",
3838
)

0 commit comments

Comments
 (0)