diff --git a/docs/flatten.md b/docs/flatten.md index 4d3d531391..a31416cee7 100644 --- a/docs/flatten.md +++ b/docs/flatten.md @@ -13,6 +13,7 @@ * [extra_rustc_flags](#extra_rustc_flags) * [fail_when_enabled](#fail_when_enabled) * [incompatible_flag](#incompatible_flag) +* [rules_rust_depednencies](#rules_rust_depednencies) * [rust_analyzer](#rust_analyzer) * [rust_analyzer_aspect](#rust_analyzer_aspect) * [rust_binary](#rust_binary) @@ -31,6 +32,7 @@ * [rust_proto_repositories](#rust_proto_repositories) * [rust_proto_toolchain](#rust_proto_toolchain) * [rust_proto_transitive_repositories](#rust_proto_transitive_repositories) +* [rust_register_toolchains](#rust_register_toolchains) * [rust_repositories](#rust_repositories) * [rust_repository_set](#rust_repository_set) * [rust_shared_library](#rust_shared_library) @@ -1754,40 +1756,17 @@ This macro should be called immediately after the `rust_proto_repositories` macr ## rust_repositories
-rust_repositories(version, iso_date, rustfmt_version, edition, dev_components, sha256s,
-                  include_rustc_srcs, urls)
+rust_repositories(kwargs)
 
-Emits a default set of toolchains for Linux, MacOS, and Freebsd - -Skip this macro and call the `rust_repository_set` macros directly if you need a compiler for other hosts or for additional target triples. - -The `sha256` attribute represents a dict associating tool subdirectories to sha256 hashes. As an example: -```python -{ - "rust-1.46.0-x86_64-unknown-linux-gnu": "e3b98bc3440fe92817881933f9564389eccb396f5f431f33d48b979fa2fbdcf5", - "rustfmt-1.4.12-x86_64-unknown-linux-gnu": "1894e76913303d66bf40885a601462844eec15fca9e76a6d13c390d7000d64b0", - "rust-std-1.46.0-x86_64-unknown-linux-gnu": "ac04aef80423f612c0079829b504902de27a6997214eb58ab0765d02f7ec1dbc", -} -``` -This would match for `exec_triple = "x86_64-unknown-linux-gnu"`. If not specified, rules_rust pulls from a non-exhaustive list of known checksums.. - -See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more details. - +**Deprecated**: Use [rules_rust_dependencies](#rules_rust_dependencies) and [rust_register_toolchains](#rust_register_toolchains) directly. **PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | "1.58.1" | -| iso_date | The date of the nightly or beta release (ignored if the version is a specific version). | None | -| rustfmt_version | The version of rustfmt. Either "nightly", "beta", or an exact version. Defaults to version if not specified. | None | -| edition | The rust edition to be used by default (2015, 2018 (default), or 2021) | None | -| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | False | -| sha256s | A dict associating tool subdirectories to sha256 hashes. Defaults to None. | None | -| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. See [rust_toolchain_repository.include_rustc_srcs](#rust_toolchain_repository-include_rustc_srcs). for more details | False | -| 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). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz'] | ["https://static.rust-lang.org/dist/{}.tar.gz"] | +| kwargs | Keyword arguments for the rust_register_toolchains macro. | none | @@ -1796,7 +1775,7 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai
 rust_repository_set(name, version, exec_triple, include_rustc_srcs, extra_target_triples, iso_date,
-                    rustfmt_version, edition, dev_components, sha256s, urls, auth)
+                    rustfmt_version, edition, dev_components, sha256s, urls, auth, register_toolchain)
 
Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains. @@ -1821,6 +1800,7 @@ N.B. A "proxy repository" is needed to allow for registering the toolchain (with | sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | None | | 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). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz'] | ["https://static.rust-lang.org/dist/{}.tar.gz"] | | auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | None | +| register_toolchain | If True, the generated rust_toolchain target will become a registered toolchain. | True | diff --git a/docs/rust_repositories.md b/docs/rust_repositories.md index bee95d0489..d488ab68fa 100644 --- a/docs/rust_repositories.md +++ b/docs/rust_repositories.md @@ -1,12 +1,14 @@ # Rust Repositories +* [rules_rust_depednencies](#rules_rust_depednencies) +* [rust_register_toolchains](#rust_register_toolchains) * [rust_repositories](#rust_repositories) * [rust_repository_set](#rust_repository_set) -* [rust_toolchain](#rust_toolchain) -* [rust_toolchain_repository](#rust_toolchain_repository) -* [rust_toolchain_repository_proxy](#rust_toolchain_repository_proxy) * [rust_stdlib_filegroup](#rust_stdlib_filegroup) +* [rust_toolchain_repository_proxy](#rust_toolchain_repository_proxy) +* [rust_toolchain_repository](#rust_toolchain_repository) +* [rust_toolchain](#rust_toolchain) @@ -172,40 +174,17 @@ Generates a toolchain-bearing repository that declares the toolchains from some ## rust_repositories
-rust_repositories(version, iso_date, rustfmt_version, edition, dev_components, sha256s,
-                  include_rustc_srcs, urls)
+rust_repositories(kwargs)
 
-Emits a default set of toolchains for Linux, MacOS, and Freebsd - -Skip this macro and call the `rust_repository_set` macros directly if you need a compiler for other hosts or for additional target triples. - -The `sha256` attribute represents a dict associating tool subdirectories to sha256 hashes. As an example: -```python -{ - "rust-1.46.0-x86_64-unknown-linux-gnu": "e3b98bc3440fe92817881933f9564389eccb396f5f431f33d48b979fa2fbdcf5", - "rustfmt-1.4.12-x86_64-unknown-linux-gnu": "1894e76913303d66bf40885a601462844eec15fca9e76a6d13c390d7000d64b0", - "rust-std-1.46.0-x86_64-unknown-linux-gnu": "ac04aef80423f612c0079829b504902de27a6997214eb58ab0765d02f7ec1dbc", -} -``` -This would match for `exec_triple = "x86_64-unknown-linux-gnu"`. If not specified, rules_rust pulls from a non-exhaustive list of known checksums.. - -See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more details. - +**Deprecated**: Use [rules_rust_dependencies](#rules_rust_dependencies) and [rust_register_toolchains](#rust_register_toolchains) directly. **PARAMETERS** | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| version | The version of Rust. Either "nightly", "beta", or an exact version. Defaults to a modern version. | "1.58.1" | -| iso_date | The date of the nightly or beta release (ignored if the version is a specific version). | None | -| rustfmt_version | The version of rustfmt. Either "nightly", "beta", or an exact version. Defaults to version if not specified. | None | -| edition | The rust edition to be used by default (2015, 2018 (default), or 2021) | None | -| dev_components | Whether to download the rustc-dev components (defaults to False). Requires version to be "nightly". | False | -| sha256s | A dict associating tool subdirectories to sha256 hashes. Defaults to None. | None | -| include_rustc_srcs | Whether to download rustc's src code. This is required in order to use rust-analyzer support. See [rust_toolchain_repository.include_rustc_srcs](#rust_toolchain_repository-include_rustc_srcs). for more details | False | -| 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). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz'] | ["https://static.rust-lang.org/dist/{}.tar.gz"] | +| kwargs | Keyword arguments for the rust_register_toolchains macro. | none | @@ -214,7 +193,7 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai
 rust_repository_set(name, version, exec_triple, include_rustc_srcs, extra_target_triples, iso_date,
-                    rustfmt_version, edition, dev_components, sha256s, urls, auth)
+                    rustfmt_version, edition, dev_components, sha256s, urls, auth, register_toolchain)
 
Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains. @@ -239,5 +218,6 @@ N.B. A "proxy repository" is needed to allow for registering the toolchain (with | sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_repositories](#rust_repositories) for more details. | None | | 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). Defaults to ['https://static.rust-lang.org/dist/{}.tar.gz'] | ["https://static.rust-lang.org/dist/{}.tar.gz"] | | auth | Auth object compatible with repository_ctx.download to use when downloading files. See [repository_ctx.download](https://docs.bazel.build/versions/main/skylark/lib/repository_ctx.html#download) for more details. | None | +| register_toolchain | If True, the generated rust_toolchain target will become a registered toolchain. | True |