Skip to content

Commit

Permalink
Manage TestModule dependencies via build.sc (#3320)
Browse files Browse the repository at this point in the history
This allows us to detect possible updates easier.

Pull request: #3320
  • Loading branch information
lefou authored Aug 6, 2024
1 parent c7a5ccb commit f908fca
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
48 changes: 34 additions & 14 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
// plugins and dependencies
import $file.ci.shared
import $file.ci.upload
import $ivy.`org.scalaj::scalaj-http:2.4.2`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`com.github.lolgab::mill-mima::0.1.1`
import $ivy.`net.sourceforge.htmlcleaner:htmlcleaner:2.29`
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:`
import $ivy.`com.goyeau::mill-scalafix::0.4.0`

// imports
import com.github.lolgab.mill.mima.{CheckDirection, ProblemFilter, Mima}
import scala.util.chaining._
import com.github.lolgab.mill.mima.Mima
import coursier.maven.MavenRepository
import de.tobiasroeser.mill.vcs.version.VcsVersion
import com.goyeau.mill.scalafix.ScalafixModule
Expand All @@ -23,10 +14,19 @@ import mill.scalalib.publish._
import mill.util.Jvm
import mill.resolve.SelectMode
import mill.contrib.buildinfo.BuildInfo
import mill.scalalib.api.Versions
import mill.T
import mill.define.Cross

// plugins and dependencies
import $file.ci.shared
import $file.ci.upload
import $ivy.`org.scalaj::scalaj-http:2.4.2`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`com.github.lolgab::mill-mima::0.1.1`
import $ivy.`net.sourceforge.htmlcleaner:htmlcleaner:2.29`
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:`
import $ivy.`com.goyeau::mill-scalafix::0.4.0`

object Settings {
val pomOrg = "com.lihaoyi"
val githubOrg = "com-lihaoyi"
Expand Down Expand Up @@ -195,6 +195,12 @@ object Deps {
val requests = ivy"com.lihaoyi::requests:0.8.3"
val sonatypeCentralClient = ivy"com.lumidion::sonatype-central-client-requests:0.3.0"

object RuntimeDeps {
val sbtTestInterface = ivy"com.github.sbt:junit-interface:0.13.2"
val jupiterInterface = ivy"com.github.sbt.junit:jupiter-interface:0.11.4"
def all = Seq(sbtTestInterface, jupiterInterface)
}

/** Used to manage transitive versions. */
val transitiveDeps = Seq(
ivy"org.apache.ant:ant:1.10.14",
Expand Down Expand Up @@ -789,7 +795,21 @@ object scalalib extends MillStableScalaModule {
),
BuildInfo.Value("millCompilerBridgeScalaVersions", bridgeScalaVersions.mkString(",")),
BuildInfo.Value("millCompilerBridgeVersion", bridgeVersion),
BuildInfo.Value("millVersion", millVersion(), "Mill version.")
BuildInfo.Value("millVersion", millVersion(), "Mill version."),
BuildInfo.Value(
"sbtTestInterface",
Deps.RuntimeDeps.sbtTestInterface.pipe { d =>
s"${d.dep.module.organization.value}:${d.dep.module.name.value}:${d.version}"
},
"Dependency sbt-test-interface"
),
BuildInfo.Value(
"jupiterInterface",
Deps.RuntimeDeps.jupiterInterface.pipe { d =>
s"${d.dep.module.organization.value}:${d.dep.module.name.value}:${d.version}"
},
"Dependency to jupiter-interface"
)
)
}

Expand Down Expand Up @@ -2083,7 +2103,7 @@ val dummyDeps: Seq[Dep] = Seq(
Deps.acyclic,
Deps.scalacScoverage2Plugin,
ivy"com.lihaoyi:::ammonite:${Deps.ammoniteVersion}"
) ++ Deps.transitiveDeps
) ++ Deps.transitiveDeps ++ Deps.RuntimeDeps.all

implicit object DepSegment extends Cross.ToSegments[Dep]({ dep =>
val depString = formatDep(dep)
Expand Down
4 changes: 2 additions & 2 deletions scalalib/src/mill/scalalib/TestModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ object TestModule {
trait Junit4 extends TestModule {
override def testFramework: T[String] = "com.novocode.junit.JUnitFramework"
override def ivyDeps: T[Agg[Dep]] = T {
super.ivyDeps() ++ Agg(ivy"com.github.sbt:junit-interface:0.13.2")
super.ivyDeps() ++ Agg(ivy"${mill.scalalib.api.Versions.sbtTestInterface}")
}
}

Expand All @@ -267,7 +267,7 @@ object TestModule {
trait Junit5 extends TestModule {
override def testFramework: T[String] = "com.github.sbt.junit.jupiter.api.JupiterFramework"
override def ivyDeps: T[Agg[Dep]] = T {
super.ivyDeps() ++ Agg(ivy"com.github.sbt.junit:jupiter-interface:0.11.4")
super.ivyDeps() ++ Agg(ivy"${mill.scalalib.api.Versions.jupiterInterface}")
}
}

Expand Down

0 comments on commit f908fca

Please # to comment.