Skip to content

Added rules_rust prefix to transitive workspace names. #796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
default_linux_targets: &default_linux_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "..."
- "@examples//..."
- "@rules_rust_examples//..."
# TODO: Switch manual tag to platform constraint after bazel 4.0.
- "//test/versioned_dylib:versioned_dylib_test"
# Bindgen currently only has a working toolchain for 18.04
- "-@examples//ffi/rust_calling_c/simple/..."
- "-@rules_rust_examples//ffi/rust_calling_c/simple/..."
tasks:
ubuntu1804:
build_targets: *default_linux_targets
test_targets:
- "..."
- "@examples//..."
- "@rules_rust_examples//..."
# TODO: Switch manual tag to platform constraint after bazel 4.0.
- "//test/versioned_dylib:versioned_dylib_test"
build_flags:
Expand All @@ -28,9 +28,9 @@ tasks:
osx_targets: &osx_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "..."
- "@examples//..."
- "@rules_rust_examples//..."
# This test requires --incompatible_macos_set_install_name and Bazel 4.2.0+
- "-@examples//ffi/rust_calling_c:matrix_dylib_test"
- "-@rules_rust_examples//ffi/rust_calling_c:matrix_dylib_test"
build_targets: *osx_targets
test_targets: *osx_targets
build_flags:
Expand All @@ -40,15 +40,16 @@ tasks:
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "..."
- "//test/..."
- "@examples//..."
- "@rules_rust_examples//..."
- "-//test/conflicting_deps:conflicting_deps_test"
# rust_doc_test is likely not fully sandboxed
# https://github.com/bazelbuild/rules_rust/issues/804
- "-//test/chained_direct_deps:mod3_doc_test"
- "-@examples//fibonacci:fibonacci_doc_test"
- "-@examples//hello_lib:hello_lib_doc_test"
- "-@examples//ffi/rust_calling_c/simple/..."
- "-@rules_rust_examples//fibonacci:doc_test"
- "-@rules_rust_examples//hello_lib:doc_test"
- "-@rules_rust_examples//ffi/rust_calling_c/simple/..."
# See https://github.com/bazelbuild/bazel/issues/9987
- "-@examples//ffi/rust_calling_c:matrix_dylib_test"
- "-@rules_rust_examples//ffi/rust_calling_c:matrix_dylib_test"
build_flags:
- "--config=rustfmt"
windows:
Expand All @@ -64,13 +65,13 @@ tasks:
- "-//test/proto/..."
- "-//tools/rust_analyzer/..."
- "-//test/rustfmt/..."
- "@examples//..."
- "-@examples//ffi/rust_calling_c:matrix_dylib_test"
- "-@examples//ffi/rust_calling_c:matrix_dynamically_linked"
- "-@examples//ffi/rust_calling_c/simple/..."
- "-@examples//sys/..."
- "-@examples//proto/..."
- "-@examples//wasm/..."
- "@rules_rust_examples//..."
- "-@rules_rust_examples//ffi/rust_calling_c:matrix_dylib_test"
- "-@rules_rust_examples//ffi/rust_calling_c:matrix_dynamically_linked"
- "-@rules_rust_examples//ffi/rust_calling_c/simple/..."
- "-@rules_rust_examples//sys/..."
- "-@rules_rust_examples//proto/..."
- "-@rules_rust_examples//wasm/..."
build_targets: *windows_targets
test_targets: *windows_targets
examples:
Expand Down
26 changes: 13 additions & 13 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
workspace(name = "rules_rust")

load("@rules_rust//rust:repositories.bzl", "rust_repositories")
load("//rust:repositories.bzl", "rust_repositories")

rust_repositories(include_rustc_srcs = True)

load("@rules_rust//proto:repositories.bzl", "rust_proto_repositories")
load("//proto:repositories.bzl", "rust_proto_repositories")

rust_proto_repositories()

load("@rules_rust//bindgen:repositories.bzl", "rust_bindgen_repositories")
load("//bindgen:repositories.bzl", "rust_bindgen_repositories")

rust_bindgen_repositories()

load("@rules_rust//tools/rust_analyzer/raze:crates.bzl", "rules_rust_tools_rust_analyzer_fetch_remote_crates")
load("//tools/rust_analyzer/raze:crates.bzl", "rules_rust_tools_rust_analyzer_fetch_remote_crates")

rules_rust_tools_rust_analyzer_fetch_remote_crates()

load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories")
load("//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories")

rust_wasm_bindgen_repositories()

Expand Down Expand Up @@ -52,37 +52,37 @@ rbe_autoconfig(name = "buildkite_config")
# Load all dependencies for examples

local_repository(
name = "examples",
name = "rules_rust_examples",
path = "examples",
)

load("@examples//:examples_repositories.bzl", examples_repositories = "repositories")
load("@rules_rust_examples//:examples_repositories.bzl", examples_repositories = "repositories")

examples_repositories()

load("@examples//:examples_deps.bzl", examples_deps = "deps")
load("@rules_rust_examples//:examples_deps.bzl", examples_deps = "deps")

examples_deps()

load("@examples//:examples_transitive_deps.bzl", examples_transitive_deps = "transitive_deps")
load("@rules_rust_examples//:examples_transitive_deps.bzl", examples_transitive_deps = "transitive_deps")

examples_transitive_deps(is_top_level = True)

# Load all dependencies for docs

local_repository(
name = "docs",
name = "rules_rust_docs",
path = "docs",
)

load("@docs//:docs_repositories.bzl", docs_repositories = "repositories")
load("@rules_rust_docs//:docs_repositories.bzl", docs_repositories = "repositories")

docs_repositories()

load("@docs//:docs_deps.bzl", docs_deps = "deps")
load("@rules_rust_docs//:docs_deps.bzl", docs_deps = "deps")

docs_deps()

load("@docs//:docs_transitive_deps.bzl", docs_transitive_deps = "transitive_deps")
load("@rules_rust_docs//:docs_transitive_deps.bzl", docs_transitive_deps = "transitive_deps")

docs_transitive_deps(is_top_level = True)
2 changes: 1 addition & 1 deletion docs/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
workspace(name = "io_bazel_rules_rust_docs")
workspace(name = "rules_rust_docs")

load(":docs_repositories.bzl", "repositories")

Expand Down
4 changes: 2 additions & 2 deletions docs/rust_wasm_bindgen.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
To build a `rust_binary` for `wasm32-unknown-unknown` target add the `--platforms=@rules_rust//rust/platform:wasm` flag.

```command
bazel build @examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasm
bazel build @rules_rust_examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasm
```

To build a `rust_binary` for `wasm32-wasi` target add the `--platforms=@rules_rust//rust/platform:wasi` flag.

```command
bazel build @examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasi
bazel build @rules_rust_examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasi
```

`rust_wasm_bindgen` will automatically transition to the `wasm` platform and can be used when
Expand Down
4 changes: 2 additions & 2 deletions docs/rust_wasm_bindgen.vm
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
To build a `rust_binary` for `wasm32-unknown-unknown` target add the `--platforms=@rules_rust//rust/platform:wasm` flag.

```command
bazel build @examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasm
bazel build @rules_rust_examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasm
```

To build a `rust_binary` for `wasm32-wasi` target add the `--platforms=@rules_rust//rust/platform:wasi` flag.

```command
bazel build @examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasi
bazel build @rules_rust_examples//hello_world_wasm --platforms=@rules_rust//rust/platform:wasi
```

`rust_wasm_bindgen` will automatically transition to the `wasm` platform and can be used when
Expand Down
2 changes: 1 addition & 1 deletion examples/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
workspace(name = "examples")
workspace(name = "rules_rust_examples")

load(":examples_repositories.bzl", "repositories")

Expand Down
6 changes: 3 additions & 3 deletions examples/examples_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@examples//sys/basic/raze:crates.bzl", "rules_rust_examples_basic_sys_fetch_remote_crates")
load("@examples//sys/complex:repositories.bzl", "rules_rust_examples_complex_sys_repositories")
load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")
load("@rules_rust//bindgen:repositories.bzl", "rust_bindgen_repositories")
load("@rules_rust//proto:repositories.bzl", "rust_proto_repositories")
load("@rules_rust//rust:repositories.bzl", "rust_repositories", "rust_repository_set")
load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositories")
load("@rules_rust_examples//sys/basic/raze:crates.bzl", "rules_rust_examples_basic_sys_fetch_remote_crates")
load("@rules_rust_examples//sys/complex:repositories.bzl", "rules_rust_examples_complex_sys_repositories")

def deps():
"""Define dependencies for `rules_rust` examples"""
Expand Down Expand Up @@ -43,7 +43,7 @@ def deps():
maybe(
http_archive,
name = "libc",
build_file = "@examples//ffi:libc.BUILD",
build_file = "@rules_rust_examples//ffi:libc.BUILD",
sha256 = "1ac4c2ac6ed5a8fb9020c166bc63316205f1dc78d4b964ad31f4f21eb73f0c6d",
strip_prefix = "libc-0.2.20",
urls = [
Expand Down
2 changes: 1 addition & 1 deletion examples/fibonacci/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ rust_doc(
)

rust_doc_test(
name = "fibonacci_doc_test",
name = "doc_test",
crate = ":fibonacci",
)
2 changes: 1 addition & 1 deletion examples/hello_lib/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ rust_doc(
)

rust_doc_test(
name = "hello_lib_doc_test",
name = "doc_test",
crate = ":hello_lib",
)

Expand Down
2 changes: 1 addition & 1 deletion examples/hello_runfiles/hello_runfiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use runfiles::Runfiles;
fn main() {
let r = Runfiles::create().unwrap();

let mut f = File::open(r.rlocation("examples/hello_runfiles/hello_runfiles.rs")).unwrap();
let mut f = File::open(r.rlocation("rules_rust_examples/hello_runfiles/hello_runfiles.rs")).unwrap();

let mut buffer = String::new();
f.read_to_string(&mut buffer).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package(default_visibility = ["//visibility:public"])
rust_binary(
name = "hello_world",
srcs = ["src/main.rs"],
deps = ["@examples//hello_lib"],
deps = ["@rules_rust_examples//hello_lib"],
)

rust_doc(
Expand Down
4 changes: 2 additions & 2 deletions examples/proto/helloworld/helloworld_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl ServerInfo {
fn new() -> ServerInfo {
let r = Runfiles::create().unwrap();
let mut c =
Command::new(r.rlocation("examples/proto/helloworld/greeter_server/greeter_server"))
Command::new(r.rlocation("rules_rust_examples/proto/helloworld/greeter_server/greeter_server"))
.arg("0")
.stdout(Stdio::piped())
.spawn()
Expand Down Expand Up @@ -66,7 +66,7 @@ impl ServerInfo {
let r = Runfiles::create().unwrap();

let mut cmd0 =
Command::new(r.rlocation("examples/proto/helloworld/greeter_client/greeter_client"));
Command::new(r.rlocation("rules_rust_examples/proto/helloworld/greeter_client/greeter_client"));
let cmd = cmd0.arg(format!("-p={}", self.port));

let output = if let Some(s) = arg { cmd.arg(s) } else { cmd }
Expand Down
2 changes: 1 addition & 1 deletion examples/sys/complex/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ def rules_rust_examples_complex_sys_repositories():
strip_prefix = "openssl-OpenSSL_1_1_1d",
urls = ["https://github.com/openssl/openssl/archive/OpenSSL_1_1_1d.tar.gz"],
sha256 = "23011a5cc78e53d0dc98dfa608c51e72bcd350aa57df74c5d5574ba4ffb62e74",
build_file = "@examples//third_party/openssl:BUILD.openssl.bazel",
build_file = "@rules_rust_examples//third_party/openssl:BUILD.openssl.bazel",
)