Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying exec and target compatibility constraints #1971

Merged
merged 3 commits into from
May 19, 2023

Conversation

illicitonion
Copy link
Collaborator

Extra target triples may only be appropriate for specific platforms (e.g. if you register a toolchain with the exec_triple x86_64-unknown-linux-gnu with an extra target triple of x86_64-unknown-linux-musl, you may want differing target_compatible_with values for each of those two target triples.

This allows for specifying explicit exec_compatible_with lists per toolchain (which was already supported by rust_toolchain_repository just not proxied by rust_repository_set), and explicit target_compatible_with lists, both for the default triple and for extra ones.

I'm not 100% sure on our pre-existing assumption that every toolchain supports compiling targeting its own exec platform, i.e. the '[exec_triple]' part of

for target_triple in [exec_triple] + extra_target_triples:
but it does generally hold, and supplying a way of removing that default assumption is definitely a separate PR for another day if it becomes relevant to anyone.

Extra target triples may only be appropriate for specific platforms
(e.g. if you register a toolchain with the exec_triple
`x86_64-unknown-linux-gnu` with an extra target triple of
`x86_64-unknown-linux-musl`, you may want differing
`target_compatible_with` values for each of those two target triples.

This allows for specifying explicit `exec_compatible_with` lists per
toolchain (which was already supported by `rust_toolchain_repository`
just not proxied by `rust_repository_set`), and explicit
`target_compatible_with` lists, both for the default triple and for
extra ones.

I'm not 100% sure on our pre-existing assumption that every toolchain
supports compiling targeting its own exec platform, i.e. the
'`[exec_triple]`' part of https:/bazelbuild/rules_rust/blob/937e63399b111a6d7ee53b187e4d113300b089e9/rust/repositories.bzl#L845
but it _does_ generally hold, and supplying a way of removing that
default assumption is definitely a separate PR for another day if it
becomes relevant to anyone.
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this seems fine but it would be nice to see an example of it somewhere to both inform users of how they can be more descriptive with their toolchains while also acting as a regression test.

@illicitonion illicitonion merged commit 4aaa6de into bazelbuild:main May 19, 2023
@illicitonion
Copy link
Collaborator Author

Thanks! I'll try to get the relevant pieces open sourced so we could have a working example :) Unfortunately toolchains are a bit fiddly in general, but hopefully this shouldn't be too hard to put together :)

Silcet pushed a commit to Silcet/rules_rust that referenced this pull request Jul 10, 2023
…d#1971)

Extra target triples may only be appropriate for specific platforms
(e.g. if you register a toolchain with the exec_triple
`x86_64-unknown-linux-gnu` with an extra target triple of
`x86_64-unknown-linux-musl`, you may want differing
`target_compatible_with` values for each of those two target triples.

This allows for specifying explicit `exec_compatible_with` lists per
toolchain (which was already supported by `rust_toolchain_repository`
just not proxied by `rust_repository_set`), and explicit
`target_compatible_with` lists, both for the default triple and for
extra ones.

I'm not 100% sure on our pre-existing assumption that every toolchain
supports compiling targeting its own exec platform, i.e. the
'`[exec_triple]`' part of https:/bazelbuild/rules_rust/blob/937e63399b111a6d7ee53b187e4d113300b089e9/rust/repositories.bzl#L845
but it _does_ generally hold, and supplying a way of removing that
default assumption is definitely a separate PR for another day if it
becomes relevant to anyone.
Silcet pushed a commit to Silcet/rules_rust that referenced this pull request Jul 10, 2023
…d#1971)

Extra target triples may only be appropriate for specific platforms
(e.g. if you register a toolchain with the exec_triple
`x86_64-unknown-linux-gnu` with an extra target triple of
`x86_64-unknown-linux-musl`, you may want differing
`target_compatible_with` values for each of those two target triples.

This allows for specifying explicit `exec_compatible_with` lists per
toolchain (which was already supported by `rust_toolchain_repository`
just not proxied by `rust_repository_set`), and explicit
`target_compatible_with` lists, both for the default triple and for
extra ones.

I'm not 100% sure on our pre-existing assumption that every toolchain
supports compiling targeting its own exec platform, i.e. the
'`[exec_triple]`' part of https:/bazelbuild/rules_rust/blob/937e63399b111a6d7ee53b187e4d113300b089e9/rust/repositories.bzl#L845
but it _does_ generally hold, and supplying a way of removing that
default assumption is definitely a separate PR for another day if it
becomes relevant to anyone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants