From b615771eff1d0ea39a7d86ed12e5ebe9a0d957b7 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Tue, 7 Jan 2025 08:29:45 -0800 Subject: [PATCH] Release 0.57.0 --- MODULE.bazel | 2 +- crate_universe/extensions.bzl | 4 ++-- docs/MODULE.bazel | 2 +- docs/src/index.md | 2 +- examples/all_deps_vendor/MODULE.bazel | 2 +- examples/all_deps_vendor/README.md | 2 +- examples/compile_opt/MODULE.bazel | 2 +- .../crate_universe_local_path/MODULE.bazel | 2 +- examples/cross_compile/MODULE.bazel | 2 +- examples/cross_compile/README.md | 20 +++++++++--------- examples/ffi/MODULE.bazel | 2 +- examples/ffi/README.md | 21 ++++++++----------- examples/proto/MODULE.bazel | 2 +- examples/proto_with_toolchain/MODULE.bazel | 4 ++-- examples/sys/MODULE.bazel | 2 +- extensions/bindgen/MODULE.bazel | 4 ++-- extensions/mdbook/MODULE.bazel | 4 ++-- extensions/prost/MODULE.bazel | 4 ++-- extensions/protobuf/MODULE.bazel | 4 ++-- extensions/wasm_bindgen/MODULE.bazel | 4 ++-- test/no_std/MODULE.bazel | 2 +- version.bzl | 2 +- 22 files changed, 46 insertions(+), 49 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 89125d7bed..2e27a6b8ca 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -2,7 +2,7 @@ module( name = "rules_rust", - version = "0.56.0", + version = "0.57.0", ) ############################################################################### diff --git a/crate_universe/extensions.bzl b/crate_universe/extensions.bzl index 656624afd1..ff2059d568 100644 --- a/crate_universe/extensions.bzl +++ b/crate_universe/extensions.bzl @@ -25,7 +25,7 @@ There are some examples of using crate_universe with bzlmod in the [example fold To use rules_rust in a project using bzlmod, add the following to your MODULE.bazel file: ```python -bazel_dep(name = "rules_rust", version = "0.49.3") +bazel_dep(name = "rules_rust", version = "0.57.0") ``` You find the latest version on the [release page](https://github.com/bazelbuild/rules_rust/releases). @@ -196,7 +196,7 @@ module( bazel_dep(name = "bazel_skylib", version = "1.7.1") # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.49.3") +bazel_dep(name = "rules_rust", version = "0.57.0") ############################################################################### # T O O L C H A I N S diff --git a/docs/MODULE.bazel b/docs/MODULE.bazel index 3a72a8bb45..5c51318f98 100644 --- a/docs/MODULE.bazel +++ b/docs/MODULE.bazel @@ -5,7 +5,7 @@ module( version = "0.0.0", ) -bazel_dep(name = "rules_rust", version = "0.55.6") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "..", diff --git a/docs/src/index.md b/docs/src/index.md index 84392b5a97..8d32a80c63 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -20,7 +20,7 @@ Note that rules_rust bzlmod support is still a work in progress. Most features s To use `rules_rust` in a project using bzlmod, add the following to your `MODULE.bazel` file: ```python -bazel_dep(name = "rules_rust", version = "0.48.0") +bazel_dep(name = "rules_rust", version = "0.57.0") ``` Don't forget to substitute in your desired release's version number. diff --git a/examples/all_deps_vendor/MODULE.bazel b/examples/all_deps_vendor/MODULE.bazel index 0a11e0a2c7..b490e4b886 100644 --- a/examples/all_deps_vendor/MODULE.bazel +++ b/examples/all_deps_vendor/MODULE.bazel @@ -10,7 +10,7 @@ module( bazel_dep(name = "bazel_skylib", version = "1.7.1") # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.46.0") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "../..", diff --git a/examples/all_deps_vendor/README.md b/examples/all_deps_vendor/README.md index 8cb40b6c70..f899daddc1 100644 --- a/examples/all_deps_vendor/README.md +++ b/examples/all_deps_vendor/README.md @@ -26,7 +26,7 @@ module( bazel_dep(name = "bazel_skylib", version = "1.7.1") # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.46.0") +bazel_dep(name = "rules_rust", version = "0.57.0") ############################################################################### # T O O L C H A I N S diff --git a/examples/compile_opt/MODULE.bazel b/examples/compile_opt/MODULE.bazel index c97a130771..7a9d443086 100644 --- a/examples/compile_opt/MODULE.bazel +++ b/examples/compile_opt/MODULE.bazel @@ -7,7 +7,7 @@ module( # B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/ ############################################################################### # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.56.0") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "../..", diff --git a/examples/crate_universe_local_path/MODULE.bazel b/examples/crate_universe_local_path/MODULE.bazel index 2aaa401a5e..a4abd6a1c6 100644 --- a/examples/crate_universe_local_path/MODULE.bazel +++ b/examples/crate_universe_local_path/MODULE.bazel @@ -1,4 +1,4 @@ -bazel_dep(name = "rules_rust", version = "0.54.1") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "../..", diff --git a/examples/cross_compile/MODULE.bazel b/examples/cross_compile/MODULE.bazel index 2f099f0af4..abbc319744 100644 --- a/examples/cross_compile/MODULE.bazel +++ b/examples/cross_compile/MODULE.bazel @@ -8,7 +8,7 @@ module( ############################################################################### # Get latest rules_rust release from: # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.52.0") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "../..", diff --git a/examples/cross_compile/README.md b/examples/cross_compile/README.md index 11db19d0b7..5d5d718571 100644 --- a/examples/cross_compile/README.md +++ b/examples/cross_compile/README.md @@ -11,7 +11,7 @@ The example code is setup to cross compile from the following hosts to the the f * {darwin, aarch64 (Apple Silicon)} -> {linux, x86_64} * {darwin, aarch64 (Apple Silicon)} -> {linux, aarch64} -Cross compilation from Linux to Apple may work, but has not been tested. +Cross compilation from Linux to Apple may work, but has not been tested. You cross-compile by calling the target. @@ -23,7 +23,7 @@ or You can also build all targets at once: - + `bazel build //...` @@ -43,7 +43,7 @@ You add the required rules for cross compilation to your MODULE.bazel as shown b ```Starlark # Get latest release from: # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.52.0") +bazel_dep(name = "rules_rust", version = "0.57.0") # https://github.com/bazelbuild/platforms/releases bazel_dep(name = "platforms", version = "0.0.10") @@ -57,8 +57,8 @@ http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "ht ## LLVM Configuration -Next, you have to configure the LLVM toolchain because rules_rust still needs a cpp toolchain for cross compilation and you have to add the specific platform triplets to the Rust toolchain. -Suppose you want to compile a Rust binary that supports linux on both, X86 and ARM. +Next, you have to configure the LLVM toolchain because rules_rust still needs a cpp toolchain for cross compilation and you have to add the specific platform triplets to the Rust toolchain. +Suppose you want to compile a Rust binary that supports linux on both, X86 and ARM. In that case, you have to configure three LLVM targets: 1) LLVM for the host @@ -88,14 +88,14 @@ http_archive( ``` Here, we declare to new http downloads that retrieve the sysroot for linux_x64 (Intel/AMD) and linux_aarch64 (ARM/Apple Silicon). The buildfile is a simple filegroup and located in the /build/sysroot directory. You have to copy it in your project directory to make the sysroots work. Note, these are only -sysroots, that means you have to configure LLVM next to use these files. +sysroots, that means you have to configure LLVM next to use these files. -If you need a custom sysroot, for example to cross compile system dependencies such as openssl, +If you need a custom sysroot, for example to cross compile system dependencies such as openssl, libpq (postgres client library) or similar, read through the excellent tutorial by Steven Casagrande: https://steven.casagrande.io/posts/2024/sysroot-generation-toolchains-llvm/ -As mentioned earlier, three LLVM targets need to be configured and to do just that, +As mentioned earlier, three LLVM targets need to be configured and to do just that, please add the following to your MODULE.bazel ```Starlark @@ -128,7 +128,7 @@ register_toolchains( For simplicity, all toolchains are pinned to LLVM version 16 because it is one of the few releases that supports many targets and runs on older linux distributions i.e. Ubuntu 18.04. If you target modern CPU's i.e. ARMv9 that require a more recent LLVM version, see the complete [list off all LLVM releases and supported platforms.](https://github.com/bazel-contrib/toolchains_llvm/blob/master/toolchain/internal/llvm_distributions.bzl) Also, it is possible to pin different targets to different LLVM versions; [see the documentation for details](https://github.com/bazel-contrib/toolchains_llvm/tree/master?tab=readme-ov-file#per-host-architecture-llvm-version). -If you face difficulties with building LLVM on older linux distros or your CI, +If you face difficulties with building LLVM on older linux distros or your CI, please take a look at the [LLVM Troubleshooting guide](README_LLVM_Troubleshooting) for known issues. @@ -138,7 +138,7 @@ The Rust toolchain only need to know the additional platform triplets to downloa or or modify your MODULE.bazel with the following entry: ```Starlark -RUST_EDITION = "2021" +RUST_EDITION = "2021" RUST_VERSION = "1.81.0" rust = use_extension("@rules_rust//rust:extensions.bzl", "rust") diff --git a/examples/ffi/MODULE.bazel b/examples/ffi/MODULE.bazel index d870323ce7..3e86b28e4b 100644 --- a/examples/ffi/MODULE.bazel +++ b/examples/ffi/MODULE.bazel @@ -7,7 +7,7 @@ module( # B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/ ############################################################################### # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.46.0") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "../..", diff --git a/examples/ffi/README.md b/examples/ffi/README.md index 7d125a4521..a25e5e1d83 100644 --- a/examples/ffi/README.md +++ b/examples/ffi/README.md @@ -1,13 +1,13 @@ # Rust FFI In case of an existing C++, Rust can call into the C++ function via FFI. -With Bazel, this is straightforward. However, your C++ API needs an extern "C" +With Bazel, this is straightforward. However, your C++ API needs an extern "C" declaration to generate the C compatibility required for FFI. ## Setup -The setup is twofold, the Rust rules are declared in the MODULE file, -but the rules_cc are not yet available in the Bazelmod format and thus are declared in +The setup is twofold, the Rust rules are declared in the MODULE file, +but the rules_cc are not yet available in the Bazelmod format and thus are declared in the WORKSPACE.bzlmod file. In your MODULE.bazel file, ensure to have the following entry: @@ -21,7 +21,7 @@ module( # B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/ ############################################################################### # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.46.0") +bazel_dep(name = "rules_rust", version = "0.57.0") ############################################################################### # T O O L C H A I N S @@ -73,8 +73,8 @@ cc_library( ) ``` -In some cases, you have to deal with non standard naming. In that case you define a -custom gen_rule to take of that and then define a cc_import. +In some cases, you have to deal with non standard naming. In that case you define a +custom gen_rule to take of that and then define a cc_import. ```starlark load("@rules_cc//cc:defs.bzl", "cc_import", "cc_library") @@ -94,10 +94,10 @@ cc_import( ) ``` -## Rust Callsite +## Rust Callsite On the Rust side, interestingly, you just declare the cc_import as a dependency of -your Rust target. +your Rust target. ```starlark load("@rules_rust//rust:defs.bzl", "rust_shared_library") @@ -111,7 +111,7 @@ rust_shared_library( ) ``` -Then in your Rust source file, your create a FFI binding and wrap the call to it into unsafe. You can do that because the Rust standard library provides all the c raw types for FFI so you just import them and unsafe informs the Rust borrow checker to hold off certain checks. The public Rust function f() can then be used in regular Rust code. +Then in your Rust source file, your create a FFI binding and wrap the call to it into unsafe. You can do that because the Rust standard library provides all the c raw types for FFI so you just import them and unsafe informs the Rust borrow checker to hold off certain checks. The public Rust function f() can then be used in regular Rust code. ```rust use std::os::raw::c_int; @@ -132,6 +132,3 @@ pub fn f() { And with that, you build your FFI target as usual: `bazel build //...` - - - diff --git a/examples/proto/MODULE.bazel b/examples/proto/MODULE.bazel index 36d4a582e6..42f1741be2 100644 --- a/examples/proto/MODULE.bazel +++ b/examples/proto/MODULE.bazel @@ -7,7 +7,7 @@ module( # B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/ ############################################################################### # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.54.1") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "../..", diff --git a/examples/proto_with_toolchain/MODULE.bazel b/examples/proto_with_toolchain/MODULE.bazel index ad6f84974b..b58cc5a509 100644 --- a/examples/proto_with_toolchain/MODULE.bazel +++ b/examples/proto_with_toolchain/MODULE.bazel @@ -7,13 +7,13 @@ module( # B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/ ############################################################################### # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.54.1") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "../..", ) -bazel_dep(name = "rules_rust_prost", version = "0.54.1") +bazel_dep(name = "rules_rust_prost", version = "0.0.0") local_path_override( module_name = "rules_rust_prost", path = "../../extensions/prost", diff --git a/examples/sys/MODULE.bazel b/examples/sys/MODULE.bazel index 0e8e5d1061..6088766250 100644 --- a/examples/sys/MODULE.bazel +++ b/examples/sys/MODULE.bazel @@ -7,7 +7,7 @@ module( # B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/ ############################################################################### # https://github.com/bazelbuild/rules_rust/releases -bazel_dep(name = "rules_rust", version = "0.46.0") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "../..", diff --git a/extensions/bindgen/MODULE.bazel b/extensions/bindgen/MODULE.bazel index d39dbf37e8..09fd44515b 100644 --- a/extensions/bindgen/MODULE.bazel +++ b/extensions/bindgen/MODULE.bazel @@ -2,12 +2,12 @@ module( name = "rules_rust_bindgen", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "rules_rust", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "bazel_skylib", diff --git a/extensions/mdbook/MODULE.bazel b/extensions/mdbook/MODULE.bazel index 25fa27cab9..2ccceec085 100644 --- a/extensions/mdbook/MODULE.bazel +++ b/extensions/mdbook/MODULE.bazel @@ -2,12 +2,12 @@ module( name = "rules_rust_mdbook", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "rules_rust", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "rules_cc", diff --git a/extensions/prost/MODULE.bazel b/extensions/prost/MODULE.bazel index 8f2746a4f9..4181192698 100644 --- a/extensions/prost/MODULE.bazel +++ b/extensions/prost/MODULE.bazel @@ -2,12 +2,12 @@ module( name = "rules_rust_prost", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "rules_rust", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "platforms", diff --git a/extensions/protobuf/MODULE.bazel b/extensions/protobuf/MODULE.bazel index 7442229339..4734e6fcfc 100644 --- a/extensions/protobuf/MODULE.bazel +++ b/extensions/protobuf/MODULE.bazel @@ -2,12 +2,12 @@ module( name = "rules_rust_protobuf", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "rules_rust", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "bazel_skylib", diff --git a/extensions/wasm_bindgen/MODULE.bazel b/extensions/wasm_bindgen/MODULE.bazel index eba0d18432..1f10a6ad0c 100644 --- a/extensions/wasm_bindgen/MODULE.bazel +++ b/extensions/wasm_bindgen/MODULE.bazel @@ -2,12 +2,12 @@ module( name = "rules_rust_wasm_bindgen", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "rules_rust", - version = "0.56.0", + version = "0.57.0", ) bazel_dep( name = "bazel_skylib", diff --git a/test/no_std/MODULE.bazel b/test/no_std/MODULE.bazel index 430e6f3755..549be636a5 100644 --- a/test/no_std/MODULE.bazel +++ b/test/no_std/MODULE.bazel @@ -3,7 +3,7 @@ module( version = "0.0.0", ) -bazel_dep(name = "rules_rust", version = "0.55.6") +bazel_dep(name = "rules_rust", version = "0.0.0") local_path_override( module_name = "rules_rust", path = "../..", diff --git a/version.bzl b/version.bzl index d9ff212cab..3000969f79 100644 --- a/version.bzl +++ b/version.bzl @@ -1,3 +1,3 @@ """The version of rules_rust.""" -VERSION = "0.56.0" +VERSION = "0.57.0"