https://pantsbuild.org/ logo
#general
Title
# general
a

average-sugar-76469

02/05/2019, 9:48 PM
What is the pants way to utilize the output/results_dir values of a given target by another external command?AKA I want to invoke pants from within a shell script and then use the results of the successful pants command.
a

aloof-angle-91616

02/05/2019, 9:49 PM
typically commands like
./pants binary
or
./pants bundle
will drop the result into a dir named
dist/
at the root of your repo. you can also use
./pants run
to invoke your binary as a command directly in many cases.
the output/results_dir exist in order to satisfy products consumed by other tasks
☝️ 1
a

average-sugar-76469

02/05/2019, 11:47 PM
Let’s say all I’m doing is generating some configuration files, would it make sense to install a task into the binary goal just to get a consistent output directory within dist? Is there a pattern to use the dist/ directory output from another goal besides binary?
w

witty-crayon-22786

02/06/2019, 12:07 AM
the "right" way (currently) to have the binary tasks consume some input and publish it for you would be to produce a product that one of the binary tasks consumes to produce that directory
another way might be to just install a task in the binary goal before/after the other binary tasks that fiddles with dist... but that's more likely to break, since the guarantees on layout are loose, and are more defined by the tasks themselves.
if you are trying to get something onto the JVM classpath, a pretty good way to do that is to create a
SimpleCodegenTask
that produces a
Resources
target
✍️ 1
2 Views