Add dependency on cpp toolchain to rules that also depend on cgo_context_data
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
This diff fixes the below issue by adding a cpp toolchain dependency to all the rules that depend on cgo_context_data, so they also have their execution platform constrained to the platforms compatible with the selected cpp toolchain.
Which issues(s) does this PR fix?
Fixes https://github.com/bazelbuild/rules_go/issues/4127
Other notes for review
A more ideal fix for this problem would be to turn cgo_context_data into a toolchain, however that would be a bigger diff.
This is a change that I have wanted to make for a long time, thanks for sending it!
I would be in favor of obtaining cgo_context_info from the toolchain directly, even if that results in a larger diff. I think that it will make the user-visible parts of this change less confusing by not mixing toolchains in different configurations (that of the context dep and that of the current target).
@fmeum Yep that would also work, I don't think I will be able to spend any more time on this for a while though.