Skip to content

Commit

Permalink
Deprecate resolveFilter stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault committed Dec 18, 2024
1 parent 59d5179 commit 7b4619f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ trait ScoverageModule extends ScalaModule { outer: ScalaModule =>

millProjectModule(
workerArtifact,
repositoriesTask(),
resolveFilter = _.toString.contains(workerArtifact)
repositoriesTask()
)
}

Expand Down
3 changes: 1 addition & 2 deletions kotlinlib/src/mill/kotlinlib/KotlinModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ trait KotlinModule extends JavaModule { outer =>
private[kotlinlib] def kotlinWorkerClasspath = Task {
millProjectModule(
"mill-kotlinlib-worker-impl",
repositoriesTask(),
resolveFilter = _.toString.contains("mill-kotlinlib-worker-impl")
repositoriesTask()
)
}

Expand Down
17 changes: 10 additions & 7 deletions main/util/src/mill/util/CoursierSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ trait CoursierSupport {
* We do not bother breaking this out into the separate ZincWorkerApi classpath,
* because Coursier is already bundled with mill/Ammonite to support the
* `import $ivy` syntax.
*
* Avoid using `deprecatedResolveFilter` if you can. As a substitute, use exclusions
* (or upfront, mark some dependencies as provided aka compile-time when you publish them),
* or as a last resort, manually filter the file sequence returned by this function.
*/
def resolveDependencies(
repositories: Seq[Repository],
Expand All @@ -62,7 +66,7 @@ trait CoursierSupport {
customizer: Option[Resolution => Resolution] = None,
ctx: Option[mill.api.Ctx.Log] = None,
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]] = None,
resolveFilter: os.Path => Boolean = _ => true,
deprecatedResolveFilter: os.Path => Boolean = _ => true,
artifactTypes: Option[Set[Type]] = None,
resolutionParams: ResolutionParams = ResolutionParams()
): Result[Agg[PathRef]] = {
Expand Down Expand Up @@ -108,7 +112,7 @@ trait CoursierSupport {
Agg.from(
res.files
.map(os.Path(_))
.filter(resolveFilter)
.filter(deprecatedResolveFilter)
.map(PathRef(_, quick = true))
) ++ localTestDeps.flatten
)
Expand All @@ -126,7 +130,7 @@ trait CoursierSupport {
customizer: Option[Resolution => Resolution],
ctx: Option[mill.api.Ctx.Log],
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]],
resolveFilter: os.Path => Boolean,
deprecatedResolveFilter: os.Path => Boolean,
artifactTypes: Option[Set[Type]]
): Result[Agg[PathRef]] =
resolveDependencies(
Expand All @@ -138,7 +142,7 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
resolveFilter,
deprecatedResolveFilter,
artifactTypes,
ResolutionParams()
)
Expand All @@ -153,7 +157,7 @@ trait CoursierSupport {
customizer: Option[Resolution => Resolution],
ctx: Option[mill.api.Ctx.Log],
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]],
resolveFilter: os.Path => Boolean
deprecatedResolveFilter: os.Path => Boolean
): Result[Agg[PathRef]] =
resolveDependencies(
repositories,
Expand All @@ -164,8 +168,7 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
resolveFilter,
None
deprecatedResolveFilter
)

@deprecated(
Expand Down
4 changes: 2 additions & 2 deletions main/util/src/mill/util/Util.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ object Util {
def millProjectModule(
artifact: String,
repositories: Seq[Repository],
resolveFilter: os.Path => Boolean = _ => true,
deprecatedResolveFilter: os.Path => Boolean = _ => true,
// this should correspond to the mill runtime Scala version
artifactSuffix: String = "_2.13"
): Result[Agg[PathRef]] = {
Expand All @@ -90,7 +90,7 @@ object Util {
)
),
force = Nil,
resolveFilter = resolveFilter
deprecatedResolveFilter = deprecatedResolveFilter
).map(_.map(_.withRevalidateOnce))
}

Expand Down
3 changes: 1 addition & 2 deletions scalajslib/src/mill/scalajslib/ScalaJSModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ trait ScalaJSModule extends scalalib.ScalaModule { outer =>
def scalaJSWorkerClasspath = Task {
mill.util.Util.millProjectModule(
artifact = s"mill-scalajslib-worker-${scalaJSWorkerVersion()}",
repositories = repositoriesTask(),
resolveFilter = _.toString.contains("mill-scalajslib-worker")
repositories = repositoriesTask()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ trait ScalaNativeModule extends ScalaModule { outer =>
def scalaNativeWorkerClasspath = Task {
millProjectModule(
s"mill-scalanativelib-worker-${scalaNativeWorkerVersion()}",
repositoriesTask(),
resolveFilter = _.toString.contains("mill-scalanativelib-worker")
repositoriesTask()
)
}

Expand Down

0 comments on commit 7b4619f

Please sign in to comment.