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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
10 changes: 6 additions & 4 deletions contrib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -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?

}
}

Expand Down
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
12 changes: 7 additions & 5 deletions kotlinlib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
20 changes: 13 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,8 @@ 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,
@deprecated("This parameter is now ignored, use exclusions instead or mark some dependencies as provided when you publish modules", "Mill after 0.12.5")
deprecatedResolveFilter: os.Path => Boolean = _ => true,
artifactTypes: Option[Set[Type]] = None,
resolutionParams: ResolutionParams = ResolutionParams()
): Result[Agg[PathRef]] = {
Expand Down Expand Up @@ -108,7 +113,7 @@ trait CoursierSupport {
Agg.from(
res.files
.map(os.Path(_))
.filter(resolveFilter)
.filter(deprecatedResolveFilter)
.map(PathRef(_, quick = true))
) ++ localTestDeps.flatten
)
Expand All @@ -126,7 +131,8 @@ trait CoursierSupport {
customizer: Option[Resolution => Resolution],
ctx: Option[mill.api.Ctx.Log],
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]],
resolveFilter: os.Path => Boolean,
@deprecated("This parameter is now ignored, use exclusions instead or mark some dependencies as provided when you publish modules", "Mill after 0.12.5")
deprecatedResolveFilter: os.Path => Boolean,
artifactTypes: Option[Set[Type]]
): Result[Agg[PathRef]] =
resolveDependencies(
Expand All @@ -138,7 +144,7 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
resolveFilter,
deprecatedResolveFilter,
artifactTypes,
ResolutionParams()
)
Expand All @@ -153,7 +159,8 @@ trait CoursierSupport {
customizer: Option[Resolution => Resolution],
ctx: Option[mill.api.Ctx.Log],
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]],
resolveFilter: os.Path => Boolean
@deprecated("This parameter is now ignored, use exclusions instead or mark some dependencies as provided when you publish modules", "Mill after 0.12.5")
deprecatedResolveFilter: os.Path => Boolean
): Result[Agg[PathRef]] =
resolveDependencies(
repositories,
Expand All @@ -164,8 +171,7 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
resolveFilter,
None
deprecatedResolveFilter
)

@deprecated(
Expand Down
5 changes: 3 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,8 @@ object Util {
def millProjectModule(
artifact: String,
repositories: Seq[Repository],
resolveFilter: os.Path => Boolean = _ => true,
@deprecated("This parameter is now ignored, use exclusions instead or mark some dependencies as provided when you publish modules", "Mill after 0.12.5")
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 +91,7 @@ object Util {
)
),
force = Nil,
resolveFilter = resolveFilter
deprecatedResolveFilter = deprecatedResolveFilter
).map(_.map(_.withRevalidateOnce))
}

Expand Down
6 changes: 3 additions & 3 deletions scalajslib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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
8 changes: 4 additions & 4 deletions scalanativelib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Loading