-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the very start of making rules_rust being able to load dependencies via bzlmod. Currently the aim is to replace `rules_rust_dependencies` only. There is one new module, `examples/bzlmod/hello_world`, that depends on the root `rules_rust` module. This can be built by: ``` cd examples/bzlmod/hello_world bazel build //:hello_world ``` There is currently some strange stuff going on with visibility because I get the following error: ``` While resolving toolchains for target //:hello_world: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '@rules_rust.override//rust': The repository '@rules_rust.override' could not be resolved: Repository '@rules_rust.override' is not visible from repository '@rules_rust.override' ``` A package is not visible to its self?
- Loading branch information
1 parent
51c0658
commit 1e4150e
Showing
6 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module( | ||
name = "rules_rust", | ||
version = "0.9.0", | ||
) | ||
|
||
bazel_dep(name = "platforms", version = "0.0.5") | ||
bazel_dep(name = "rules_cc", version = "0.0.1") | ||
bazel_dep(name = "bazel_skylib", version = "1.2.0") | ||
bazel_dep(name = "apple_support", version = "0.13.0") | ||
|
||
# TODO: Implement the equivalent of this: | ||
|
||
# # process_wrapper needs a low-dependency way to process json. | ||
# maybe( | ||
# http_archive, | ||
# name = "rules_rust_tinyjson", | ||
# sha256 = "1a8304da9f9370f6a6f9020b7903b044aa9ce3470f300a1fba5bc77c78145a16", | ||
# url = "https://crates.io/api/v1/crates/tinyjson/2.3.0/download", | ||
# strip_prefix = "tinyjson-2.3.0", | ||
# type = "tar.gz", | ||
# build_file = "@rules_rust//util/process_wrapper:BUILD.tinyjson.bazel", | ||
# ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build --experimental_enable_bzlmod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_doc") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
rust_binary( | ||
name = "hello_world", | ||
srcs = ["src/main.rs"], | ||
deps = ["@examples//hello_lib"], | ||
) | ||
|
||
rust_doc( | ||
name = "hello_world_doc", | ||
crate = ":hello_world", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module( | ||
name = "hello_world", | ||
version = "1.0", | ||
) | ||
|
||
bazel_dep(name = "rules_rust", version = "0.9.0") | ||
|
||
local_path_override(module_name = "rules_rust", path = "../../..") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2015 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
extern crate hello_lib; | ||
|
||
use hello_lib::greeter; | ||
|
||
fn main() { | ||
let hello = greeter::Greeter::new("Hello"); | ||
hello.greet("world"); | ||
} |