Skip to content

Commit

Permalink
Get rid of resolveFilter stuff
Browse files Browse the repository at this point in the history
By marking all worker dependencies as provided (aka compile-time only)
  • Loading branch information
alexarchambault committed Dec 18, 2024
1 parent b1eff1c commit 24714ed
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
9 changes: 6 additions & 3 deletions contrib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,21 @@ 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 compileModuleDeps = Seq(
build.main.api,
scoverage.api
)
def testDepPaths = Task { Seq(compile().classes) }
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]
}
}

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
)
}
}
}
8 changes: 1 addition & 7 deletions main/util/src/mill/util/CoursierSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ 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,
artifactTypes: Option[Set[Type]] = None,
resolutionParams: ResolutionParams = ResolutionParams()
): Result[Agg[PathRef]] = {
Expand Down Expand Up @@ -157,7 +156,6 @@ trait CoursierSupport {
Agg.from(
res.files
.map(os.Path(_))
.filter(resolveFilter)
.map(PathRef(_, quick = true))
)
)
Expand All @@ -175,7 +173,6 @@ trait CoursierSupport {
customizer: Option[Resolution => Resolution],
ctx: Option[mill.api.Ctx.Log],
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]],
resolveFilter: os.Path => Boolean,
artifactTypes: Option[Set[Type]]
): Result[Agg[PathRef]] =
resolveDependencies(
Expand All @@ -187,7 +184,6 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
resolveFilter,
artifactTypes,
ResolutionParams()
)
Expand All @@ -201,8 +197,7 @@ trait CoursierSupport {
mapDependencies: Option[Dependency => Dependency],
customizer: Option[Resolution => Resolution],
ctx: Option[mill.api.Ctx.Log],
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]],
resolveFilter: os.Path => Boolean
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]]
): Result[Agg[PathRef]] =
resolveDependencies(
repositories,
Expand All @@ -213,7 +208,6 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
resolveFilter,
None
)

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

Expand Down
5 changes: 3 additions & 2 deletions scalajslib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ object `package` extends RootModule with build.MillStableScalaModule with BuildI
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
7 changes: 4 additions & 3 deletions scalanativelib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ object `package` extends RootModule with build.MillStableScalaModule {
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]
}
}

0 comments on commit 24714ed

Please sign in to comment.