-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
feat: Implement binary_toolchain #875
base: main
Are you sure you want to change the base?
Conversation
f160c2a
to
f586477
Compare
f586477
to
bb34827
Compare
853bd53
to
09874f1
Compare
09874f1
to
e49384b
Compare
e49384b
to
6fcde2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems very similar to bazel-contrib/rules_oci#590 by @EdSchouten
I wonder if bazel-lib could provide the abstraction that's needed for this case globally. We should bike-shed on this name because "BinaryInfo" can also apply to a binary run as an action on the exec platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree we should have the abstraction shared. binary_toolchain is my answer. While there are still some decision we want to make which are not clear to me yet.
I think ideally we only limit the scope of the solution to 2) in bazelbuild/bazel#19645 (comment)
Then we only need to have one toolchain_type for the binary. Using jq as an example.
We will need
toolchain_type(name = "jq_binary_toolchain_type") # User should register different binary to this toolchain
binary_toolchain(name="jq_linux_amd64", binary="@jq_linux_amd64")
toolchain(
name = "toolchain_linux_amd64",
toolchain = ":jq_linux_amd64",
toolchain_type = :jq_binary_toolchain_type",
target_compatible_with = linux_amd64,
)
resolved_binary(name = "resolved_jq_binary") # This resolves to a binary that run on the target platform
# The jq_toolchain_type will be made private regarding registering, i.e. we only register jq_toolchain to it and do not allow user to register new toolchain to jq_toolchain_type.
toolchain_type(name = "jq_toolchain_type")
jq_toolchain(name = "jq_toolchain") # jq_toolchain use resolved_jq_binary with cfg=exec
toolchain(
name = "toolchain",
toolchain = ":jq_toolchain",
toolchain_type = :jq_toolchain_type",
)
See #747