Hi all, is there a way for `./pants tailor` to pic...
# general
a
Hi all, is there a way for
./pants tailor
to pick up newly built objects and add them to the BUILD files dynamically? i.e. I build a separate shared object and I want it to get picked up by pants so it gets included in the resulting pex
h
Added as a
resource
target, you mean?
a
yup!
It works manually
But I was wondering if there was a way to streamline that process in CI
Ignore this, I figured it out!
h
Hi! You could write a
tailor
plugin. What heuristic would you use? For example, is it based on a file name?
👀 1
a
Yes, filename based
h
awesome, there's lots of precedent for how to do that. See https://www.pantsbuild.org/docs/plugins-overview in general for how to get set up with a plugin Then you'll basically copy and paste something like this file 🙂 https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/codegen/protobuf/tailor.py You can honestly probably skip most the docs about the Rules API and monkey-see-monkey-do - this is one of the more cut-and-paste plugins
🙌 1
you can also ignore the
Protoc
subsystem stuff, like
protoc.tailor
I think we changed some tailor APIs in 2.12, so you'll want to either use a newer version of Pants or change in GitHub the branch to see an earlier version of this file
a
Awesome, I’ll give this a go. Thank you @hundreds-father-404!
❤️ 1