Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Manage TestModule dependencies via build.sc #3320

Merged
merged 5 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`
Comment on lines +20 to +28
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved these after the ordinary imports to work around IntelliJ removing them when "organizing" them. Since we parse them ahead of compilation, it makes no semantic difference.


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