-
-
Notifications
You must be signed in to change notification settings - Fork 661
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
[FR/Proposal] Support use of multiple SDK versions in the same bazel workspace #3202
Comments
Being able to select between Go SDK versions sounds very useful. Thanks for the suggestion and willingness to implement it! I would prefer a slightly more general approach. What do you think about the following? Also @linzhp @achew22.
I can offer assistance along the way. |
+1 to @fmeum. I think moving to a "more standard" configuration would probably be a good path forward. If we were using toolchains in the more traditional sense, it would be possible to add the toolchain as a transition in a rule external to |
@fmeum That makes sense to me. I understand # 1 and # 2. I'm a little confused what you mean by a separate rule for # 3. |
I'm thinking of a rule that allows the following: go_binary(
name = "foo",
...
)
go_cross(
name = "special_foo",
target = "foo",
platform = "//:my_custom_platform",
sdk_version = "1.17",
) The name and attributes are of course TBD, but the general concept should be a simple wrapper around a |
I'm planning on implementing this soon, if there are no other attempts yet. |
@kmicklas Thanks! Let me know in case you get stuck, happy to provide guidance. |
I have an attempt, that I can clean up and put out in the next couple days, unless your timeline is faster |
Thanks @JamesMBartlett! You beat me to it. |
thank you @JamesMBartlett we are looking for it |
I didn't see an FR issue template and the bug template didn't seem relevant, so sorry for not using the template.
Use Case
Pixie would like to be able to build go libraries/binaries with different versions of the go SDK. Pixie has to work with multiple versions of user's go binaries, so we use go binaries built by different versions of go as data inputs to our tests to ensure our code can interact with go binaries regardless of what version built them.
Proposal
I've created a patch of rules_go, that allows specifying
gosdk
(as a label to the GoSDK provider) on anygo_binary
orgo_test
target. Then using a bazel transition all of that targets dependencies will be built with the given SDK. By default the firstgo_download_sdk/go_host_sdk/go_.*_sdk
rule will become the default SDK to use for all rules that don't explicitly specifygosdk
.I've attached a link to the patch below, if you are OK with this sort of change I can add tests, open a PR and continue review there, but I figured I should start a discussion here first since its a non-trivial change. (Note that this patch is based off of v0.32, but I can easily rebase for a PR)
Patch
You can also see this patch in action in our build files here
Also, I'm happy to work on a different solution to building with multiple SDK versions, if people are unhappy with this solution.
Related Issues
This feature request is similar to #2527.
The text was updated successfully, but these errors were encountered: