Skip to content
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

Deprecate resolveFilter stuff #4162

Merged
Merged
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions contrib/package.mill
Original file line number Diff line number Diff line change
@@ -126,18 +126,20 @@ object `package` extends RootModule {

// Worker for Scoverage 2.0
object worker2 extends build.MillPublishScalaModule {
def compileModuleDeps = Seq(build.main.api)
def moduleDeps = Seq(scoverage.api)
def testDepPaths = Task { Seq(compile().classes) }
def compileModuleDeps = Seq(
build.main.api,
scoverage.api
)
def compileIvyDeps = Task {
Agg(
super.mandatoryIvyDeps() ++ Agg(
// compile-time only, need to provide the correct scoverage version at runtime
build.Deps.scalacScoverage2Plugin,
build.Deps.scalacScoverage2Reporter,
build.Deps.scalacScoverage2Domain,
build.Deps.scalacScoverage2Serializer
)
}
def mandatoryIvyDeps = Agg.empty[Dep]
Comment on lines +129 to +142
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on with these changes? Did the semantics of the underlying resolution change in some way that we need to change this downstream code?

Copy link
Collaborator Author

@alexarchambault alexarchambault Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal here is to also make the mandatoryIvyDeps (scala-library basically) compile-time only too. That's just it.

}
}

Original file line number Diff line number Diff line change
@@ -125,8 +125,7 @@ trait ScoverageModule extends ScalaModule { outer: ScalaModule =>

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

12 changes: 7 additions & 5 deletions kotlinlib/package.mill
Original file line number Diff line number Diff line change
@@ -45,11 +45,13 @@ object `package` extends RootModule with build.MillPublishScalaModule with Build
)

object impl extends MillKotlinModule {
override def moduleDeps: Seq[PublishModule] = Seq(worker)
override def compileIvyDeps: T[Agg[Dep]] = Agg(
build.Deps.osLib,
build.Deps.kotlinCompiler
)
override def compileModuleDeps = Seq(worker)
def mandatoryIvyDeps = Agg.empty[Dep]
override def compileIvyDeps: T[Agg[Dep]] =
super.mandatoryIvyDeps() ++ Agg(
build.Deps.osLib,
build.Deps.kotlinCompiler
)
}
}
}
3 changes: 1 addition & 2 deletions kotlinlib/src/mill/kotlinlib/KotlinModule.scala
Original file line number Diff line number Diff line change
@@ -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()
)
}

17 changes: 10 additions & 7 deletions main/util/src/mill/util/CoursierSupport.scala
Original file line number Diff line number Diff line change
@@ -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],
@@ -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]] = {
@@ -108,7 +112,7 @@ trait CoursierSupport {
Agg.from(
res.files
.map(os.Path(_))
.filter(resolveFilter)
.filter(deprecatedResolveFilter)
.map(PathRef(_, quick = true))
) ++ localTestDeps.flatten
)
@@ -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(
@@ -138,7 +142,7 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
resolveFilter,
deprecatedResolveFilter,
artifactTypes,
ResolutionParams()
)
@@ -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,
@@ -164,8 +168,7 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
resolveFilter,
None
deprecatedResolveFilter
)

@deprecated(
4 changes: 2 additions & 2 deletions main/util/src/mill/util/Util.scala
Original file line number Diff line number Diff line change
@@ -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]] = {
@@ -90,7 +90,7 @@ object Util {
)
),
force = Nil,
resolveFilter = resolveFilter
deprecatedResolveFilter = deprecatedResolveFilter
).map(_.map(_.withRevalidateOnce))
}

6 changes: 3 additions & 3 deletions scalajslib/package.mill
Original file line number Diff line number Diff line change
@@ -45,9 +45,9 @@ object `package` extends RootModule with build.MillStableScalaModule with BuildI
trait WorkerModule extends build.MillPublishScalaModule with Cross.Module[String] {
def scalajsWorkerVersion = crossValue
def millSourcePath: os.Path = super.millSourcePath / scalajsWorkerVersion
def testDepPaths = Task { Seq(compile().classes) }
def moduleDeps = Seq(build.scalajslib.`worker-api`, build.main.client, build.main.api)
def ivyDeps = Agg(
def compileModuleDeps = Seq(build.scalajslib.`worker-api`, build.main.client, build.main.api)
def mandatoryIvyDeps = Agg.empty[Dep]
def compileIvyDeps = super.mandatoryIvyDeps() ++ Agg(
build.Deps.Scalajs_1.scalajsLinker,
build.Deps.Scalajs_1.scalajsSbtTestAdapter,
build.Deps.Scalajs_1.scalajsEnvNodejs,
3 changes: 1 addition & 2 deletions scalajslib/src/mill/scalajslib/ScalaJSModule.scala
Original file line number Diff line number Diff line change
@@ -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()
)
}

8 changes: 4 additions & 4 deletions scalanativelib/package.mill
Original file line number Diff line number Diff line change
@@ -18,17 +18,17 @@ object `package` extends RootModule with build.MillStableScalaModule {
trait WorkerModule extends build.MillPublishScalaModule with Cross.Module[String] {
def scalaNativeWorkerVersion = crossValue
def millSourcePath: os.Path = super.millSourcePath / scalaNativeWorkerVersion
def testDepPaths = Task { Seq(compile().classes) }
def moduleDeps = Seq(`worker-api`)
def ivyDeps = scalaNativeWorkerVersion match {
def compileModuleDeps = Seq(`worker-api`)
def compileIvyDeps = scalaNativeWorkerVersion match {
case "0.5" =>
Agg(
super.mandatoryIvyDeps() ++ Agg(
build.Deps.osLib,
build.Deps.Scalanative_0_5.scalanativeTools,
build.Deps.Scalanative_0_5.scalanativeUtil,
build.Deps.Scalanative_0_5.scalanativeNir,
build.Deps.Scalanative_0_5.scalanativeTestRunner
)
}
def mandatoryIvyDeps = Agg.empty[mill.scalalib.Dep]
}
}
Original file line number Diff line number Diff line change
@@ -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()
)
}


Unchanged files with check annotations Beta