Skip to content

Commit

Permalink
Missing bits from com-lihaoyi#4162
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault committed Dec 18, 2024
1 parent e1c1daa commit 275f54d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
1 change: 0 additions & 1 deletion contrib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ object `package` extends RootModule {
build.main.api,
scoverage.api
)
def testDepPaths = Task { Seq(compile().classes) }
def compileIvyDeps = Task {
super.mandatoryIvyDeps() ++ Agg(
// compile-time only, need to provide the correct scoverage version at runtime
Expand Down
13 changes: 11 additions & 2 deletions main/util/src/mill/util/CoursierSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,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 @@ -114,6 +118,7 @@ trait CoursierSupport {
customizer: Option[Resolution => Resolution] = None,
ctx: Option[mill.api.Ctx.Log] = None,
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]] = None,
deprecatedResolveFilter: os.Path => Boolean = _ => true,
artifactTypes: Option[Set[Type]] = None,
resolutionParams: ResolutionParams = ResolutionParams()
): Result[Agg[PathRef]] = {
Expand Down Expand Up @@ -156,6 +161,7 @@ trait CoursierSupport {
Agg.from(
res.files
.map(os.Path(_))
.filter(deprecatedResolveFilter)
.map(PathRef(_, quick = true))
)
)
Expand All @@ -173,6 +179,7 @@ trait CoursierSupport {
customizer: Option[Resolution => Resolution],
ctx: Option[mill.api.Ctx.Log],
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]],
deprecatedResolveFilter: os.Path => Boolean,
artifactTypes: Option[Set[Type]]
): Result[Agg[PathRef]] =
resolveDependencies(
Expand All @@ -184,6 +191,7 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
deprecatedResolveFilter,
artifactTypes,
ResolutionParams()
)
Expand All @@ -197,7 +205,8 @@ trait CoursierSupport {
mapDependencies: Option[Dependency => Dependency],
customizer: Option[Resolution => Resolution],
ctx: Option[mill.api.Ctx.Log],
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]]
coursierCacheCustomizer: Option[FileCache[Task] => FileCache[Task]],
deprecatedResolveFilter: os.Path => Boolean
): Result[Agg[PathRef]] =
resolveDependencies(
repositories,
Expand All @@ -208,7 +217,7 @@ trait CoursierSupport {
customizer,
ctx,
coursierCacheCustomizer,
None
deprecatedResolveFilter
)

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

Expand Down
1 change: 0 additions & 1 deletion scalajslib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ 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 compileModuleDeps = Seq(build.scalajslib.`worker-api`, build.main.client, build.main.api)
def mandatoryIvyDeps = Agg.empty[Dep]
def compileIvyDeps = super.mandatoryIvyDeps() ++ Agg(
Expand Down
1 change: 0 additions & 1 deletion scalanativelib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ 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 compileModuleDeps = Seq(`worker-api`)
def compileIvyDeps = scalaNativeWorkerVersion match {
case "0.5" =>
Expand Down

0 comments on commit 275f54d

Please sign in to comment.