Description
Describe the bug
When someone specifies explicit output_files
or output_directories
in experimental_shell_command
(esc
) that don't match, this is probably an error in the specification of esc
(either command or outputs), but this isn't directly caught, and may only pop-up as downstream errors and/or confusion.
Example: https://gist.github.com/huonw/c95933eeb581cdb669324d12a0edd3b2
experimental_shell_command(
name="missing-output",
command="true",
tools=[],
output_files=["doesnt-exist.txt"]
)
archive(name="archive", files=[":missing-output"], format="zip")
experimental_run_shell_command(
name="run",
command="ls -l $CHROOT",
execution_dependencies=[":missing-output"],
)
Running
git clone https://gist.github.com/huonw/c95933eeb581cdb669324d12a0edd3b2
cd c95933eeb581cdb669324d12a0edd3b2
pants version
#> ...
#> 2.16.0.dev6
# packaging fails with a fairly obtuse error
pants package //:archive
#> ...
#> ProcessExecutionFailure: Process 'Create archive.zip' failed with exit code 12.
#> stdout:
#>
#> zip error: Nothing to do! (archive.zip)
#> ...
# running doesn't have the expected files (something more interesting than `ls` would likely 'explode')
pants run //:run
#> total 0
Some ideas (for cacheable esc
, where filesystem output is all that's relevant, this may not apply for non-cacheable ones, if/when they exist), all the examples are against output_files=["foo.txt", "*.log"]
:
- be loose: at least one element of
output_files
andoutput_directories
matches (so that the output is non-empty). For example: just havingbar.log
would be okay. - be strict: and require that every element of
output_files
andoutput_directories
match at least one element. For example: having bothfoo.txt
andbar.log
would be okay. - something in the middle, like requiring that non-globs match, but globs can match zero. For example: just having
foo.txt
would be okay.
The same presumably applies to output_directories
but there's an additional question: is having only an empty directory acceptable? (For example: output_directories=["dir/"], output_files=[]
and dir/
is empty.)
Pants version
2.16.0.dev6
OS
macOS
Additional info
N/A
Activity