Hi. I have a question about pants and Scala. We w...
# general
Hi. I have a question about pants and Scala. We want to remove unused dependencies from our BUILD files to speed-up builds. We're using Scala and planning to use strict deps. I don't see anything which helps with this in Pants options, but maybe I miss something or there's a tool which already does this? The closest thing is "pants dep-usage", but it's not exactly what we need. Or, maybe, there's a tool which can construct BUILD files by analyzing .scala + .java files in a directory? If there are no such tools, what do you think is the best approach to build such a tool? Maybe we can use some info which pants already provides?
would be the recommended tool, yea.
Check the options: if you pass
, it will give you an annotated dep graph
@flaky-actor-39732: ^
I see, looks like we can almost safely remove dependencies marked with
"dependency_type": "unused"
and check those with small
. All we need is just simple too to sort/filter JSON - which is quite easy to implement. Thanks, I somehow missed
flag and it's exactly what we need.
Yep: "almost safely" is the key, heh. There will be false positives.
https://github.com/foursquare/fsqio/tree/master/src/python/fsqio/pants/buildgen can construct BUILD files based on your Scala files. i can’t recall if it supports Java. i used it at foursquare in a past life and we’ve been using it with no issues at my current company
well, it was a bit of a struggle to get set up, but has worked well since…happy to help if i can
@eager-raincoat-57702: nice! we've had plans for a while to bake that in via https://github.com/pantsbuild/pants/issues/6449 , and the time is almost nigh
...beyond "almost nigh", i should say: "it's possible now"
can see the linked branch for a rough idea.
there would be rough edges, but it's a thing that i think that the whole community wants to bake in, so can expect folks to be eager to help
cc @curved-vase-73456 might find this interesting
yeah nice, if this allows dropping archaic buildgen plugins that we support + adding our webapp to use pants methods in order to automatically detect via dependency tree which checks/tests we should run that’d be awesome!
*“we” as in “we in our company”
very exciting 😃
i added a comment to the ticket.
and if you haven't seen the talk i gave about this a while back, what i'll say is: it's still accurate: https://twitter.com/stuhood/status/992515042460368896