-
-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bind cross-versions to the context of the originating module (#1574)
`mill.scalalib.Dep` represents a generic dependency, which include potential cross-compilation properties. E.g. it knows whether it is specific to a `platform` but it does not specify the platform. And it knows whether it is specific to a Scala binary or full version, but it does not specify the exact Scala version. This mean we can define a `Dep` without knowing those context. In this PR I introduce a new type `mill.scalalib.BoundDep`, which is kind-of a `Dep` where all these potential open context bindings are bound to an exact context. There is no further cross-resolution necessary nor possible. By having a separate type, we always know with what kind of dependency we work. Also, we can be explicit about the "when" the binding happens. When mixing dependencies of multiple modules, we also mix contexts. Until this PR, we had no way to get it right, as `Dep`s could come from different contexts. Now, we can safely mix `BoundDep`s as they are already context-bound. We could encode the bound-state in the `Dep`, but this would result in only a dynamic property. To ensure a resolved state, we always would need to run some runtime checks. Also, it could lead to situations, where we need a resolved dep, but have not the proper context to do the resolution. This is exactly what I implemented in the initial attempt, but it didn't worked out very well. With the separated types, it is always clear from the API, what kind of dependency we expect. We could also just resolve to a `coursier.Dependency`, but that would loose the `force` flag. Also, we want to rather decouple our API from the coursier API, which seem easier when we avoid to hand over direct coursier API to the user. I `@deprecated` the existing `CoursierModule.resolveCoursierDependency` and bases the new `CoursierModule.bindDependency` on this old task. This should ease the transition. It's up for revisit, when we decouple from coursier API altogether. This fixes #860.
- Loading branch information
Showing
25 changed files
with
527 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.