Skip to content

Commit

Permalink
Regenerate crate_universe examples and add target_overrides example
Browse files Browse the repository at this point in the history
  • Loading branch information
ograff committed Jun 3, 2024
1 parent e36baa5 commit 57fa7fa
Show file tree
Hide file tree
Showing 253 changed files with 6,488 additions and 3,516 deletions.
33 changes: 33 additions & 0 deletions examples/crate_universe/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,39 @@ load(

complicated_dependencies_crate_repositories()

###############################################################################
# O V E R R I D E T A R G E T
###############################################################################

crates_repository(
name = "override_target",
annotations = {
"foo": [crate.annotation(
override_targets = { "lib": "@//override_target:foo" }
)],
},
cargo_lockfile = "//override_target:Cargo.Bazel.lock",
# `generator` is not necessary in official releases.
# See load satement for `cargo_bazel_bootstrap`.
generator = "@cargo_bazel_bootstrap//:cargo-bazel",
lockfile = "//override_target:cargo-bazel-lock.json",
packages = {
"foo": crate.spec(
version = "0.0.0",
),
},
splicing_config = splicing_config(
resolver_version = "2",
),
)

load(
"@override_target//:defs.bzl",
override_target_crate_repositories = "crate_repositories",
)

override_target_crate_repositories()

###############################################################################

# Used for Bazel CI
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "81f62de6f649e0f4b4ba6bef3b10e732e395b45134f33b001ae0d5f8109e7494",
"checksum": "de5c29dc83494e5fbe539a321d37d9508b4f238da30d3d21d1704972a7f93a51",
"crates": {
"direct-cargo-bazel-deps 0.0.1": {
"name": "direct-cargo-bazel-deps",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "ed78b5a6ffbed80c354bfe097ab85aaef09b242fd0759fed09db2ffdbd6d3768",
"checksum": "0994e969d3634abca258808ae504e70d838f0b49f6bec314a0235cfe17175bdd",
"crates": {
"direct-cargo-bazel-deps 0.0.1": {
"name": "direct-cargo-bazel-deps",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "e358b727b6eaba65cda94827b0980ee467846ac1b0201c049bc92b7d5d19cdba",
"checksum": "d20475427f0affb980d87014b52aaed6b8816aeb60a26257f92f0d108ac9b15d",
"crates": {
"direct-cargo-bazel-deps 0.0.1": {
"name": "direct-cargo-bazel-deps",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "c8be56b12c4f1e37f413fd2e975f9d35f34d8465f2b1af1f4a661bd777c0aed5",
"checksum": "0a3f27bff8bcd3bcc842373e88391d02b7a978840738489e74b7fa6016712a77",
"crates": {
"direct-cargo-bazel-deps 0.0.1": {
"name": "direct-cargo-bazel-deps",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "dbfb871acaddb8d60e157a70b9b16dbf8ad1e78dd12536461ff4c94340fbdbc7",
"checksum": "5c1524803f121bb16662c4a806fb7f71ea115ec4aa5f9f959f30aec36efa1e75",
"crates": {
"direct-cargo-bazel-deps 0.0.1": {
"name": "direct-cargo-bazel-deps",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "c111189559c951979977616f3e3d76f0bacc782b9d8f5dce1a0b7290eb2756ee",
"checksum": "1f4707df0fbce4667d68b9c617b41fc35dd0dd0ca4dcb0a351c3f190b6fe590a",
"crates": {
"direct-cargo-bazel-deps 0.0.1": {
"name": "direct-cargo-bazel-deps",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "b2145b6622f242823810990c65a4624f4249f08fd8d9816c036fd85b12be9449",
"checksum": "a147ab0f0488b27610bda23751b829618dce4fbcf9eff31dfb1d40c90f12752d",
"crates": {
"direct-cargo-bazel-deps 0.0.1": {
"name": "direct-cargo-bazel-deps",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions examples/crate_universe/override_target/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

rust_library(
name = "override_targets_example",
srcs = glob(["src/*.rs"]),
edition = "2018",
deps = [
"@override_target//:foo",
],
)

rust_library(
name = "foo",
srcs = ["foo.rs"],
edition = "2018",
visibility = ["//visibility:public"],
)

rust_test(
name = "unit_test",
crate = ":override_targets_example",
edition = "2018",
)
16 changes: 16 additions & 0 deletions examples/crate_universe/override_target/Cargo.Bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

198 changes: 198 additions & 0 deletions examples/crate_universe/override_target/cargo-bazel-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/crate_universe/override_target/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub const THE_ANSWER: u32 = 42;
6 changes: 6 additions & 0 deletions examples/crate_universe/override_target/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mod test {
#[test]
pub fn test() {
assert_eq!(foo::THE_ANSWER, 42);
}
}
Loading

0 comments on commit 57fa7fa

Please sign in to comment.