Remove deprecated variables from `repositories.bzl` macros (#2795)
Most notably in places where `version` and `iso_date` were used, the
`versions` parameter should be used instead. There have long since
prints guiding folks to use `versions` over the previous two.
diff --git a/docs/flatten.md b/docs/flatten.md
index 3e929a1..cfab41c 100644
--- a/docs/flatten.md
+++ b/docs/flatten.md
@@ -1628,7 +1628,7 @@
<pre>
rust_analyzer_toolchain_repository(<a href="#rust_analyzer_toolchain_repository-name">name</a>, <a href="#rust_analyzer_toolchain_repository-version">version</a>, <a href="#rust_analyzer_toolchain_repository-exec_compatible_with">exec_compatible_with</a>, <a href="#rust_analyzer_toolchain_repository-target_compatible_with">target_compatible_with</a>,
- <a href="#rust_analyzer_toolchain_repository-iso_date">iso_date</a>, <a href="#rust_analyzer_toolchain_repository-sha256s">sha256s</a>, <a href="#rust_analyzer_toolchain_repository-urls">urls</a>, <a href="#rust_analyzer_toolchain_repository-auth">auth</a>, <a href="#rust_analyzer_toolchain_repository-netrc">netrc</a>, <a href="#rust_analyzer_toolchain_repository-auth_patterns">auth_patterns</a>)
+ <a href="#rust_analyzer_toolchain_repository-sha256s">sha256s</a>, <a href="#rust_analyzer_toolchain_repository-urls">urls</a>, <a href="#rust_analyzer_toolchain_repository-auth">auth</a>, <a href="#rust_analyzer_toolchain_repository-netrc">netrc</a>, <a href="#rust_analyzer_toolchain_repository-auth_patterns">auth_patterns</a>)
</pre>
Assemble a remote rust_analyzer_toolchain target based on the given params.
@@ -1642,7 +1642,6 @@
| <a id="rust_analyzer_toolchain_repository-version"></a>version | The version of the tool among "nightly", "beta', or an exact version. | none |
| <a id="rust_analyzer_toolchain_repository-exec_compatible_with"></a>exec_compatible_with | A list of constraints for the execution platform for this toolchain. | `[]` |
| <a id="rust_analyzer_toolchain_repository-target_compatible_with"></a>target_compatible_with | A list of constraints for the target platform for this toolchain. | `[]` |
-| <a id="rust_analyzer_toolchain_repository-iso_date"></a>iso_date | The date of the tool. | `None` |
| <a id="rust_analyzer_toolchain_repository-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_register_toolchains](#rust_register_toolchains) for more details. | `None` |
| <a id="rust_analyzer_toolchain_repository-urls"></a>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.xz'] | `None` |
| <a id="rust_analyzer_toolchain_repository-auth"></a>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` |
@@ -1837,9 +1836,9 @@
<pre>
rust_register_toolchains(<a href="#rust_register_toolchains-dev_components">dev_components</a>, <a href="#rust_register_toolchains-edition">edition</a>, <a href="#rust_register_toolchains-allocator_library">allocator_library</a>, <a href="#rust_register_toolchains-global_allocator_library">global_allocator_library</a>,
- <a href="#rust_register_toolchains-iso_date">iso_date</a>, <a href="#rust_register_toolchains-register_toolchains">register_toolchains</a>, <a href="#rust_register_toolchains-rustfmt_version">rustfmt_version</a>, <a href="#rust_register_toolchains-rust_analyzer_version">rust_analyzer_version</a>,
- <a href="#rust_register_toolchains-sha256s">sha256s</a>, <a href="#rust_register_toolchains-extra_target_triples">extra_target_triples</a>, <a href="#rust_register_toolchains-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_register_toolchains-extra_exec_rustc_flags">extra_exec_rustc_flags</a>,
- <a href="#rust_register_toolchains-urls">urls</a>, <a href="#rust_register_toolchains-version">version</a>, <a href="#rust_register_toolchains-versions">versions</a>)
+ <a href="#rust_register_toolchains-register_toolchains">register_toolchains</a>, <a href="#rust_register_toolchains-rustfmt_version">rustfmt_version</a>, <a href="#rust_register_toolchains-rust_analyzer_version">rust_analyzer_version</a>, <a href="#rust_register_toolchains-sha256s">sha256s</a>,
+ <a href="#rust_register_toolchains-extra_target_triples">extra_target_triples</a>, <a href="#rust_register_toolchains-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_register_toolchains-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_register_toolchains-urls">urls</a>,
+ <a href="#rust_register_toolchains-versions">versions</a>)
</pre>
Emits a default set of toolchains for Linux, MacOS, and Freebsd
@@ -1868,7 +1867,6 @@
| <a id="rust_register_toolchains-edition"></a>edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every target is required to specify its `edition` attribute. | `None` |
| <a id="rust_register_toolchains-allocator_library"></a>allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` |
| <a id="rust_register_toolchains-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions when global allocator is used with cc_common.link. | `None` |
-| <a id="rust_register_toolchains-iso_date"></a>iso_date | **Deprecated**: Use `versions` instead. | `None` |
| <a id="rust_register_toolchains-register_toolchains"></a>register_toolchains | If true, repositories will be generated to produce and register `rust_toolchain` targets. | `True` |
| <a id="rust_register_toolchains-rustfmt_version"></a>rustfmt_version | The version of rustfmt. If none is supplied and only a single version in `versions` is given, then this defaults to that version, otherwise will default to the default nightly version. | `None` |
| <a id="rust_register_toolchains-rust_analyzer_version"></a>rust_analyzer_version | The version of Rustc to pair with rust-analyzer. | `None` |
@@ -1877,8 +1875,7 @@
| <a id="rust_register_toolchains-extra_rustc_flags"></a>extra_rustc_flags | Dictionary of target triples to list of extra flags to pass to rustc in non-exec configuration. | `None` |
| <a id="rust_register_toolchains-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration. | `None` |
| <a id="rust_register_toolchains-urls"></a>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.xz"]` |
-| <a id="rust_register_toolchains-version"></a>version | **Deprecated**: Use `versions` instead. | `None` |
-| <a id="rust_register_toolchains-versions"></a>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"]`. | `[]` |
+| <a id="rust_register_toolchains-versions"></a>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"]`. | `["1.80.0", "nightly/2024-07-25"]` |
<a id="rust_repositories"></a>
@@ -1904,11 +1901,11 @@
## rust_repository_set
<pre>
-rust_repository_set(<a href="#rust_repository_set-name">name</a>, <a href="#rust_repository_set-exec_triple">exec_triple</a>, <a href="#rust_repository_set-target_settings">target_settings</a>, <a href="#rust_repository_set-version">version</a>, <a href="#rust_repository_set-versions">versions</a>, <a href="#rust_repository_set-allocator_library">allocator_library</a>,
- <a href="#rust_repository_set-global_allocator_library">global_allocator_library</a>, <a href="#rust_repository_set-extra_target_triples">extra_target_triples</a>, <a href="#rust_repository_set-iso_date">iso_date</a>, <a href="#rust_repository_set-rustfmt_version">rustfmt_version</a>,
- <a href="#rust_repository_set-edition">edition</a>, <a href="#rust_repository_set-dev_components">dev_components</a>, <a href="#rust_repository_set-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_repository_set-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_repository_set-opt_level">opt_level</a>,
- <a href="#rust_repository_set-sha256s">sha256s</a>, <a href="#rust_repository_set-urls">urls</a>, <a href="#rust_repository_set-auth">auth</a>, <a href="#rust_repository_set-netrc">netrc</a>, <a href="#rust_repository_set-auth_patterns">auth_patterns</a>, <a href="#rust_repository_set-register_toolchain">register_toolchain</a>,
- <a href="#rust_repository_set-exec_compatible_with">exec_compatible_with</a>, <a href="#rust_repository_set-default_target_compatible_with">default_target_compatible_with</a>)
+rust_repository_set(<a href="#rust_repository_set-name">name</a>, <a href="#rust_repository_set-versions">versions</a>, <a href="#rust_repository_set-exec_triple">exec_triple</a>, <a href="#rust_repository_set-target_settings">target_settings</a>, <a href="#rust_repository_set-allocator_library">allocator_library</a>,
+ <a href="#rust_repository_set-global_allocator_library">global_allocator_library</a>, <a href="#rust_repository_set-extra_target_triples">extra_target_triples</a>, <a href="#rust_repository_set-rustfmt_version">rustfmt_version</a>, <a href="#rust_repository_set-edition">edition</a>,
+ <a href="#rust_repository_set-dev_components">dev_components</a>, <a href="#rust_repository_set-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_repository_set-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_repository_set-opt_level">opt_level</a>, <a href="#rust_repository_set-sha256s">sha256s</a>,
+ <a href="#rust_repository_set-urls">urls</a>, <a href="#rust_repository_set-auth">auth</a>, <a href="#rust_repository_set-netrc">netrc</a>, <a href="#rust_repository_set-auth_patterns">auth_patterns</a>, <a href="#rust_repository_set-register_toolchain">register_toolchain</a>, <a href="#rust_repository_set-exec_compatible_with">exec_compatible_with</a>,
+ <a href="#rust_repository_set-default_target_compatible_with">default_target_compatible_with</a>)
</pre>
Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains.
@@ -1919,14 +1916,12 @@
| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="rust_repository_set-name"></a>name | The name of the generated repository | none |
+| <a id="rust_repository_set-versions"></a>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"]`. | none |
| <a id="rust_repository_set-exec_triple"></a>exec_triple | The Rust-style target that this compiler runs on | none |
| <a id="rust_repository_set-target_settings"></a>target_settings | A list of config_settings that must be satisfied by the target configuration in order for this set of toolchains to be selected during toolchain resolution. | `[]` |
-| <a id="rust_repository_set-version"></a>version | The version of the tool among "nightly", "beta', or an exact version. | `None` |
-| <a id="rust_repository_set-versions"></a>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"]`. | `[]` |
| <a id="rust_repository_set-allocator_library"></a>allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` |
| <a id="rust_repository_set-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions a global allocator is used with cc_common.link. | `None` |
| <a id="rust_repository_set-extra_target_triples"></a>extra_target_triples | Additional rust-style targets that this set of toolchains should support. If a map, values should be (optional) target_compatible_with lists for that particular target triple. | `{}` |
-| <a id="rust_repository_set-iso_date"></a>iso_date | The date of the tool. | `None` |
| <a id="rust_repository_set-rustfmt_version"></a>rustfmt_version | The version of rustfmt to be associated with the toolchain. | `None` |
| <a id="rust_repository_set-edition"></a>edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its `edition` attribute. | `None` |
| <a id="rust_repository_set-dev_components"></a>dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". | `False` |
@@ -2018,9 +2013,9 @@
<pre>
rust_toolchain_repository(<a href="#rust_toolchain_repository-name">name</a>, <a href="#rust_toolchain_repository-version">version</a>, <a href="#rust_toolchain_repository-exec_triple">exec_triple</a>, <a href="#rust_toolchain_repository-target_triple">target_triple</a>, <a href="#rust_toolchain_repository-exec_compatible_with">exec_compatible_with</a>,
<a href="#rust_toolchain_repository-target_compatible_with">target_compatible_with</a>, <a href="#rust_toolchain_repository-target_settings">target_settings</a>, <a href="#rust_toolchain_repository-channel">channel</a>, <a href="#rust_toolchain_repository-allocator_library">allocator_library</a>,
- <a href="#rust_toolchain_repository-global_allocator_library">global_allocator_library</a>, <a href="#rust_toolchain_repository-iso_date">iso_date</a>, <a href="#rust_toolchain_repository-rustfmt_version">rustfmt_version</a>, <a href="#rust_toolchain_repository-edition">edition</a>,
- <a href="#rust_toolchain_repository-dev_components">dev_components</a>, <a href="#rust_toolchain_repository-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_toolchain_repository-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_toolchain_repository-opt_level">opt_level</a>,
- <a href="#rust_toolchain_repository-sha256s">sha256s</a>, <a href="#rust_toolchain_repository-urls">urls</a>, <a href="#rust_toolchain_repository-auth">auth</a>, <a href="#rust_toolchain_repository-netrc">netrc</a>, <a href="#rust_toolchain_repository-auth_patterns">auth_patterns</a>)
+ <a href="#rust_toolchain_repository-global_allocator_library">global_allocator_library</a>, <a href="#rust_toolchain_repository-rustfmt_version">rustfmt_version</a>, <a href="#rust_toolchain_repository-edition">edition</a>, <a href="#rust_toolchain_repository-dev_components">dev_components</a>,
+ <a href="#rust_toolchain_repository-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_toolchain_repository-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_toolchain_repository-opt_level">opt_level</a>, <a href="#rust_toolchain_repository-sha256s">sha256s</a>, <a href="#rust_toolchain_repository-urls">urls</a>, <a href="#rust_toolchain_repository-auth">auth</a>,
+ <a href="#rust_toolchain_repository-netrc">netrc</a>, <a href="#rust_toolchain_repository-auth_patterns">auth_patterns</a>)
</pre>
Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains.
@@ -2040,7 +2035,6 @@
| <a id="rust_toolchain_repository-channel"></a>channel | The channel of the Rust toolchain. | `None` |
| <a id="rust_toolchain_repository-allocator_library"></a>allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` |
| <a id="rust_toolchain_repository-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions when a global allocator is used with cc_common.link. | `None` |
-| <a id="rust_toolchain_repository-iso_date"></a>iso_date | The date of the tool. | `None` |
| <a id="rust_toolchain_repository-rustfmt_version"></a>rustfmt_version | The version of rustfmt to be associated with the toolchain. | `None` |
| <a id="rust_toolchain_repository-edition"></a>edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its `edition` attribute. | `None` |
| <a id="rust_toolchain_repository-dev_components"></a>dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". Defaults to False. | `False` |
@@ -2275,7 +2269,7 @@
<pre>
rust_toolchain_tools_repository(<a href="#rust_toolchain_tools_repository-name">name</a>, <a href="#rust_toolchain_tools_repository-allocator_library">allocator_library</a>, <a href="#rust_toolchain_tools_repository-auth">auth</a>, <a href="#rust_toolchain_tools_repository-auth_patterns">auth_patterns</a>, <a href="#rust_toolchain_tools_repository-dev_components">dev_components</a>,
<a href="#rust_toolchain_tools_repository-edition">edition</a>, <a href="#rust_toolchain_tools_repository-exec_triple">exec_triple</a>, <a href="#rust_toolchain_tools_repository-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_toolchain_tools_repository-extra_rustc_flags">extra_rustc_flags</a>,
- <a href="#rust_toolchain_tools_repository-global_allocator_library">global_allocator_library</a>, <a href="#rust_toolchain_tools_repository-iso_date">iso_date</a>, <a href="#rust_toolchain_tools_repository-netrc">netrc</a>, <a href="#rust_toolchain_tools_repository-opt_level">opt_level</a>, <a href="#rust_toolchain_tools_repository-repo_mapping">repo_mapping</a>,
+ <a href="#rust_toolchain_tools_repository-global_allocator_library">global_allocator_library</a>, <a href="#rust_toolchain_tools_repository-netrc">netrc</a>, <a href="#rust_toolchain_tools_repository-opt_level">opt_level</a>, <a href="#rust_toolchain_tools_repository-repo_mapping">repo_mapping</a>,
<a href="#rust_toolchain_tools_repository-rustfmt_version">rustfmt_version</a>, <a href="#rust_toolchain_tools_repository-sha256s">sha256s</a>, <a href="#rust_toolchain_tools_repository-target_triple">target_triple</a>, <a href="#rust_toolchain_tools_repository-urls">urls</a>, <a href="#rust_toolchain_tools_repository-version">version</a>)
</pre>
@@ -2298,7 +2292,6 @@
| <a id="rust_toolchain_tools_repository-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration | List of strings | optional | `[]` |
| <a id="rust_toolchain_tools_repository-extra_rustc_flags"></a>extra_rustc_flags | Extra flags to pass to rustc in non-exec configuration | List of strings | optional | `[]` |
| <a id="rust_toolchain_tools_repository-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions when a global allocator is used with cc_common.link. | String | optional | `"@rules_rust//ffi/cc/global_allocator_library"` |
-| <a id="rust_toolchain_tools_repository-iso_date"></a>iso_date | The date of the tool (or None, if the version is a specific version). | String | optional | `""` |
| <a id="rust_toolchain_tools_repository-netrc"></a>netrc | .netrc file to use for authentication; mirrors the eponymous attribute from http_archive | String | optional | `""` |
| <a id="rust_toolchain_tools_repository-opt_level"></a>opt_level | Rustc optimization levels. For more details see the documentation for `rust_toolchain.opt_level`. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="rust_toolchain_tools_repository-repo_mapping"></a>repo_mapping | In `WORKSPACE` context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<br><br>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`).<br><br>This attribute is _not_ supported in `MODULE.bazel` context (when invoking a repository rule inside a module extension's implementation function). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | |
diff --git a/docs/rust_repositories.md b/docs/rust_repositories.md
index 818dbd6..59c69a0 100644
--- a/docs/rust_repositories.md
+++ b/docs/rust_repositories.md
@@ -144,7 +144,7 @@
<pre>
rust_analyzer_toolchain_repository(<a href="#rust_analyzer_toolchain_repository-name">name</a>, <a href="#rust_analyzer_toolchain_repository-version">version</a>, <a href="#rust_analyzer_toolchain_repository-exec_compatible_with">exec_compatible_with</a>, <a href="#rust_analyzer_toolchain_repository-target_compatible_with">target_compatible_with</a>,
- <a href="#rust_analyzer_toolchain_repository-iso_date">iso_date</a>, <a href="#rust_analyzer_toolchain_repository-sha256s">sha256s</a>, <a href="#rust_analyzer_toolchain_repository-urls">urls</a>, <a href="#rust_analyzer_toolchain_repository-auth">auth</a>, <a href="#rust_analyzer_toolchain_repository-netrc">netrc</a>, <a href="#rust_analyzer_toolchain_repository-auth_patterns">auth_patterns</a>)
+ <a href="#rust_analyzer_toolchain_repository-sha256s">sha256s</a>, <a href="#rust_analyzer_toolchain_repository-urls">urls</a>, <a href="#rust_analyzer_toolchain_repository-auth">auth</a>, <a href="#rust_analyzer_toolchain_repository-netrc">netrc</a>, <a href="#rust_analyzer_toolchain_repository-auth_patterns">auth_patterns</a>)
</pre>
Assemble a remote rust_analyzer_toolchain target based on the given params.
@@ -158,7 +158,6 @@
| <a id="rust_analyzer_toolchain_repository-version"></a>version | The version of the tool among "nightly", "beta', or an exact version. | none |
| <a id="rust_analyzer_toolchain_repository-exec_compatible_with"></a>exec_compatible_with | A list of constraints for the execution platform for this toolchain. | `[]` |
| <a id="rust_analyzer_toolchain_repository-target_compatible_with"></a>target_compatible_with | A list of constraints for the target platform for this toolchain. | `[]` |
-| <a id="rust_analyzer_toolchain_repository-iso_date"></a>iso_date | The date of the tool. | `None` |
| <a id="rust_analyzer_toolchain_repository-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. See [rust_register_toolchains](#rust_register_toolchains) for more details. | `None` |
| <a id="rust_analyzer_toolchain_repository-urls"></a>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.xz'] | `None` |
| <a id="rust_analyzer_toolchain_repository-auth"></a>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` |
@@ -176,9 +175,9 @@
<pre>
rust_register_toolchains(<a href="#rust_register_toolchains-dev_components">dev_components</a>, <a href="#rust_register_toolchains-edition">edition</a>, <a href="#rust_register_toolchains-allocator_library">allocator_library</a>, <a href="#rust_register_toolchains-global_allocator_library">global_allocator_library</a>,
- <a href="#rust_register_toolchains-iso_date">iso_date</a>, <a href="#rust_register_toolchains-register_toolchains">register_toolchains</a>, <a href="#rust_register_toolchains-rustfmt_version">rustfmt_version</a>, <a href="#rust_register_toolchains-rust_analyzer_version">rust_analyzer_version</a>,
- <a href="#rust_register_toolchains-sha256s">sha256s</a>, <a href="#rust_register_toolchains-extra_target_triples">extra_target_triples</a>, <a href="#rust_register_toolchains-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_register_toolchains-extra_exec_rustc_flags">extra_exec_rustc_flags</a>,
- <a href="#rust_register_toolchains-urls">urls</a>, <a href="#rust_register_toolchains-version">version</a>, <a href="#rust_register_toolchains-versions">versions</a>)
+ <a href="#rust_register_toolchains-register_toolchains">register_toolchains</a>, <a href="#rust_register_toolchains-rustfmt_version">rustfmt_version</a>, <a href="#rust_register_toolchains-rust_analyzer_version">rust_analyzer_version</a>, <a href="#rust_register_toolchains-sha256s">sha256s</a>,
+ <a href="#rust_register_toolchains-extra_target_triples">extra_target_triples</a>, <a href="#rust_register_toolchains-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_register_toolchains-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_register_toolchains-urls">urls</a>,
+ <a href="#rust_register_toolchains-versions">versions</a>)
</pre>
Emits a default set of toolchains for Linux, MacOS, and Freebsd
@@ -207,7 +206,6 @@
| <a id="rust_register_toolchains-edition"></a>edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every target is required to specify its `edition` attribute. | `None` |
| <a id="rust_register_toolchains-allocator_library"></a>allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` |
| <a id="rust_register_toolchains-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions when global allocator is used with cc_common.link. | `None` |
-| <a id="rust_register_toolchains-iso_date"></a>iso_date | **Deprecated**: Use `versions` instead. | `None` |
| <a id="rust_register_toolchains-register_toolchains"></a>register_toolchains | If true, repositories will be generated to produce and register `rust_toolchain` targets. | `True` |
| <a id="rust_register_toolchains-rustfmt_version"></a>rustfmt_version | The version of rustfmt. If none is supplied and only a single version in `versions` is given, then this defaults to that version, otherwise will default to the default nightly version. | `None` |
| <a id="rust_register_toolchains-rust_analyzer_version"></a>rust_analyzer_version | The version of Rustc to pair with rust-analyzer. | `None` |
@@ -216,8 +214,7 @@
| <a id="rust_register_toolchains-extra_rustc_flags"></a>extra_rustc_flags | Dictionary of target triples to list of extra flags to pass to rustc in non-exec configuration. | `None` |
| <a id="rust_register_toolchains-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration. | `None` |
| <a id="rust_register_toolchains-urls"></a>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.xz"]` |
-| <a id="rust_register_toolchains-version"></a>version | **Deprecated**: Use `versions` instead. | `None` |
-| <a id="rust_register_toolchains-versions"></a>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"]`. | `[]` |
+| <a id="rust_register_toolchains-versions"></a>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"]`. | `["1.80.0", "nightly/2024-07-25"]` |
<a id="rust_repositories"></a>
@@ -243,11 +240,11 @@
## rust_repository_set
<pre>
-rust_repository_set(<a href="#rust_repository_set-name">name</a>, <a href="#rust_repository_set-exec_triple">exec_triple</a>, <a href="#rust_repository_set-target_settings">target_settings</a>, <a href="#rust_repository_set-version">version</a>, <a href="#rust_repository_set-versions">versions</a>, <a href="#rust_repository_set-allocator_library">allocator_library</a>,
- <a href="#rust_repository_set-global_allocator_library">global_allocator_library</a>, <a href="#rust_repository_set-extra_target_triples">extra_target_triples</a>, <a href="#rust_repository_set-iso_date">iso_date</a>, <a href="#rust_repository_set-rustfmt_version">rustfmt_version</a>,
- <a href="#rust_repository_set-edition">edition</a>, <a href="#rust_repository_set-dev_components">dev_components</a>, <a href="#rust_repository_set-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_repository_set-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_repository_set-opt_level">opt_level</a>,
- <a href="#rust_repository_set-sha256s">sha256s</a>, <a href="#rust_repository_set-urls">urls</a>, <a href="#rust_repository_set-auth">auth</a>, <a href="#rust_repository_set-netrc">netrc</a>, <a href="#rust_repository_set-auth_patterns">auth_patterns</a>, <a href="#rust_repository_set-register_toolchain">register_toolchain</a>,
- <a href="#rust_repository_set-exec_compatible_with">exec_compatible_with</a>, <a href="#rust_repository_set-default_target_compatible_with">default_target_compatible_with</a>)
+rust_repository_set(<a href="#rust_repository_set-name">name</a>, <a href="#rust_repository_set-versions">versions</a>, <a href="#rust_repository_set-exec_triple">exec_triple</a>, <a href="#rust_repository_set-target_settings">target_settings</a>, <a href="#rust_repository_set-allocator_library">allocator_library</a>,
+ <a href="#rust_repository_set-global_allocator_library">global_allocator_library</a>, <a href="#rust_repository_set-extra_target_triples">extra_target_triples</a>, <a href="#rust_repository_set-rustfmt_version">rustfmt_version</a>, <a href="#rust_repository_set-edition">edition</a>,
+ <a href="#rust_repository_set-dev_components">dev_components</a>, <a href="#rust_repository_set-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_repository_set-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_repository_set-opt_level">opt_level</a>, <a href="#rust_repository_set-sha256s">sha256s</a>,
+ <a href="#rust_repository_set-urls">urls</a>, <a href="#rust_repository_set-auth">auth</a>, <a href="#rust_repository_set-netrc">netrc</a>, <a href="#rust_repository_set-auth_patterns">auth_patterns</a>, <a href="#rust_repository_set-register_toolchain">register_toolchain</a>, <a href="#rust_repository_set-exec_compatible_with">exec_compatible_with</a>,
+ <a href="#rust_repository_set-default_target_compatible_with">default_target_compatible_with</a>)
</pre>
Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains.
@@ -258,14 +255,12 @@
| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="rust_repository_set-name"></a>name | The name of the generated repository | none |
+| <a id="rust_repository_set-versions"></a>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"]`. | none |
| <a id="rust_repository_set-exec_triple"></a>exec_triple | The Rust-style target that this compiler runs on | none |
| <a id="rust_repository_set-target_settings"></a>target_settings | A list of config_settings that must be satisfied by the target configuration in order for this set of toolchains to be selected during toolchain resolution. | `[]` |
-| <a id="rust_repository_set-version"></a>version | The version of the tool among "nightly", "beta', or an exact version. | `None` |
-| <a id="rust_repository_set-versions"></a>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"]`. | `[]` |
| <a id="rust_repository_set-allocator_library"></a>allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` |
| <a id="rust_repository_set-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions a global allocator is used with cc_common.link. | `None` |
| <a id="rust_repository_set-extra_target_triples"></a>extra_target_triples | Additional rust-style targets that this set of toolchains should support. If a map, values should be (optional) target_compatible_with lists for that particular target triple. | `{}` |
-| <a id="rust_repository_set-iso_date"></a>iso_date | The date of the tool. | `None` |
| <a id="rust_repository_set-rustfmt_version"></a>rustfmt_version | The version of rustfmt to be associated with the toolchain. | `None` |
| <a id="rust_repository_set-edition"></a>edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its `edition` attribute. | `None` |
| <a id="rust_repository_set-dev_components"></a>dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". | `False` |
@@ -289,9 +284,9 @@
<pre>
rust_toolchain_repository(<a href="#rust_toolchain_repository-name">name</a>, <a href="#rust_toolchain_repository-version">version</a>, <a href="#rust_toolchain_repository-exec_triple">exec_triple</a>, <a href="#rust_toolchain_repository-target_triple">target_triple</a>, <a href="#rust_toolchain_repository-exec_compatible_with">exec_compatible_with</a>,
<a href="#rust_toolchain_repository-target_compatible_with">target_compatible_with</a>, <a href="#rust_toolchain_repository-target_settings">target_settings</a>, <a href="#rust_toolchain_repository-channel">channel</a>, <a href="#rust_toolchain_repository-allocator_library">allocator_library</a>,
- <a href="#rust_toolchain_repository-global_allocator_library">global_allocator_library</a>, <a href="#rust_toolchain_repository-iso_date">iso_date</a>, <a href="#rust_toolchain_repository-rustfmt_version">rustfmt_version</a>, <a href="#rust_toolchain_repository-edition">edition</a>,
- <a href="#rust_toolchain_repository-dev_components">dev_components</a>, <a href="#rust_toolchain_repository-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_toolchain_repository-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_toolchain_repository-opt_level">opt_level</a>,
- <a href="#rust_toolchain_repository-sha256s">sha256s</a>, <a href="#rust_toolchain_repository-urls">urls</a>, <a href="#rust_toolchain_repository-auth">auth</a>, <a href="#rust_toolchain_repository-netrc">netrc</a>, <a href="#rust_toolchain_repository-auth_patterns">auth_patterns</a>)
+ <a href="#rust_toolchain_repository-global_allocator_library">global_allocator_library</a>, <a href="#rust_toolchain_repository-rustfmt_version">rustfmt_version</a>, <a href="#rust_toolchain_repository-edition">edition</a>, <a href="#rust_toolchain_repository-dev_components">dev_components</a>,
+ <a href="#rust_toolchain_repository-extra_rustc_flags">extra_rustc_flags</a>, <a href="#rust_toolchain_repository-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_toolchain_repository-opt_level">opt_level</a>, <a href="#rust_toolchain_repository-sha256s">sha256s</a>, <a href="#rust_toolchain_repository-urls">urls</a>, <a href="#rust_toolchain_repository-auth">auth</a>,
+ <a href="#rust_toolchain_repository-netrc">netrc</a>, <a href="#rust_toolchain_repository-auth_patterns">auth_patterns</a>)
</pre>
Assembles a remote repository for the given toolchain params, produces a proxy repository to contain the toolchain declaration, and registers the toolchains.
@@ -311,7 +306,6 @@
| <a id="rust_toolchain_repository-channel"></a>channel | The channel of the Rust toolchain. | `None` |
| <a id="rust_toolchain_repository-allocator_library"></a>allocator_library | Target that provides allocator functions when rust_library targets are embedded in a cc_binary. | `None` |
| <a id="rust_toolchain_repository-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions when a global allocator is used with cc_common.link. | `None` |
-| <a id="rust_toolchain_repository-iso_date"></a>iso_date | The date of the tool. | `None` |
| <a id="rust_toolchain_repository-rustfmt_version"></a>rustfmt_version | The version of rustfmt to be associated with the toolchain. | `None` |
| <a id="rust_toolchain_repository-edition"></a>edition | The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its `edition` attribute. | `None` |
| <a id="rust_toolchain_repository-dev_components"></a>dev_components | Whether to download the rustc-dev components. Requires version to be "nightly". Defaults to False. | `False` |
@@ -361,7 +355,7 @@
<pre>
rust_toolchain_tools_repository(<a href="#rust_toolchain_tools_repository-name">name</a>, <a href="#rust_toolchain_tools_repository-allocator_library">allocator_library</a>, <a href="#rust_toolchain_tools_repository-auth">auth</a>, <a href="#rust_toolchain_tools_repository-auth_patterns">auth_patterns</a>, <a href="#rust_toolchain_tools_repository-dev_components">dev_components</a>,
<a href="#rust_toolchain_tools_repository-edition">edition</a>, <a href="#rust_toolchain_tools_repository-exec_triple">exec_triple</a>, <a href="#rust_toolchain_tools_repository-extra_exec_rustc_flags">extra_exec_rustc_flags</a>, <a href="#rust_toolchain_tools_repository-extra_rustc_flags">extra_rustc_flags</a>,
- <a href="#rust_toolchain_tools_repository-global_allocator_library">global_allocator_library</a>, <a href="#rust_toolchain_tools_repository-iso_date">iso_date</a>, <a href="#rust_toolchain_tools_repository-netrc">netrc</a>, <a href="#rust_toolchain_tools_repository-opt_level">opt_level</a>, <a href="#rust_toolchain_tools_repository-repo_mapping">repo_mapping</a>,
+ <a href="#rust_toolchain_tools_repository-global_allocator_library">global_allocator_library</a>, <a href="#rust_toolchain_tools_repository-netrc">netrc</a>, <a href="#rust_toolchain_tools_repository-opt_level">opt_level</a>, <a href="#rust_toolchain_tools_repository-repo_mapping">repo_mapping</a>,
<a href="#rust_toolchain_tools_repository-rustfmt_version">rustfmt_version</a>, <a href="#rust_toolchain_tools_repository-sha256s">sha256s</a>, <a href="#rust_toolchain_tools_repository-target_triple">target_triple</a>, <a href="#rust_toolchain_tools_repository-urls">urls</a>, <a href="#rust_toolchain_tools_repository-version">version</a>)
</pre>
@@ -384,7 +378,6 @@
| <a id="rust_toolchain_tools_repository-extra_exec_rustc_flags"></a>extra_exec_rustc_flags | Extra flags to pass to rustc in exec configuration | List of strings | optional | `[]` |
| <a id="rust_toolchain_tools_repository-extra_rustc_flags"></a>extra_rustc_flags | Extra flags to pass to rustc in non-exec configuration | List of strings | optional | `[]` |
| <a id="rust_toolchain_tools_repository-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions when a global allocator is used with cc_common.link. | String | optional | `"@rules_rust//ffi/cc/global_allocator_library"` |
-| <a id="rust_toolchain_tools_repository-iso_date"></a>iso_date | The date of the tool (or None, if the version is a specific version). | String | optional | `""` |
| <a id="rust_toolchain_tools_repository-netrc"></a>netrc | .netrc file to use for authentication; mirrors the eponymous attribute from http_archive | String | optional | `""` |
| <a id="rust_toolchain_tools_repository-opt_level"></a>opt_level | Rustc optimization levels. For more details see the documentation for `rust_toolchain.opt_level`. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |
| <a id="rust_toolchain_tools_repository-repo_mapping"></a>repo_mapping | In `WORKSPACE` context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<br><br>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`).<br><br>This attribute is _not_ supported in `MODULE.bazel` context (when invoking a repository rule inside a module extension's implementation function). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | |
diff --git a/rust/extensions.bzl b/rust/extensions.bzl
index 5430f57..1a8b779 100644
--- a/rust/extensions.bzl
+++ b/rust/extensions.bzl
@@ -11,6 +11,11 @@
"DEFAULT_STATIC_RUST_URL_TEMPLATES",
)
+_RUST_TOOLCHAIN_VERSIONS = [
+ rust_common.default_version,
+ DEFAULT_NIGHTLY_VERSION,
+]
+
def _find_modules(module_ctx):
root = None
our_module = None
@@ -89,7 +94,7 @@
"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\"]`."
),
- default = [],
+ default = _RUST_TOOLCHAIN_VERSIONS,
),
**_COMMON_TAG_KWARGS
),
@@ -120,22 +125,14 @@
if len(root.tags.host_tools) == 1:
attrs = root.tags.host_tools[0]
- iso_date = None
- version = attrs.version
-
- # Any version containing a slash is expected to be a nightly/beta release with iso date. E.g. `nightly/2024-03-21`
- if "/" in version:
- version, _, iso_date = version.partition("/")
-
host_tools = {
"allocator_library": attrs.allocator_library,
"dev_components": attrs.dev_components,
"edition": attrs.edition,
- "iso_date": iso_date,
"rustfmt_version": attrs.rustfmt_version,
"sha256s": attrs.sha256s,
"urls": attrs.urls,
- "version": version,
+ "version": attrs.version,
}
elif not root.tags.host_tools:
host_tools = {
diff --git a/rust/private/repository_utils.bzl b/rust/private/repository_utils.bzl
index 709b653..79cf2e9 100644
--- a/rust/private/repository_utils.bzl
+++ b/rust/private/repository_utils.bzl
@@ -574,12 +574,14 @@
rustc_lib = rustc_lib,
)
-def load_rust_stdlib(ctx, target_triple):
+def load_rust_stdlib(ctx, target_triple, version, iso_date = None):
"""Loads a rust standard library and yields corresponding BUILD for it
Args:
ctx (repository_ctx): A repository_ctx.
target_triple (struct): The rust-style target triple of the tool
+ version (str): The version of the tool among \"nightly\", \"beta\", or an exact version.
+ iso_date (str): The iso_date to use with \"nightly\" or \"beta\" versions.
Returns:
Tuple[str, Dict[str, str]]: The BUILD file contents for this stdlib and the sha256 of the artifact.
@@ -587,58 +589,62 @@
sha256 = load_arbitrary_tool(
ctx,
- iso_date = ctx.attr.iso_date,
+ iso_date = iso_date,
target_triple = target_triple,
tool_name = "rust-std",
tool_subdirectories = ["rust-std-{}".format(target_triple.str)],
- version = ctx.attr.version,
+ version = version,
)
return BUILD_for_stdlib(target_triple), sha256
-def load_rustc_dev_nightly(ctx, target_triple):
+def load_rustc_dev_nightly(ctx, target_triple, version, iso_date = None):
"""Loads the nightly rustc dev component
Args:
ctx: A repository_ctx.
target_triple: The rust-style target triple of the tool
+ version (str): The version of the tool among \"nightly\", \"beta\", or an exact version.
+ iso_date (str): The iso_date to use with \"nightly\" or \"beta\" versions.
Returns:
Dict[str, str]: The sha256 value of the rustc-dev artifact.
"""
subdir_name = "rustc-dev"
- if ctx.attr.iso_date < "2020-12-24":
+ if iso_date and iso_date < "2020-12-24":
subdir_name = "rustc-dev-{}".format(target_triple)
sha256 = load_arbitrary_tool(
ctx,
- iso_date = ctx.attr.iso_date,
+ iso_date = iso_date,
target_triple = target_triple,
tool_name = "rustc-dev",
tool_subdirectories = [subdir_name],
- version = ctx.attr.version,
+ version = version,
)
return sha256
-def load_llvm_tools(ctx, target_triple):
+def load_llvm_tools(ctx, target_triple, version, iso_date = None):
"""Loads the llvm tools
Args:
ctx (repository_ctx): A repository_ctx.
target_triple (struct): The rust-style target triple of the tool
+ version (str): The version of the tool among \"nightly\", \"beta\", or an exact version.
+ iso_date (str): The iso_date to use with \"nightly\" or \"beta\" versions.
Returns:
Tuple[str, Dict[str, str]]: The BUILD.bazel content and sha256 value of the llvm tools artifact.
"""
sha256 = load_arbitrary_tool(
ctx,
- iso_date = ctx.attr.iso_date,
+ iso_date = iso_date,
target_triple = target_triple,
tool_name = "llvm-tools",
tool_subdirectories = ["llvm-tools-preview"],
- version = ctx.attr.version,
+ version = version,
)
return BUILD_for_llvm_tools(target_triple), sha256
diff --git a/rust/repositories.bzl b/rust/repositories.bzl
index 321f844..8861231 100644
--- a/rust/repositories.bzl
+++ b/rust/repositories.bzl
@@ -4,7 +4,7 @@
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//rust/platform:triple.bzl", "get_host_triple", "triple")
load("//rust/platform:triple_mappings.bzl", "triple_to_constraint_set")
-load("//rust/private:common.bzl", "DEFAULT_NIGHTLY_ISO_DATE", "rust_common")
+load("//rust/private:common.bzl", "rust_common")
load(
"//rust/private:repository_utils.bzl",
"BUILD_for_rust_analyzer_proc_macro_srv",
@@ -110,7 +110,6 @@
edition = None,
allocator_library = None,
global_allocator_library = None,
- iso_date = None,
register_toolchains = True,
rustfmt_version = None,
rust_analyzer_version = None,
@@ -119,8 +118,7 @@
extra_rustc_flags = None,
extra_exec_rustc_flags = None,
urls = DEFAULT_STATIC_RUST_URL_TEMPLATES,
- version = None,
- versions = []):
+ versions = _RUST_TOOLCHAIN_VERSIONS):
"""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 \
@@ -144,7 +142,6 @@
edition (str, optional): The rust edition to be used by default (2015, 2018, or 2021). If absent, every target is required to specify its `edition` attribute.
allocator_library (str, optional): Target that provides allocator functions when rust_library targets are embedded in a cc_binary.
global_allocator_library (str, optional): Target that provides allocator functions when global allocator is used with cc_common.link.
- iso_date (str, optional): **Deprecated**: Use `versions` instead.
register_toolchains (bool): If true, repositories will be generated to produce and register `rust_toolchain` targets.
rustfmt_version (str, optional): The version of rustfmt. If none is supplied and only a single version in `versions` is given, then this defaults to that version, otherwise will default to the default nightly version.
rust_analyzer_version (str, optional): The version of Rustc to pair with rust-analyzer.
@@ -153,29 +150,9 @@
extra_rustc_flags (dict, list, optional): Dictionary of target triples to list of extra flags to pass to rustc in non-exec configuration.
extra_exec_rustc_flags (list, optional): Extra flags to pass to rustc in exec configuration.
urls (list, optional): 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).
- version (str, optional): **Deprecated**: Use `versions` instead.
versions (list, optional): 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"]`.
"""
- if version:
- # buildifier: disable=print
- print("`rust_register.toolchains.version` is deprecated. Please use `versions` instead: https://bazelbuild.github.io/rules_rust/flatten.html#rust_register_toolchains-versions")
-
- if iso_date:
- # buildifier: disable=print
- print("`rust_register.toolchains.iso_date` is deprecated. Please use `versions` instead: https://bazelbuild.github.io/rules_rust/flatten.html#rust_register_toolchains-versions")
-
- if rustfmt_version in ("nightly", "beta"):
- # buildifier: disable=print
- print("`rust_register.toolchains.rustfmt_version` now requires iso date to be included in the string. E.g. `nightly/2022-12-15`. This version will be assumed until this value is updated")
- rustfmt_version = "{}/{}".format(rustfmt_version, DEFAULT_NIGHTLY_ISO_DATE)
-
- if not versions:
- if version:
- versions = [version]
- else:
- versions = _RUST_TOOLCHAIN_VERSIONS
-
if not rustfmt_version:
if len(versions) == 1:
rustfmt_version = versions[0]
@@ -195,9 +172,6 @@
rust_analyzer_version = select_rust_version(versions)
rust_analyzer_repo_name = "rust_analyzer_{}".format(rust_analyzer_version.replace("/", "-"))
- rust_analyzer_iso_date = None
- if rust_analyzer_version.startswith(("beta", "nightly")):
- rust_analyzer_version, _, rust_analyzer_iso_date = rust_analyzer_version.partition("/")
toolchain_names = []
toolchain_labels = {}
@@ -211,7 +185,6 @@
version = rust_analyzer_version,
urls = urls,
sha256s = sha256s,
- iso_date = rust_analyzer_iso_date,
)
toolchain_names.append(rust_analyzer_repo_name)
@@ -227,11 +200,6 @@
rust_analyzer_repo_name,
))
- rustfmt_iso_date = None
- rustfmt_version_or_channel = rustfmt_version
- if rustfmt_version.startswith(("beta", "nightly")):
- rustfmt_version_or_channel, _, rustfmt_iso_date = rustfmt_version.partition("/")
-
for exec_triple, name in DEFAULT_TOOLCHAIN_TRIPLES.items():
maybe(
rust_repository_set,
@@ -242,14 +210,12 @@
extra_target_triples = extra_target_triples,
allocator_library = allocator_library,
global_allocator_library = global_allocator_library,
- iso_date = iso_date,
register_toolchain = register_toolchains,
rustfmt_version = rustfmt_version,
extra_rustc_flags = extra_rustc_flags,
extra_exec_rustc_flags = extra_exec_rustc_flags,
sha256s = sha256s,
urls = urls,
- version = version,
versions = versions,
)
@@ -258,10 +224,9 @@
maybe(
rustfmt_toolchain_repository,
name = rustfmt_repo_name,
- version = rustfmt_version_or_channel,
+ version = rustfmt_version,
urls = urls,
sha256s = sha256s,
- iso_date = rustfmt_iso_date,
exec_triple = exec_triple,
)
@@ -270,7 +235,7 @@
rustfmt_repo_name,
))
- for toolchain in _get_toolchain_repositories(name, exec_triple, extra_target_triples, versions, iso_date):
+ for toolchain in _get_toolchain_repositories(name, exec_triple, extra_target_triples, versions):
toolchain_names.append(toolchain.name)
toolchain_labels[toolchain.name] = "@{}//:{}".format(toolchain.name + "_tools", "rust_toolchain")
exec_compatible_with_by_toolchain[toolchain.name] = triple_to_constraint_set(exec_triple)
@@ -342,9 +307,6 @@
doc = "Target that provides allocator functions when a global allocator is used with cc_common.link.",
default = "@rules_rust//ffi/cc/global_allocator_library",
),
- "iso_date": attr.string(
- doc = "The date of the tool (or None, if the version is a specific version).",
- ),
"netrc": attr.string(
doc = ".netrc file to use for authentication; mirrors the eponymous attribute from http_archive",
),
@@ -374,7 +336,7 @@
def _rust_toolchain_tools_repository_impl(ctx):
"""The implementation of the rust toolchain tools repository rule."""
sha256s = dict(ctx.attr.sha256s)
- iso_date = ctx.attr.iso_date
+ iso_date = None
version = ctx.attr.version
version_array = version.split("/")
if len(version_array) > 1:
@@ -438,6 +400,8 @@
llvm_tools_content, llvm_tools_sha256 = load_llvm_tools(
ctx = ctx,
target_triple = exec_triple,
+ version = version,
+ iso_date = iso_date,
)
build_components.append(llvm_tools_content)
sha256s.update(llvm_tools_sha256)
@@ -446,6 +410,8 @@
rust_stdlib_content, rust_stdlib_sha256 = load_rust_stdlib(
ctx = ctx,
target_triple = target_triple,
+ version = version,
+ iso_date = iso_date,
)
build_components.append(rust_stdlib_content)
sha256s.update(rust_stdlib_sha256)
@@ -471,7 +437,12 @@
# Not all target triples are expected to have dev components
if ctx.attr.dev_components:
- rustc_dev_sha256 = load_rustc_dev_nightly(ctx, target_triple)
+ rustc_dev_sha256 = load_rustc_dev_nightly(
+ ctx = ctx,
+ target_triple = target_triple,
+ version = version,
+ iso_date = iso_date,
+ )
sha256s.update(rustc_dev_sha256)
ctx.file("WORKSPACE.bazel", "")
@@ -554,7 +525,6 @@
channel = None,
allocator_library = None,
global_allocator_library = None,
- iso_date = None,
rustfmt_version = None,
edition = None,
dev_components = False,
@@ -580,7 +550,6 @@
target_settings (list, optional): A list of config_settings that must be satisfied by the target configuration in order for this toolchain to be selected during toolchain resolution.
allocator_library (str, optional): Target that provides allocator functions when rust_library targets are embedded in a cc_binary.
global_allocator_library (str, optional): Target that provides allocator functions when a global allocator is used with cc_common.link.
- iso_date (str, optional): The date of the tool.
rustfmt_version (str, optional): The version of rustfmt to be associated with the
toolchain.
edition (str, optional): The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is required to specify its `edition` attribute.
@@ -600,12 +569,6 @@
Returns:
str: The name of the registerable toolchain created by this rule.
"""
-
- if rustfmt_version in ("nightly", "beta"):
- # buildifier: disable=print
- print("`rust_toolchain_repository.rustfmt_version` now requires iso date to be included in the string. E.g. `nightly/2022-12-15`. This version will be assumed until this value is updated")
- rustfmt_version = "{}/{}".format(rustfmt_version, DEFAULT_NIGHTLY_ISO_DATE)
-
if exec_compatible_with == None:
exec_compatible_with = triple_to_constraint_set(exec_triple)
@@ -620,7 +583,6 @@
allocator_library = allocator_library,
global_allocator_library = global_allocator_library,
target_triple = target_triple,
- iso_date = iso_date,
version = version,
rustfmt_version = rustfmt_version,
edition = edition,
@@ -660,9 +622,6 @@
"auth_patterns": attr.string_list(
doc = "A list of patterns to match against urls for which the auth object should be used.",
),
- "iso_date": attr.string(
- doc = "The date of the tool (or None, if the version is a specific version).",
- ),
"netrc": attr.string(
doc = ".netrc file to use for authentication; mirrors the eponymous attribute from http_archive",
),
@@ -674,7 +633,7 @@
default = DEFAULT_STATIC_RUST_URL_TEMPLATES,
),
"version": attr.string(
- doc = "The version of the tool among \"nightly\", \"beta\", or an exact version.",
+ doc = "The version of the tool among \"nightly\", \"beta\" with an iso date, or an exact version.",
mandatory = True,
),
}
@@ -682,10 +641,17 @@
def _rust_analyzer_toolchain_tools_repository_impl(repository_ctx):
sha256s = dict(repository_ctx.attr.sha256s)
+ iso_date = None
+ version = repository_ctx.attr.version
+ version_array = version.split("/")
+ if len(version_array) > 1:
+ version = version_array[0]
+ iso_date = version_array[1]
+
sha256s.update(load_rust_src(
ctx = repository_ctx,
- iso_date = repository_ctx.attr.iso_date,
- version = repository_ctx.attr.version,
+ iso_date = iso_date,
+ version = version,
))
repository_ctx.file("WORKSPACE.bazel", """workspace(name = "{}")""".format(
@@ -695,16 +661,16 @@
host_triple = get_host_triple(repository_ctx)
rustc_content, rustc_sha256 = load_rust_compiler(
ctx = repository_ctx,
- iso_date = repository_ctx.attr.iso_date,
+ iso_date = iso_date,
target_triple = host_triple,
- version = repository_ctx.attr.version,
+ version = version,
)
build_contents = [rustc_content]
sha256s.update(rustc_sha256)
rustc = "//:rustc"
proc_macro_srv = None
- if includes_rust_analyzer_proc_macro_srv(repository_ctx.attr.version, repository_ctx.attr.iso_date):
+ if includes_rust_analyzer_proc_macro_srv(version, iso_date):
build_contents.append(BUILD_for_rust_analyzer_proc_macro_srv(host_triple))
proc_macro_srv = "//:rust_analyzer_proc_macro_srv"
@@ -737,7 +703,6 @@
version,
exec_compatible_with = [],
target_compatible_with = [],
- iso_date = None,
sha256s = None,
urls = None,
auth = None,
@@ -750,7 +715,6 @@
version (str): The version of the tool among "nightly", "beta', or an exact version.
exec_compatible_with (list, optional): A list of constraints for the execution platform for this toolchain.
target_compatible_with (list, optional): A list of constraints for the target platform for this toolchain.
- iso_date (str, optional): The date of the tool.
sha256s (str, optional): A dict associating tool subdirectories to sha256 hashes. See
[rust_register_toolchains](#rust_register_toolchains) for more details.
urls (list, optional): 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.xz']
@@ -765,7 +729,6 @@
rust_analyzer_toolchain_tools_repository(
name = name + "_tools",
version = version,
- iso_date = iso_date,
sha256s = sha256s,
urls = urls,
auth = auth,
@@ -799,9 +762,6 @@
doc = "The Rust-style triple Rustfmt is expected to run on.",
mandatory = True,
),
- "iso_date": attr.string(
- doc = "The date of the tool (or None, if the version is a specific version).",
- ),
"netrc": attr.string(
doc = ".netrc file to use for authentication; mirrors the eponymous attribute from http_archive",
),
@@ -813,7 +773,7 @@
default = DEFAULT_STATIC_RUST_URL_TEMPLATES,
),
"version": attr.string(
- doc = "The version of the tool among \"nightly\", \"beta\", or an exact version.",
+ doc = "The version of the tool among \"nightly\", \"beta\" with an iso date, or an exact version.",
mandatory = True,
),
}
@@ -824,6 +784,13 @@
repository_ctx.name,
))
+ iso_date = None
+ version = repository_ctx.attr.version
+ version_array = version.split("/")
+ if len(version_array) > 1:
+ version = version_array[0]
+ iso_date = version_array[1]
+
rustfmt = "//:rustfmt_bin"
rustc = "//:rustc"
rustc_lib = "//:rustc_lib"
@@ -832,15 +799,15 @@
rustc_content, rustc_sha256 = load_rust_compiler(
ctx = repository_ctx,
- iso_date = repository_ctx.attr.iso_date,
+ iso_date = iso_date,
target_triple = exec_triple,
- version = repository_ctx.attr.version,
+ version = version,
)
rustfmt_content, rustfmt_sha256 = load_rustfmt(
ctx = repository_ctx,
- iso_date = repository_ctx.attr.iso_date,
+ iso_date = iso_date,
target_triple = exec_triple,
- version = repository_ctx.attr.version,
+ version = version,
)
build_contents = [
@@ -879,7 +846,6 @@
exec_triple,
exec_compatible_with = None,
target_compatible_with = None,
- iso_date = None,
channel = None,
sha256s = None,
urls = None,
@@ -894,7 +860,6 @@
exec_triple (str): The platform triple Rustfmt is expected to run on.
exec_compatible_with (list, optional): A list of constraints for the execution platform for this toolchain.
target_compatible_with (list, optional): A list of constraints for the target platform for this toolchain.
- iso_date (str, optional): The date of the tool.
channel (str, optional): The channel value to with which to constrain the toolchain.
sha256s (str, optional): A dict associating tool subdirectories to sha256 hashes. See
[rust_register_toolchains](#rust_register_toolchains) for more details.
@@ -913,7 +878,6 @@
rustfmt_toolchain_tools_repository(
name = name + "_tools",
version = version,
- iso_date = iso_date,
sha256s = sha256s,
urls = urls,
auth = auth,
@@ -959,7 +923,7 @@
implementation = _rust_toolchain_set_repository_impl,
)
-def _get_toolchain_repositories(name, exec_triple, extra_target_triples, versions, iso_date):
+def _get_toolchain_repositories(name, exec_triple, extra_target_triples, versions):
toolchain_repos = []
for target_triple in depset([exec_triple] + extra_target_triples).to_list():
@@ -967,20 +931,16 @@
channels = {}
for version in versions:
if version.startswith(("beta", "nightly")):
- channel, _, date = version.partition("/")
- ver = channel
+ channel, _, _ = version.partition("/")
else:
channel = "stable"
- date = iso_date
- ver = version
if channel in channels:
fail("Duplicate {} channels provided for {}: {}".format(channel, name, versions))
channels.update({channel: struct(
name = channel,
- iso_date = date,
- version = ver,
+ version = version,
)})
# Define toolchains for each requested version
@@ -995,14 +955,12 @@
def rust_repository_set(
name,
+ versions,
exec_triple,
target_settings = [],
- version = None,
- versions = [],
allocator_library = None,
global_allocator_library = None,
extra_target_triples = {},
- iso_date = None,
rustfmt_version = None,
edition = None,
dev_components = False,
@@ -1022,17 +980,15 @@
Args:
name (str): The name of the generated repository
- exec_triple (str): The Rust-style target that this compiler runs on
- target_settings (list, optional): A list of config_settings that must be satisfied by the target configuration in order for this set of toolchains to be selected during toolchain resolution.
- version (str): The version of the tool among "nightly", "beta', or an exact version.
versions (list, optional): 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"]`.
+ exec_triple (str): The Rust-style target that this compiler runs on
+ target_settings (list, optional): A list of config_settings that must be satisfied by the target configuration in order for this set of toolchains to be selected during toolchain resolution.
allocator_library (str, optional): Target that provides allocator functions when rust_library targets are
embedded in a cc_binary.
global_allocator_library (str, optional): Target that provides allocator functions a global allocator is used with cc_common.link.
extra_target_triples (list or map, optional): Additional rust-style targets that this set of
toolchains should support. If a map, values should be (optional) target_compatible_with lists for that particular target triple.
- iso_date (str, optional): The date of the tool.
rustfmt_version (str, optional): The version of rustfmt to be associated with the
toolchain.
edition (str, optional): The rust edition to be used by default (2015, 2018, or 2021). If absent, every rule is
@@ -1056,30 +1012,13 @@
default_target_compatible_with (list, optional): A list of constraints for the target platform for this toolchain when the exec platform is the same as the target platform.
"""
- if version and versions:
- fail("`version` and `versions` attributes are mutually exclusive. Update {} to use one".format(
- name,
- ))
-
- if not version and not versions:
- fail("`version` or `versions` attributes are required. Update {} to use one".format(
- name,
- ))
-
- if version:
- # buildifier: disable=print
- print("`rust_repository_set.version` is deprecated. Instead use `rust_repository_set.versions`")
-
- if version and not versions:
- versions = [version]
-
# extra_target_triples may be a dict or list - make a list we can pass to _get_toolchain_repositories
extra_target_triples_list = []
for extra_target_triple in extra_target_triples:
extra_target_triples_list.append(extra_target_triple)
all_toolchain_names = []
- for toolchain in _get_toolchain_repositories(name, exec_triple, extra_target_triples_list, versions, iso_date):
+ for toolchain in _get_toolchain_repositories(name, exec_triple, extra_target_triples_list, versions):
target_compatible_with = None
if toolchain.target_triple == exec_triple:
# The exec triple implicitly gets a toolchain with itself as a target - use default_target_compatible_with for it
@@ -1112,7 +1051,6 @@
extra_rustc_flags = toolchain_extra_rustc_flags,
opt_level = opt_level.get(toolchain.target_triple) if opt_level != None else None,
target_settings = target_settings,
- iso_date = toolchain.channel.iso_date,
rustfmt_version = rustfmt_version,
sha256s = sha256s,
target_triple = toolchain.target_triple,