https://pantsbuild.org/ logo
#development
Title
# development
r

refined-dusk-58376

12/29/2020, 6:27 AM
So how would one copy files from one location to another using a
Digest
and
Snapshot
in the plugin API?
h

hundreds-father-404

12/29/2020, 7:07 AM
Hello! #plugins might be more relevant, but happy to answer here What do you mean precisely by copy files from one location to another here? For example, what are the two locations you're thinking?
r

refined-dusk-58376

12/29/2020, 7:45 AM
I'm trying to implement this logic in a plugin: 1. Find all folders with a given glob inside of a set of folders. 2. If you've found the folders, copy the contents to another folder. I'm basically trying to have some sort of auto sorting method for kubernetes FaaS functions. My first instinct is to use the normal Path method on my own CLI then call that CLI when running the code locally.
h

hundreds-father-404

12/29/2020, 2:56 PM
For both of those, are they within the project's build root, or could be outside the build root? We have AddPrefix and RemovePrefix which might work. And you can use PathGlobs to locate the files. This might not cover your use case though If you stick with pathlib, you can make your rule uncacheable to force it to rerun. Goal rules are also uncacheable already, so if you're adding a new goal, you're good to use pathlib