I am using `experimental_run_shell_command` or `ex...
# general
i
I am using
experimental_run_shell_command
or
experimental_shell_command
to run a custom command to output a file. is there a way to a. have
experimental_run_shell_command
generate a "file() that I can have placed in the dist folder ? and have Pants know about it ? or b. have
experimental_shell_command
place the file in the "dist" folder and be preserved - currently I am using a "archive" to grab the file from the process Context - I am trying to debug the actual tool. and I am struggling to work out how to 1. run
experimental_run_shell_command
or
experimental_shell_command
and debug, and keep the file it produces. The "file" is the final output of a "package" process (that is my desired outcome)
h
experimental_shell_command
uses Pants's code generation mechanism. So files it creates are placed in the sandbox of downstream processes that need source files
If you want to see those files, you can run
./pants export-codegen path/to/experimental_shell_command:target
export-codegen
is a goal that runs codegen on the specified targets and exports the output under dist/
It's generally used for debugging, because usually the output of codegen is an input to some other process, and that doesn't require writing out to dist
But if you need it in dist, that's the way
i
that us helpful @happy-kitchen-89482 - i sturrgled to work out how to get to the output . was very complicated. this would have been good to be documented somewhere does
Pants
have something similar to
Please
's style of
plz build //path/to:target --shell
which dropped me into a subshell, to inspect the "context" of that code gen, debug it etc
h
There is the
--no-process-cleanup
flag, that preserves the sandbox directories (and logs their paths) so you can inspect them
And there is the
export-codegen
goal to get generated code out of the sandbox and into dist, as mentioned
I'm not too familiar with Please's
--shell
but it sounds like
--no-process-cleanup
is ~similar