Add go_binary out attribute for custom file names#1393
Add go_binary out attribute for custom file names#1393jayconrod merged 1 commit intobazel-contrib:masterfrom
Conversation
go_binary now has an "out" attribute which allows users to set the output filename for the generated executable. When set, go_binary will write this file without mode-specific directory prefixes, without linkmode-specific prefixes, and without platform-specific extensions. Fixes bazel-contrib#1239
c2267f2 to
44d78de
Compare
|
How is this different from the |
|
I don't think this completely replaces |
|
It seems pretty awkward to have executables on Windows written without I guess I don't understand why any value of |
|
So just to throw out a random example, files in Linux /lib directories are supposed to be named with a version after the extension, e.g.,
|
|
Isn't the version usually part of the pre-suffix name? Looking at my Also, the general-purpose escape hatch is |
|
basename was meant as an escape hatch, but it's not really sufficient for any useful case, we should probably deprecate it's use. |
The most recent issue was bazel-contrib/rules_go#1393, which landed on March 21st [1]. That code went out with rules_go v0.11.0: rules_go$ git log --oneline -1 361556b 361556b Add go_binary out attribute for custom file names (openshift#1393) rules_go$ git describe --contains 361556b 0.11.0~26 I'm bumping to 0.12.1 as the most-recent tagged release [2] (although 0.13.0 was cut two days ago, and seems to just be missing a tag [3]). While I'm at it, I've bumped bazel-gazelle to it's most-recent tagged release [4]. I'm not sure if the Bazel libraries are compatible between minor releases, but they seem to be versioned together so having 0.12.x versions of both seemed safest. [1]: bazel-contrib/rules_go#1393 (comment) [2]: https://github.com/bazelbuild/rules_go/releases [3]: bazel-contrib/rules_go#1584 (comment) [4]: https://github.com/bazelbuild/bazel-gazelle/releases
Before that the users had to rely on patching the actual wheel files and uploading them as different versions to internal artifact stores if they needed to modify the wheel dependencies. This is very common when breaking dependency cycles in `pytorch` or `apache-airflow` packages. With this feature we can support patching external PyPI dependencies via pip.override tag class to fix package dependencies and/or a broken `RECORD` metadata file. Overall design: * Split the `whl_installer` CLI into two parts - downloading and extracting. Merged in bazel-contrib#1487. * Add a starlark function which extracts the downloaded wheel applies patches and repackages a wheel (so that the extraction part works as before). * Add a `override` tag_class to the `pip` extension and allow users to pass patches to be applied to specific wheel files. * Only the root module is allowed to apply patches. This is to avoid far away modules modifying the code of other modules and conflicts between modules and their patches. Patches have to be in `unified-diff` format. Related bazel-contrib#1076, bazel-contrib#1166, bazel-contrib#1120
go_binary now has an "out" attribute which allows users to set the
output filename for the generated executable. When set, go_binary will
write this file without mode-specific directory prefixes, without
linkmode-specific prefixes, and without platform-specific extensions.
Fixes #1239