is there any way to filter a list of `ClasspathEnt...
# development
f
is there any way to filter a list of
ClasspathEntry
down to just those generated from a
jvm_artifact
?
context: exposing third-party deps in BSP
a
Not immediately, @fast-nail-55400. I would not object to adding a
provenance
field to
ClasspathEntry
to facilitate that though
and then each thing that produces a
ClasspathEntry
can mark what produced it
(presumably it’d be a
type[ClasspathEntryRequest]
)
f
I’d also need to extract maven coordinates from the ClasspathEntry
this all assumes that using
ClasspathEntryRequest
to find this data is the right way to do it
w
could flip it around and filter to things that you know are
jvm_artifacts
, and then request entries for them
f
I thought about that and played with some code to do so but it gets complicated. The code needs request transitive targets from a
CoarsenedTarget
by using
TransitiveTargetsRequest
on the members of the
CoarsenedTarget
— then convert them back to
CoarsenedTarget
in order to use
ClasspathEntryRequest.for_targets
— the back and forth seems pointless for want of a better API
versus having a way to classify a
ClasspathEntryRequest
and filter out the ones not needed. may even be a way to implement classpath scopes eventually.
(assuming for the sake of this idea that scope was associated with the
jvm_artifact
and not the dependency edge)
w
after requesting the classpath entry is too late to filter by scope i think… would want to filter sooner
otherwise you’re building things you don’t need
but haven’t thought about it much.
f
hmm good point. will need more thought then.
back to getting just jvm_artifacts, maybe there needs to be a
for_classpath_entry_request_types=
attribute like what codegen has with
for_sources_types
(the context here is scala/java BSP rules on top of https://github.com/pantsbuild/pants/pull/14750 )