cool-easter-32542
04/03/2023, 2:16 PMpants package ::. This fills up dist with all of the goodies. However, instead of having foo.tar.gz I'd like to have foo-VERSION.tar.gz so that everything is ready for uploading publishing. (Where version is maybe a constant like v.1.2.3 or just the git sha.)
output_path can almost do that, but then I have to re-implement the / --> . logic.
output_path
type: str | None
default: None
Where the built asset should be located.
If undefined, this will use the path to the BUILD file, followed by the target name. For example, `src/python/project:app`
would be `src.python.project/app.ext`.
When running `pants package`, this path will be prefixed by `--distdir` (e.g. `dist/`).
Warning: setting this value risks naming collisions with other package targets you may have.
Describe the solution you'd like
Give all "just a file" artifacts an output_name to go along with output_path, the "path to output" logic then looks something like:
• default: build_file_dir.replace('/', '.') + name
• if output_name is set: build_file_dir.replace('/', '.') + output_name
• if output_path is set: `output_Path
Describe alternatives you've considered
• set the target name to something dynamic like "foo + git_sha". Quick and dirty but then the name changes on every commit.
• Write a versioned_tarball macro.
Additional context
Doing it with a macro isn't that bad. But I feel like there is some fundamental inconsistency where some "packages" like docker or python_distributions have a separate "version", but others do not.
spinoff from: https://pantsbuild.slack.com/archives/C0D7TNJHL/p1680240146011409
pantsbuild/pants