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

Update coursier to 2.1.18 and coursier-interface to 1.0.24 #3950

Merged
merged 12 commits into from
Nov 22, 2024
4 changes: 2 additions & 2 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ object Deps {
val asmTree = ivy"org.ow2.asm:asm-tree:9.7.1"
val bloopConfig = ivy"ch.epfl.scala::bloop-config:1.5.5"

val coursierVersion = "2.1.16"
val coursierVersion = "2.1.18"
val coursier = ivy"io.get-coursier::coursier:$coursierVersion"
val coursierInterface = ivy"io.get-coursier:interface:1.0.22"
val coursierInterface = ivy"io.get-coursier:interface:1.0.24"
alexarchambault marked this conversation as resolved.
Show resolved Hide resolved
val coursierJvm = ivy"io.get-coursier::coursier-jvm:$coursierVersion"

val cask = ivy"com.lihaoyi::cask:0.9.4"
Expand Down
63 changes: 62 additions & 1 deletion docs/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,70 @@ import scala.jdk.CollectionConverters._

/** Generates the mill documentation with Antora. */
object `package` extends RootModule {
trait CustomUnidocModule extends UnidocModule {
alexarchambault marked this conversation as resolved.
Show resolved Hide resolved
def unidocCompileClasspath = Task {
val cp = Seq(compile().classes) ++ T.traverse(moduleDeps)(_.compileClasspath)().flatten
cp.filter { ref =>
!ref.path.lastOpt.exists(_.startsWith("dependency_2.13-"))
}
}

def unidocCommon(local: Boolean) = Task.Anon {

val unidocSourceFiles =
allSourceFiles() ++ T.traverse(moduleDeps)(_.allSourceFiles)().flatten

T.log.info(s"Staging scaladoc for ${unidocSourceFiles.length} files")

// the details of the options and zincWorker call are significantly
// different between scala-2 scaladoc and scala-3 scaladoc
// below is for scala-2 variant
val options: Seq[String] = Seq(
"-doc-title",
"Mill",
"-d",
T.dest.toString,
"-classpath",
unidocCompileClasspath().map(_.path).mkString(sys.props("path.separator"))
) ++
unidocVersion().toSeq.flatMap(Seq("-doc-version", _)) ++
unidocSourceUrl().toSeq.flatMap { url =>
if (local) Seq(
"-doc-source-url",
"file://€{FILE_PATH}.scala"
)
else Seq(
"-doc-source-url",
url + "€{FILE_PATH}.scala",
"-sourcepath",
T.workspace.toString
)
}

zincWorker().worker().docJar(
scalaVersion(),
scalaOrganization(),
scalaDocClasspath(),
scalacPluginClasspath(),
options ++ unidocSourceFiles.map(_.path.toString)
) match {
case true => mill.api.Result.Success(PathRef(T.dest))
case false => mill.api.Result.Failure("unidoc generation failed")
}
}
}
// This module isn't really a ScalaModule, but we use it to generate
// consolidated documentation using the Scaladoc tool.
object site extends UnidocModule {
// Remove CustomUnidocModule and use UnidocModule instead when bumping Mill
object site extends CustomUnidocModule {
def unidocCompileClasspath =
super.unidocCompileClasspath().filter { ref =>
// Not sure why, the JAR of coursier/dependency creates
// a dependency root package in the Mill API doc, and that
// package page has broken links.
// So we just exclude that dependency's JAR here.
!ref.path.lastOpt.exists(_.startsWith("dependency_2.13-"))
}
def scalaVersion = build.Deps.scalaVersion
def moduleDeps = build.millInternal.modules.collect {
case m: build.MillStableScalaModule => m
Expand Down
4 changes: 4 additions & 0 deletions scalalib/src/mill/scalalib/JsonFormatters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ trait JsonFormatters {
implicit lazy val configurationFormat: RW[coursier.core.Configuration] = upickle.default.macroRW
implicit lazy val typeFormat: RW[coursier.core.Type] = upickle.default.macroRW
implicit lazy val classifierFormat: RW[coursier.core.Classifier] = upickle.default.macroRW
implicit lazy val depMgmtKeyFormat: RW[coursier.core.DependencyManagement.Key] =
upickle.default.macroRW
implicit lazy val depMgmtValuesFormat: RW[coursier.core.DependencyManagement.Values] =
upickle.default.macroRW

}
object JsonFormatters extends JsonFormatters
8 changes: 5 additions & 3 deletions scalalib/src/mill/scalalib/UnidocModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ trait UnidocModule extends ScalaModule {

def unidocVersion: T[Option[String]] = None

def unidocCompileClasspath = Task {
Seq(compile().classes) ++ T.traverse(moduleDeps)(_.compileClasspath)().flatten
}

def unidocCommon(local: Boolean) = Task.Anon {
def unidocCompileClasspath =
Seq(compile().classes) ++ T.traverse(moduleDeps)(_.compileClasspath)().flatten

val unidocSourceFiles =
allSourceFiles() ++ T.traverse(moduleDeps)(_.allSourceFiles)().flatten
Expand All @@ -29,7 +31,7 @@ trait UnidocModule extends ScalaModule {
"-d",
T.dest.toString,
"-classpath",
unidocCompileClasspath.map(_.path).mkString(sys.props("path.separator"))
unidocCompileClasspath().map(_.path).mkString(sys.props("path.separator"))
) ++
unidocVersion().toSeq.flatMap(Seq("-doc-version", _)) ++
unidocSourceUrl().toSeq.flatMap { url =>
Expand Down
Loading