-
Notifications
You must be signed in to change notification settings - Fork 367
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
gazelle_binary: deprecate and remove mode attributes #803
Comments
go_archive_aspect should no longer be used anywhere. It probably should have been deleted before v0.21.0. gazelle_binary has been using it for cross compilation though. With this change, go_transition_rule is used for cross-compilation instead. Cross-compilation in gazelle_binary should be removed entirely in the future though. It requires private functionality in rules_go, and it doesn't seem useful. For bazelbuild/rules_go#2523 Updates bazelbuild#803
go_archive_aspect should no longer be used anywhere. It probably should have been deleted before v0.21.0. gazelle_binary has been using it for cross compilation though. With this change, go_transition_rule is used for cross-compilation instead. Cross-compilation in gazelle_binary should be removed entirely in the future though. It requires private functionality in rules_go, and it doesn't seem useful. For bazelbuild/rules_go#2523 Updates #803
I think that it would not be an issue if
(1) contains all the magic with Please correct me if I am wrong. |
Maybe... whatever depends on the Why not remove these attributes? |
In out team we use executable rule to push build artifacts to s3 (with executable binary written in go) and we build artifacts for both linux and darwin. Since we extended gazelle with some custom logic for typescript, we also do the release management for gazelle binary for both linux and darwin. |
That seems like a pretty customized situation. I don't think that justifies keeping these attributes for everyone, since they're causing a maintenance problem. |
There are a few minor manual modifications that needed to be performed. For example, some `.bzl` files depend on `.bzl` files that are generated outside of this repo and do not presently exist. `@bazel_tools` is a great example of this. Additionally this effort has revealed that bazel gazelle has an explicit dependency on the private parts of rules_go in internal/gazelle_binary.bzl on line 21 where it imports from `go/private:rules/transitions.bzl` which is no longer the path to import from once I created the BUILD file in `go/private/rules`. As a temporary fix for this, I'm included a patch that changes that to point to the new path. I will provide a follow up patch once rules_go has been released to fix it properly in the gazelle repo and then remove the patch from rules_go. Fixed: bazelbuild#2619 Bug: bazelbuild/bazel-skylib#250 Bug: bazelbuild/bazel-gazelle#803
This is blocking bazelbuild/rules_go#2621. |
@jayconrod would you like me to take a look into this? aka is this a blocker AI for me? It's going to take me quite a while to get context on it unfortunately. I've never poked the transitions part of rules_go before. @dududko, it seems to me the standard cross compilation stuff for rules_go is sufficient to meet the use-case you've laid out here. I expect that I'm missing something though. Could you speak about why |
@achew22 I'll try and fix this today. I'd like to get it into the next Gazelle minor release this week. |
This PR removes mode attributes (goos, goarch, race, etc.) from the gazelle_binary rule. These attributes were implemented using private files in rules_go, so supporting them is blocking changes in the rules_go implementation. These attributes should probably never be used. gazelle_binary should generally be built for the host configuration (by 'bazel run' or 'bazel build' without configuration flags). If a binary is still needed in a different configuration, that may still be accomplished with command-line flags like --platforms or --@io_bazel_rules_go//go/config:race. Fixes bazelbuild#803
This PR removes mode attributes (goos, goarch, race, etc.) from the gazelle_binary rule. These attributes were implemented using private files in rules_go, so supporting them is blocking changes in the rules_go implementation. These attributes should probably never be used. gazelle_binary should generally be built for the host configuration (by 'bazel run' or 'bazel build' without configuration flags). If a binary is still needed in a different configuration, that may still be accomplished with command-line flags like --platforms or --@io_bazel_rules_go//go/config:race. Fixes #803
There are a few minor manual modifications that needed to be performed. For example, some `.bzl` files depend on `.bzl` files that are generated outside of this repo and do not presently exist. `@bazel_tools` is a great example of this. Additionally this effort has revealed that bazel gazelle has an explicit dependency on the private parts of rules_go in internal/gazelle_binary.bzl on line 21 where it imports from `go/private:rules/transitions.bzl` which is no longer the path to import from once I created the BUILD file in `go/private/rules`. As a temporary fix for this, I'm included a patch that changes that to point to the new path. I will provide a follow up patch once rules_go has been released to fix it properly in the gazelle repo and then remove the patch from rules_go. Fixed: bazelbuild#2619 Bug: bazelbuild/bazel-skylib#250 Bug: bazelbuild/bazel-gazelle#803 Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
There are a few minor manual modifications that needed to be performed. For example, some `.bzl` files depend on `.bzl` files that are generated outside of this repo and do not presently exist. `@bazel_tools` is a great example of this. Additionally this effort has revealed that bazel gazelle has an explicit dependency on the private parts of rules_go in internal/gazelle_binary.bzl on line 21 where it imports from `go/private:rules/transitions.bzl` which is no longer the path to import from once I created the BUILD file in `go/private/rules`. As a temporary fix for this, I'm included a patch that changes that to point to the new path. I will provide a follow up patch once rules_go has been released to fix it properly in the gazelle repo and then remove the patch from rules_go. Fixed: bazelbuild#2619 Bug: bazelbuild/bazel-skylib#250 Bug: bazelbuild/bazel-gazelle#803 Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
There are a few minor manual modifications that needed to be performed. For example, some `.bzl` files depend on `.bzl` files that are generated outside of this repo and do not presently exist. `@bazel_tools` is a great example of this. Additionally this effort has revealed that bazel gazelle has an explicit dependency on the private parts of rules_go in internal/gazelle_binary.bzl on line 21 where it imports from `go/private:rules/transitions.bzl` which is no longer the path to import from once I created the BUILD file in `go/private/rules`. As a temporary fix for this, I'm included a patch that changes that to point to the new path. I will provide a follow up patch once rules_go has been released to fix it properly in the gazelle repo and then remove the patch from rules_go. Fixed: bazelbuild#2619 Bug: bazelbuild/bazel-skylib#250 Bug: bazelbuild/bazel-gazelle#803 Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
There are a few minor manual modifications that needed to be performed. For example, some `.bzl` files depend on `.bzl` files that are generated outside of this repo and do not presently exist. `@bazel_tools` is a great example of this. Additionally this effort has revealed that bazel gazelle has an explicit dependency on the private parts of rules_go in internal/gazelle_binary.bzl on line 21 where it imports from `go/private:rules/transitions.bzl` which is no longer the path to import from once I created the BUILD file in `go/private/rules`. As a temporary fix for this, I'm included a patch that changes that to point to the new path. I will provide a follow up patch once rules_go has been released to fix it properly in the gazelle repo and then remove the patch from rules_go. Fixed: bazelbuild#2619 Bug: bazelbuild/bazel-skylib#250 Bug: bazelbuild/bazel-gazelle#803 Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
There are a few minor manual modifications that needed to be performed. For example, some `.bzl` files depend on `.bzl` files that are generated outside of this repo and do not presently exist. `@bazel_tools` is a great example of this. Additionally this effort has revealed that bazel gazelle has an explicit dependency on the private parts of rules_go in internal/gazelle_binary.bzl on line 21 where it imports from `go/private:rules/transitions.bzl` which is no longer the path to import from once I created the BUILD file in `go/private/rules`. As a temporary fix for this, I'm included a patch that changes that to point to the new path. I will provide a follow up patch once rules_go has been released to fix it properly in the gazelle repo and then remove the patch from rules_go. Fixed: bazelbuild#2619 Bug: bazelbuild/bazel-skylib#250 Bug: bazelbuild/bazel-gazelle#803 Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
There are a few minor manual modifications that needed to be performed. For example, some .bzl files depend on .bzl files that are generated outside of this repo and do not presently exist. @bazel_tools is a great example of this. Additionally this effort has revealed that bazel gazelle has an explicit dependency on the private parts of rules_go in internal/gazelle_binary.bzl on line 21 where it imports from go/private:rules/transitions.bzl which is no longer the path to import from once I created the BUILD file in go/private/rules. As a temporary fix for this, I'm included a patch that changes that to point to the new path. I will provide a follow up patch once rules_go has been released to fix it properly in the gazelle repo and then remove the patch from rules_go. Fixed: #2619 Bug: bazelbuild/bazel-skylib#250 Bug: bazelbuild/bazel-gazelle#803
gazelle_binary
currently supports the attributespure
,static
,msan
,race
,goos
, andgoarch
.Supporting these attributes requires either
go_archive_aspect
orgo_transition_binary
, both of which are internal to rules_go. Using them in Gazelle makes it difficult to changego_transition_binary
safely.None of these attributes should be necessary.
gazelle_binary
should almost always be built for the host platform in the default configuration. If it's necessary to build for a different configuration, that can be done by setting the relevant build settings on the command line (for example,--@io_bazel_rules_go//go/config:static
) or by targeting an appropriate platform.The text was updated successfully, but these errors were encountered: