Skip to content

Commit

Permalink
Move TestModule.* dependencies to mandatoryIvyDeps (#3279)
Browse files Browse the repository at this point in the history
. This better fits what they are, since `mandatoryIvyDeps` is defined as
*Mandatory ivy dependencies that are typically always required and
shouldn't be removed by overriding*, and it makes it less likely people
will accidentally override `ivyDeps` without `super` and stomp over them
  • Loading branch information
lihaoyi authored Feb 25, 2025
1 parent 5281a01 commit c0ca70b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion example/javalib/basic/1-simple/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object foo extends JavaModule {
)

object test extends JavaTests with TestModule.Junit4 {
def ivyDeps = super.ivyDeps() ++ Seq(
def ivyDeps = Seq(
ivy"com.google.guava:guava:33.3.0-jre"
)
}
Expand Down
2 changes: 1 addition & 1 deletion example/kotlinlib/basic/1-simple/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object foo extends KotlinModule {
)

object test extends KotlinTests with TestModule.Junit5 {
def ivyDeps = super.ivyDeps() ++ Seq(
def ivyDeps = Seq(
ivy"io.kotest:kotest-runner-junit5-jvm:5.9.1"
)
}
Expand Down
13 changes: 7 additions & 6 deletions scalalib/src/mill/scalalib/TestModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ object TestModule {
*/
trait TestNg extends TestModule {
override def testFramework: T[String] = "mill.testng.TestNGFramework"
override def ivyDeps: T[Seq[Dep]] = Task {
super.ivyDeps() ++ Seq(
override def mandatoryIvyDeps: T[Seq[Dep]] = Task {
super.mandatoryIvyDeps() ++ Seq(
ivy"com.lihaoyi:mill-contrib-testng:${mill.api.BuildInfo.millVersion}"
)
}
Expand All @@ -255,8 +255,8 @@ object TestModule {
*/
trait Junit4 extends TestModule {
override def testFramework: T[String] = "com.novocode.junit.JUnitFramework"
override def ivyDeps: T[Seq[Dep]] = Task {
super.ivyDeps() ++ Seq(ivy"${mill.scalalib.api.Versions.sbtTestInterface}")
override def mandatoryIvyDeps: T[Seq[Dep]] = Task {
super.mandatoryIvyDeps() ++ Seq(ivy"${mill.scalalib.api.Versions.sbtTestInterface}")
}
}

Expand All @@ -266,8 +266,8 @@ object TestModule {
*/
trait Junit5 extends TestModule {
override def testFramework: T[String] = "com.github.sbt.junit.jupiter.api.JupiterFramework"
override def ivyDeps: T[Seq[Dep]] = Task {
super.ivyDeps() ++ Seq(ivy"${mill.scalalib.api.Versions.jupiterInterface}")
override def mandatoryIvyDeps: T[Seq[Dep]] = Task {
super.mandatoryIvyDeps() ++ Seq(ivy"${mill.scalalib.api.Versions.jupiterInterface}")
}

/**
Expand Down Expand Up @@ -393,6 +393,7 @@ object TestModule {

trait JavaModuleBase extends BspModule {
def ivyDeps: T[Seq[Dep]] = Seq.empty[Dep]
def mandatoryIvyDeps: T[Seq[Dep]] = Seq.empty[Dep]
def resources: T[Seq[PathRef]] = Task { Seq.empty[PathRef] }
}

Expand Down

0 comments on commit c0ca70b

Please sign in to comment.