hundreds-father-404
01/20/2022, 6:20 PMhundreds-father-404
01/20/2022, 6:20 PMcoursier fetch
you use Get(CoursierResolvedLockfile, GenerateJVMLockfile)
rather than Get(CoursierResolvedLockfile, ArtifactRequirements)
. That causes a cycle between jvm/goals/lockfile.py
and jvm/resolve/coursier_fetch.py
.
I'm thinking it might make sense to move that coursier code into goals/lockfile.py
. We do still have a lot of other code for how to build a ClasspathEntry
for user code. That seems to make sense not living in goals/lockfile.py
, maybe staying where it isancient-vegetable-10556
01/20/2022, 6:23 PMcoursier_fetch.py
is too big and complicated (https://github.com/pantsbuild/pants/pull/14164)!hundreds-father-404
01/20/2022, 6:27 PMCoursierResolvedLockfile
(which is huge) into that common.py
file
2. move the rule to go from GenerateJvmLockfile -> CoursierResolvedLockfile
into goals/lockfile.py
. Note that no one needs to import that rule
3. maybe rename coursier_fetch.py
to somehow express it's about user code & ClasspathEntry
. It's not actually doing any fetching. It's the user-code version of jvm_tool_base.py
ancient-vegetable-10556
01/20/2022, 6:29 PMancient-vegetable-10556
01/20/2022, 6:38 PMcoursier_resolve_lockfile
in coursier_fetch.py
is the piece of code used to generate both user and tool lockfiles; coursier_fetch_one_coord
actually fetches the remote artifact when consuming the lockfile. Both use coursier fetch
under the hood (though the script that says fetch
is in coursier_setup.py
)ancient-vegetable-10556
01/20/2022, 6:39 PMJvmToolBase
doesn’t call coursier itself. That is delegated to coursier_fetch
hundreds-father-404
01/20/2022, 6:41 PMcoursier_resolve_lockfile
into jvm/goals/lockfile.py
. This will be necessary for us to change the rule to be GenerateJVMLockfile -> CoursierResolvedLockfile
rather than ArtifactRequirements -> CoursierResolvedLockfile
, because we define GenerateJVMLockfile
in lockfile.py
so would have an import cycleancient-vegetable-10556
01/20/2022, 6:42 PMancient-vegetable-10556
01/20/2022, 6:44 PMCoursierResolvedLockfile
is – generally speaking – more generic than is justifiable (compared with how Pants likes to use types, anyway)ancient-vegetable-10556
01/20/2022, 6:45 PMhundreds-father-404
01/20/2022, 6:45 PMCoursierResolvedLockfile
works really well for what it claims to do: an in-memory representation of a lockfile, regardless of how you got it. Where it gets confusing is that there are multiple ways to get that type via the engineancient-vegetable-10556
01/20/2022, 6:45 PMancient-vegetable-10556
01/20/2022, 6:46 PMancient-vegetable-10556
01/20/2022, 6:46 PMhundreds-father-404
01/20/2022, 7:25 PMcoursier_fetch.py
with only code related to user requirements, whereas goals/lockfile.py
is highly generic code for resolving/generating a lockfile with Coursier. Like how python/goals/lockfile.py
has that but with Poetry
Only part I'm stuck on is what to rename coursier_fetch.py
. Maybe jvm/resolves/user_resolves.py
?