From 67ee6f9c0ea68c71fd947818792cecf5a1a9ed5c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 3 Dec 2021 20:35:52 +1000 Subject: [PATCH] update to Rust 1.57 + latest rules_rust --- .bazelrc | 2 +- cargo/BUILD.reqwest.native.bazel | 3 +-- cargo/BUILD.reqwest.rustls.bazel | 3 +-- cargo/BUILD.term-0.7.0.bazel | 3 +-- cargo/remote/BUILD.term-0.7.0.bazel | 3 +-- pylib/rsbridge/BUILD.bazel | 5 ++--- repos.bzl | 7 +++---- rslib/BUILD.bazel | 2 +- rslib/i18n/BUILD.bazel | 2 +- rslib/i18n_helpers/BUILD.bazel | 2 +- 10 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.bazelrc b/.bazelrc index c5803c7c5..c6ad39d10 100644 --- a/.bazelrc +++ b/.bazelrc @@ -17,7 +17,7 @@ build:windows --build_python_zip=false build --workspace_status_command='bash ./scripts/status.sh' # run clippy when compiling rust in test mode -test --aspects=@rules_rust//rust:rust.bzl%rust_clippy_aspect --output_groups=+clippy_checks +test --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect --output_groups=+clippy_checks # print output when test fails test --test_output=errors diff --git a/cargo/BUILD.reqwest.native.bazel b/cargo/BUILD.reqwest.native.bazel index d39849fa6..06d11976b 100644 --- a/cargo/BUILD.reqwest.native.bazel +++ b/cargo/BUILD.reqwest.native.bazel @@ -10,7 +10,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects") # buildifier: disable=load load( - "@rules_rust//rust:rust.bzl", + "@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test", @@ -64,7 +64,6 @@ rust_library( "tokio-socks", ], crate_root = "src/lib.rs", - crate_type = "lib", data = [], edition = "2018", rustc_flags = [ diff --git a/cargo/BUILD.reqwest.rustls.bazel b/cargo/BUILD.reqwest.rustls.bazel index 79f24ee25..d126456b1 100644 --- a/cargo/BUILD.reqwest.rustls.bazel +++ b/cargo/BUILD.reqwest.rustls.bazel @@ -10,7 +10,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects") # buildifier: disable=load load( - "@rules_rust//rust:rust.bzl", + "@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test", @@ -67,7 +67,6 @@ rust_library( "webpki-roots", ], crate_root = "src/lib.rs", - crate_type = "lib", data = [], edition = "2018", rustc_flags = [ diff --git a/cargo/BUILD.term-0.7.0.bazel b/cargo/BUILD.term-0.7.0.bazel index 0546d30d5..33ea1a39f 100644 --- a/cargo/BUILD.term-0.7.0.bazel +++ b/cargo/BUILD.term-0.7.0.bazel @@ -10,7 +10,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects") # buildifier: disable=load load( - "@rules_rust//rust:rust.bzl", + "@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test", @@ -39,7 +39,6 @@ rust_library( "default", ], crate_root = "src/lib.rs", - crate_type = "lib", data = [], edition = "2018", rustc_flags = [ diff --git a/cargo/remote/BUILD.term-0.7.0.bazel b/cargo/remote/BUILD.term-0.7.0.bazel index 0546d30d5..33ea1a39f 100644 --- a/cargo/remote/BUILD.term-0.7.0.bazel +++ b/cargo/remote/BUILD.term-0.7.0.bazel @@ -10,7 +10,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects") # buildifier: disable=load load( - "@rules_rust//rust:rust.bzl", + "@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test", @@ -39,7 +39,6 @@ rust_library( "default", ], crate_root = "src/lib.rs", - crate_type = "lib", data = [], edition = "2018", rustc_flags = [ diff --git a/pylib/rsbridge/BUILD.bazel b/pylib/rsbridge/BUILD.bazel index a1c1019c0..6c2b6856b 100644 --- a/pylib/rsbridge/BUILD.bazel +++ b/pylib/rsbridge/BUILD.bazel @@ -1,4 +1,4 @@ -load("@rules_rust//rust:rust.bzl", "rust_library", "rust_test") +load("@rules_rust//rust:defs.bzl", "rust_shared_library") load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script") load("@bazel_skylib//lib:selects.bzl", "selects") load("//rslib:rustfmt.bzl", "rustfmt_fix", "rustfmt_test") @@ -14,10 +14,9 @@ cargo_build_script( ], ) -rust_library( +rust_shared_library( name = "rsbridge", srcs = ["lib.rs"], - crate_type = "cdylib", rustc_flags = selects.with_or({ ( "@rules_rust//rust/platform:x86_64-apple-darwin", diff --git a/repos.bzl b/repos.bzl index ff4ff1f82..ba677fb40 100644 --- a/repos.bzl +++ b/repos.bzl @@ -30,15 +30,14 @@ def register_repos(): # path = "../rules_rust", # ) - # pending merge of https://github.com/bazelbuild/rules_rust/pull/955 maybe( http_archive, name = "rules_rust", - strip_prefix = "rules_rust-anki-2021-11-19", + strip_prefix = "rules_rust-anki-2021-12-03", urls = [ - "https://github.com/ankitects/rules_rust/archive/anki-2021-11-19.tar.gz", + "https://github.com/ankitects/rules_rust/archive/refs/tags/anki-2021-12-03.zip", ], - sha256 = "c0fb4ce7c616a19b73967ea763cdc0481287d56482115ca67c7a52b883f1b408", + sha256 = "203d8dd78a541456dadefb2a5b51def96473a69af21b3a80f97d0946eca4fd0f", ) # python diff --git a/rslib/BUILD.bazel b/rslib/BUILD.bazel index e194e7127..af19eba31 100644 --- a/rslib/BUILD.bazel +++ b/rslib/BUILD.bazel @@ -1,7 +1,7 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -load("@rules_rust//rust:rust.bzl", "rust_binary", "rust_library", "rust_test") +load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test") load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script") load(":rustfmt.bzl", "rustfmt_fix", "rustfmt_test") load("//ts/sql_format:defs.bzl", "sql_format") diff --git a/rslib/i18n/BUILD.bazel b/rslib/i18n/BUILD.bazel index 462264efd..9c12459e5 100644 --- a/rslib/i18n/BUILD.bazel +++ b/rslib/i18n/BUILD.bazel @@ -1,7 +1,7 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -load("@rules_rust//rust:rust.bzl", "rust_binary", "rust_library", "rust_test") +load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test") load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script") load("//rslib:rustfmt.bzl", "rustfmt_fix", "rustfmt_test") diff --git a/rslib/i18n_helpers/BUILD.bazel b/rslib/i18n_helpers/BUILD.bazel index a55b25d93..5e404a4d1 100644 --- a/rslib/i18n_helpers/BUILD.bazel +++ b/rslib/i18n_helpers/BUILD.bazel @@ -1,7 +1,7 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -load("@rules_rust//rust:rust.bzl", "rust_binary", "rust_library", "rust_test") +load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test") load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script") load("//rslib:rustfmt.bzl", "rustfmt_fix", "rustfmt_test")