diff --git a/docs/cargo.md b/docs/cargo.md index d2e24b81b2..95fb78d6c3 100644 --- a/docs/cargo.md +++ b/docs/cargo.md @@ -32,8 +32,8 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c | env_label | A mapping of platform triple to a set of environment variables. This attribute differs from env in that all variables passed here must be fully qualified labels of files. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | | iso_date | The iso_date of cargo binary the resolver should use. Note: This can only be set if version is beta or nightly | String | optional | "" | | repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | +| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {channel} (eg. 'stable'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}" | +| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {channel} (eg. 'stable'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}" | | srcs | Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made | List of labels | optional | [] | | timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | 600 | | version | The version of cargo the resolver should use | String | optional | "1.65.0" | diff --git a/docs/crate_universe.md b/docs/crate_universe.md index 998bfaa94d..58daa21726 100644 --- a/docs/crate_universe.md +++ b/docs/crate_universe.md @@ -290,9 +290,9 @@ that is called behind the scenes to update dependencies. | quiet | If stdout and stderr should not be printed to the terminal. | Boolean | optional | True | | render_config | The configuration flags to use for rendering. Use //crate_universe:defs.bzl\%render_config to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" | | repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {cfg} (eg. 'exec'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {cfg} (eg. 'exec'), and {tool} (eg. 'cargo.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| rust_version | The version of Rust the currently registered toolchain is using. Eg. 1.56.0, or nightly-2021-09-08 | String | optional | "1.65.0" | +| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {cfg} (eg. 'exec'), {channel} (eg. 'stable'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}" | +| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {cfg} (eg. 'exec'), {channel} (eg. 'stable'), and {tool} (eg. 'cargo.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}" | +| rust_version | The version of Rust the currently registered toolchain is using. Eg. 1.56.0, or nightly/2021-09-08 | String | optional | "1.65.0" | | splicing_config | The configuration flags to use for splicing Cargo maniests. Use //crate_universe:defs.bzl\%rsplicing_config to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | "" | | supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | ["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-pc-windows-msvc", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "armv7-linux-androideabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd", "riscv32imc-unknown-none-elf"] | diff --git a/docs/flatten.md b/docs/flatten.md index 9a73478905..235655c3c5 100644 --- a/docs/flatten.md +++ b/docs/flatten.md @@ -98,8 +98,8 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c | env_label | A mapping of platform triple to a set of environment variables. This attribute differs from env in that all variables passed here must be fully qualified labels of files. See [cargo_env](#cargo_env) for usage details. Additionally, the platform triple * applies to all platforms. | Dictionary: String -> String | optional | {} | | iso_date | The iso_date of cargo binary the resolver should use. Note: This can only be set if version is beta or nightly | String | optional | "" | | repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | -| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" | +| rust_toolchain_cargo_template | The template to use for finding the host cargo binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {channel} (eg. 'stable'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}" | +| rust_toolchain_rustc_template | The template to use for finding the host rustc binary. {version} (eg. '1.53.0'), {triple} (eg. 'x86_64-unknown-linux-gnu'), {arch} (eg. 'aarch64'), {vendor} (eg. 'unknown'), {system} (eg. 'darwin'), {channel} (eg. 'stable'), and {tool} (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}" | | srcs | Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made | List of labels | optional | [] | | timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | 600 | | version | The version of cargo the resolver should use | String | optional | "1.65.0" | @@ -1216,7 +1216,7 @@ See @rules_rust//rust:repositories.bzl for examples of defining the @rust_cpuX r
 rust_toolchain_repository_proxy(name, exec_compatible_with, repo_mapping, target_compatible_with,
-                                toolchain, toolchain_type)
+                                target_settings, toolchain, toolchain_type)
 
Generates a toolchain-bearing repository that declares the toolchains from some other rust_toolchain_repository. @@ -1230,6 +1230,7 @@ Generates a toolchain-bearing repository that declares the toolchains from some | exec_compatible_with | A list of constraints for the execution platform for this toolchain. | List of strings | optional | [] | | repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | | target_compatible_with | A list of constraints for the target platform for this toolchain. | List of strings | optional | [] | +| target_settings | A list of config_settings that must be satisfied by the target configuration in order for this toolchain to be selected during toolchain resolution. | List of strings | optional | [] | | toolchain | The name of the toolchain implementation target. | String | required | | | toolchain_type | The toolchain type of the toolchain to declare | String | required | | @@ -1708,7 +1709,7 @@ This macro should be called immediately after the `rust_proto_repositories` macr
 rust_register_toolchains(dev_components, edition, include_rustc_srcs, allocator_library, iso_date,
                          register_toolchains, rustfmt_version, sha256s, extra_target_triples, urls,
-                         version)
+                         version, versions)
 
Emits a default set of toolchains for Linux, MacOS, and Freebsd @@ -1743,7 +1744,8 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai | sha256s | A dict associating tool subdirectories to sha256 hashes. | None | | extra_target_triples | Additional rust-style targets that rust toolchains should support. | ["wasm32-unknown-unknown", "wasm32-wasi"] | | urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | ["https://static.rust-lang.org/dist/{}.tar.gz"] | -| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | "1.65.0" | +| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | None | +| versions | A list of toolchain versions to download. This paramter only accepts one versions per channel. E.g. ["1.65.0", "nightly/2022-11-02", "beta/2020-12-30"]. | [] | @@ -1769,7 +1771,7 @@ rust_repositories(kwargs) ## rust_repository_set
-rust_repository_set(name, version, exec_triple, include_rustc_srcs, allocator_library,
+rust_repository_set(name, exec_triple, version, versions, include_rustc_srcs, allocator_library,
                     extra_target_triples, iso_date, rustfmt_version, edition, dev_components, sha256s,
                     urls, auth, register_toolchain)
 
@@ -1782,8 +1784,9 @@ Assembles a remote repository for the given toolchain params, produces a proxy r | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | The name of the generated repository | none | -| version | The version of the tool among "nightly", "beta', or an exact version. | none | | exec_triple | The Rust-style target that this compiler runs on | none | +| version | The version of the tool among "nightly", "beta', or an exact version. | None | +| versions | A list of toolchain versions to download. This paramter only accepts one versions per channel. E.g. ["1.65.0", "nightly/2022-11-02", "beta/2020-12-30"]. | [] | | include_rustc_srcs | **Deprecated** - instead see [rust_analyzer_toolchain_repository](#rust_analyzer_toolchain_repository). | False | | allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | | extra_target_triples | Additional rust-style targets that this set of toolchains should support. | [] | @@ -1867,15 +1870,12 @@ rust_test_suite(
 rust_toolchain_repository(name, version, exec_triple, target_triple, exec_compatible_with,
-                          target_compatible_with, include_rustc_srcs, allocator_library, iso_date,
-                          rustfmt_version, edition, dev_components, sha256s, urls, auth)
+                          target_compatible_with, channel, include_rustc_srcs, allocator_library,
+                          iso_date, rustfmt_version, edition, dev_components, sha256s, urls, auth)
 
Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains. -N.B. A "proxy repository" is needed to allow for registering the toolchain (with constraints) without actually downloading the toolchain. - - **PARAMETERS** @@ -1887,6 +1887,7 @@ N.B. A "proxy repository" is needed to allow for registering the toolchain (with | target_triple | The Rust-style target to build for. | none | | exec_compatible_with | A list of constraints for the execution platform for this toolchain. | None | | target_compatible_with | A list of constraints for the target platform for this toolchain. | None | +| channel | The channel of the Rust toolchain. | None | | include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. | False | | allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | | iso_date | The date of the tool. | None | diff --git a/docs/rust_repositories.md b/docs/rust_repositories.md index 2489022bc9..275a2d1319 100644 --- a/docs/rust_repositories.md +++ b/docs/rust_repositories.md @@ -123,7 +123,7 @@ See @rules_rust//rust:repositories.bzl for examples of defining the @rust_cpuX r
 rust_toolchain_repository_proxy(name, exec_compatible_with, repo_mapping, target_compatible_with,
-                                toolchain, toolchain_type)
+                                target_settings, toolchain, toolchain_type)
 
Generates a toolchain-bearing repository that declares the toolchains from some other rust_toolchain_repository. @@ -137,6 +137,7 @@ Generates a toolchain-bearing repository that declares the toolchains from some | exec_compatible_with | A list of constraints for the execution platform for this toolchain. | List of strings | optional | [] | | repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | | target_compatible_with | A list of constraints for the target platform for this toolchain. | List of strings | optional | [] | +| target_settings | A list of config_settings that must be satisfied by the target configuration in order for this toolchain to be selected during toolchain resolution. | List of strings | optional | [] | | toolchain | The name of the toolchain implementation target. | String | required | | | toolchain_type | The toolchain type of the toolchain to declare | String | required | | @@ -195,7 +196,7 @@ Dependencies used in the implementation of `rules_rust`.
 rust_register_toolchains(dev_components, edition, include_rustc_srcs, allocator_library, iso_date,
                          register_toolchains, rustfmt_version, sha256s, extra_target_triples, urls,
-                         version)
+                         version, versions)
 
Emits a default set of toolchains for Linux, MacOS, and Freebsd @@ -230,7 +231,8 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai | sha256s | A dict associating tool subdirectories to sha256 hashes. | None | | extra_target_triples | Additional rust-style targets that rust toolchains should support. | ["wasm32-unknown-unknown", "wasm32-wasi"] | | urls | A list of mirror urls containing the tools from the Rust-lang static file server. These must contain the '{}' used to substitute the tool being fetched (using .format). | ["https://static.rust-lang.org/dist/{}.tar.gz"] | -| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | "1.65.0" | +| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | None | +| versions | A list of toolchain versions to download. This paramter only accepts one versions per channel. E.g. ["1.65.0", "nightly/2022-11-02", "beta/2020-12-30"]. | [] | @@ -256,7 +258,7 @@ rust_repositories(kwargs) ## rust_repository_set
-rust_repository_set(name, version, exec_triple, include_rustc_srcs, allocator_library,
+rust_repository_set(name, exec_triple, version, versions, include_rustc_srcs, allocator_library,
                     extra_target_triples, iso_date, rustfmt_version, edition, dev_components, sha256s,
                     urls, auth, register_toolchain)
 
@@ -269,8 +271,9 @@ Assembles a remote repository for the given toolchain params, produces a proxy r | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | The name of the generated repository | none | -| version | The version of the tool among "nightly", "beta', or an exact version. | none | | exec_triple | The Rust-style target that this compiler runs on | none | +| version | The version of the tool among "nightly", "beta', or an exact version. | None | +| versions | A list of toolchain versions to download. This paramter only accepts one versions per channel. E.g. ["1.65.0", "nightly/2022-11-02", "beta/2020-12-30"]. | [] | | include_rustc_srcs | **Deprecated** - instead see [rust_analyzer_toolchain_repository](#rust_analyzer_toolchain_repository). | False | | allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | | extra_target_triples | Additional rust-style targets that this set of toolchains should support. | [] | @@ -290,15 +293,12 @@ Assembles a remote repository for the given toolchain params, produces a proxy r
 rust_toolchain_repository(name, version, exec_triple, target_triple, exec_compatible_with,
-                          target_compatible_with, include_rustc_srcs, allocator_library, iso_date,
-                          rustfmt_version, edition, dev_components, sha256s, urls, auth)
+                          target_compatible_with, channel, include_rustc_srcs, allocator_library,
+                          iso_date, rustfmt_version, edition, dev_components, sha256s, urls, auth)
 
Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains. -N.B. A "proxy repository" is needed to allow for registering the toolchain (with constraints) without actually downloading the toolchain. - - **PARAMETERS** @@ -310,6 +310,7 @@ N.B. A "proxy repository" is needed to allow for registering the toolchain (with | target_triple | The Rust-style target to build for. | none | | exec_compatible_with | A list of constraints for the execution platform for this toolchain. | None | | target_compatible_with | A list of constraints for the target platform for this toolchain. | None | +| channel | The channel of the Rust toolchain. | None | | include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. | False | | allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | None | | iso_date | The date of the tool. | None |