Hey all! I was wondering how to accomplish somethi...
# general
Hey all! I was wondering how to accomplish something like bazel's new_local_repository in pants -- in particular: • I have some system libraries that were built/installed without pants • I want to tell pants that they exist, so that a pants target can depend on them How would I do this in pants? Or is there an alternative way to accomplish the same thing?
@witty-crayon-22786 any ideas here?
@loud-coat-45270 are these python libraries? native system libraries?
Trying to figure out what it would mean for a target to depend on them
we don’t have a facility for declaring explicit dependencies on files outside of the repo, although more of that will come soon. for now, you would essentially need to expose those system libraries to your build using environment variables, such as: https://www.pantsbuild.org/docs/reference-subprocess-environment … despite the name of that option, it is essentially only exposed to the building of 3rdparty python dependencies
that currently means though that those values will not be deeply fingerprinted, so you would want to e.g. include a version string there as well. we’re hoping to schedule some work around https://github.com/pantsbuild/pants/issues/12203 to support adding more structure to these types of variables, so that they can be deeply fingerprinted.
Thanks @happy-kitchen-89482 @witty-crayon-22786! What if the external files are protobuf definitions (
I was hoping to import them in another in-repo proto file (that i am building with the
I was playing around the tutorials for custom plugins: • Following https://www.pantsbuild.org/docs/plugins-codegen, I think I have a rule that extracts the files I care about • It returns a
with the
files I need • I have a subclass of
output_field = ProtobufSourceField
• If I run
pants export-codegen //:my_target
, I get the
files inside
• However, I'm not exactly sure how to hook this up to my
target. I tried passing
as a dependency (no effect) and as a source (threw an error)
mmm. there is support for doing that via a git submodule (by marking it as a subproject_root), but as it stands, the
files for the
would already need to live in the repo that you git-submoduled.
you shouldn’t need to create a new plugin though… what was the plugin going to be doing?
Can you resend the link for
? I think it's broken
I think there are some quirks with this project that are going to make the submodule approach difficult
To give you some more details: • The project that produces the protos is using bazel. We have a py_library target where the proto definitions are data, and we can build a wheel that contains python source code, some c/c++ binaries, and the proto definitions • If this wheel was pure python, then I think I could just add the file to my pants repo and reference it in my
? I'm just not sure how to tell pants about the non-python files, which should be extractable from the wheel (since it is just a zip file after all)