Currently Pants’ dependency tracking has file-leve...
# general
l
Currently Pants’ dependency tracking has file-level granularity. I wonder if it's possible to make it even more granular than that...
h
It could be done specifically for Scala, but it's not trivial. It requires deeper integration into the compiler than we currently have.
l
Why?
Currently there is no scalac integration, right? Only the dependency inference stuff based on Scalameta
If you just use Scalameta to write a program that extracts every top level definition of every file into its own file (copying the imports of the original file), then that should be enough. Or am I missing something here?
h
If scalameta has all the information then possibly it could be done without a compiler plugin
The dependencies would need to be annotated with the symbols that cause the dependency, or something
Well, it's more than that, I'm not sure how this would work with cache keys
l
Hmm, now that I think about it it's probably not worth it. Every change to the imports in a file can potentially change the meaning of the code due to implicits. And I would say that most changes also involve changes to imports
So yeah, you'd probably need a compiler plugin to make it worthwhile
h
zinc
(SBT's incremental compiler library, back in the day) had a compiler plugin to do this sort of thing, IIRC
And it was horrifically complicated
I hacked on that code at one point
l
I actually suspect that Pants’ dependency inference is much more broken than we realize right now. I'm looking into that right now.
h
That is certainly possible!
l
I've made a thread about it in #C0D7TNJHL, would you like to comment?