-
-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BOM support for compileIvyDeps, runIvyDeps, and BOM test dependencies #4068
base: main
Are you sure you want to change the base?
Conversation
Conflicts: docs/modules/ROOT/pages/fundamentals/library-deps.adoc example/fundamentals/library-deps/bom-1-external-bom/build.mill example/fundamentals/library-deps/bom-2-dependency-management/build.mill scalalib/src/mill/scalalib/JavaModule.scala scalalib/src/mill/scalalib/PublishModule.scala scalalib/test/src/mill/scalalib/BomTests.scala
Conflicts: scalalib/src/mill/scalalib/JavaModule.scala scalalib/src/mill/scalalib/PublishModule.scala scalalib/test/src/mill/scalalib/BomTests.scala
This comment was marked as outdated.
This comment was marked as outdated.
@alexarchambault not sure if I did the merge right, but seems like it might need more fixes to get a green CI |
def extraBomIvyDeps: Task[Agg[BomDependency]] = Task.Anon { Agg.empty[BomDependency] } | ||
|
||
/** | ||
* Dependency management entries that are not meant to be overridden or changed by users. | ||
* | ||
* This is mainly used to add dependency management entries of the main module to its test | ||
* modules. | ||
*/ | ||
def extraDepManagement: Task[Agg[Dep]] = Task.Anon { Agg.empty[Dep] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these really need to be Task.Anon
s? Not sure about BomDependency
, but at least Agg[Dep]
is serializable and can be a normal Task
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be made normal Task
s, yes
allBomIvyDeps().toSeq.map(_.withConfig(Configuration.compile)) ++ extraBomIvyDeps().toSeq | ||
val depMgmt = processedDependencyManagement( | ||
(extraDepManagement().toSeq ++ depManagement().toSeq) | ||
.map(bindDependency()) | ||
.map(_.dep) | ||
) | ||
|
||
addBoms(bomDeps0, depMgmt, overrideVersions = overrideVersions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we refactor processDependency
, processCompileDependency
, and processRunDependency
to share the logic between them via an anonymous task. That will help make it easier to see the core differences between them.
I'm also not clear about the differences here:
processCompileDependency
usescompileDepManagement()
, andprocessRunDependency
usesrunDepManagement
processDependency
andprocessCompileDependency
both useextraDepManagement
butprocessRunDependency
does not. Why?- Only
processDependency
seems to useextraBomIvyDeps
, whileprocessCompileDependency
andprocessRunDependency
do not. Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying a different approach to this PR's changes in #4145. Rebasing the PR here on top of it should get rid of these additional methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also simplify the way BOMs are handled when taking scopes into account. I've been having issues reconciling Mill's compileIvyDeps
/ ivyDeps
/ runIvyDeps
(where scopes are known beforehand) with how scopes are handled in BOMs (not known beforehand, dependencies from all scopes are mixed, and BOMs can change the scope if it's undefined).
* added to them. This should be used when propagating the dependencies transitively | ||
* to other modules. | ||
*/ | ||
def processedCompileIvyDeps: Task[Agg[BoundDep]] = Task.Anon { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make these normal Task
s rather than Task.Anon
s?
Left some comments. @alexarchambault also please fill out the PR description, that will make it easier to review and maintain since we won't need to reverse engineer what you already have in your head |
Checking what the CI says, this embeds #3924 for now