Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion rust/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def _rust_impl(module_ctx):
for toolchain in toolchains:
if toolchain.extra_rustc_flags and toolchain.extra_rustc_flags_triples:
fail("Cannot define both extra_rustc_flags and extra_rustc_flags_triples")
if toolchain.extra_exec_rustc_flags and toolchain.extra_exec_rustc_flags_triples:
fail("Cannot define both extra_exec_rustc_flags and extra_exec_rustc_flags_triples")
if len(toolchain.versions) == 0:
# If the root module has asked for rules_rust to not register default
# toolchains, an empty repository named `rust_toolchains` is created
Expand All @@ -106,13 +108,14 @@ def _rust_impl(module_ctx):
_empty_repository(name = "rust_toolchains")
else:
extra_rustc_flags = toolchain.extra_rustc_flags if toolchain.extra_rustc_flags else toolchain.extra_rustc_flags_triples
extra_exec_rustc_flags = toolchain.extra_exec_rustc_flags if toolchain.extra_rustc_flags else toolchain.extra_exec_rustc_flags_triples

rust_register_toolchains(
hub_name = "rust_toolchains",
dev_components = toolchain.dev_components,
edition = toolchain.edition,
extra_rustc_flags = extra_rustc_flags,
extra_exec_rustc_flags = toolchain.extra_exec_rustc_flags,
extra_exec_rustc_flags = extra_exec_rustc_flags,
allocator_library = toolchain.allocator_library,
rustfmt_version = toolchain.rustfmt_version,
rust_analyzer_version = toolchain.rust_analyzer_version,
Expand Down Expand Up @@ -213,6 +216,9 @@ _RUST_TOOLCHAIN_TAG = tag_class(
"extra_exec_rustc_flags": attr.string_list(
doc = "Extra flags to pass to rustc in exec configuration",
),
"extra_exec_rustc_flags_triples": attr.string_list_dict(
doc = "Extra flags to pass to rustc in exec configuration. Key is the triple, value is the flag.",
),
"extra_rustc_flags": attr.string_list(
doc = "Extra flags to pass to rustc in non-exec configuration",
),
Expand Down
2 changes: 1 addition & 1 deletion rust/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def rust_register_toolchains(
sha256s (str, optional): A dict associating tool subdirectories to sha256 hashes.
extra_target_triples (list, optional): Additional rust-style targets that rust toolchains should support.
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.
extra_exec_rustc_flags (dict, list, optional): Dictionary of target triples to list of extra flags to pass to rustc in exec configuration.
strip_level (dict, dict, optional): Dictionary of target triples to strip config.
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).
versions (list, optional): A list of toolchain versions to download. This parameter only accepts one versions
Expand Down