Skip to content

Commit 89836cd

Browse files
authored
Fix build, remove TestModule.UTest from AmmInternalModule (#1389)
This fixes the issue #1386: ``` > ./mill -i amm.repl[3.2.2].test GITHUB REF None fatal: no tag exactly matches 'cdeaa580bf128779686991a838623dd3a75af49b' [296/296] amm.repl[3.2.2].test java.lang.ClassNotFoundException: utest.runner.Framework java.lang.ClassNotFoundException: utest.runner.Framework at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476) at mill.api.ClassLoader$$anon$1.findClass(ClassLoader.scala:47) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:594) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527) at mill.testrunner.TestRunner$.framework(TestRunner.scala:412) at mill.testrunner.TestRunner$.$anonfun$main$2(TestRunner.scala:252) at mill.testrunner.TestRunner$.$anonfun$runTestFramework$2(TestRunner.scala:326) at mill.util.Jvm$.inprocess(Jvm.scala:30) at mill.testrunner.TestRunner$.runTestFramework(TestRunner.scala:320) at mill.testrunner.TestRunner$.main(TestRunner.scala:258) at mill.testrunner.TestRunner.main(TestRunner.scala) 1 targets failed amm.repl[3.2.2].test Test execution failed. ``` The issue is, that `amm.repl[3.2.2]` (defined by `ReplModule` which extends `AmmModule` which itself extends `AmmoniteInternalModule`) is itself a `TestModule.UTest`. That means, it already has a `test` target, so that the resolver will never search for a submodule that implements a `defaultCommand`. After removing `TestModule.UTest` from `AmmoniteInternalModule`, the cli call properly resolves to `amm.repl[3.2.2].test.test`. I'm curious to know, why this even compiled. We end up with two class members `test`, one `def` with the test target, and one `object` with the test sub-module. Pull request: #1389
1 parent cdeaa58 commit 89836cd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Diff for: build.sc

+8-8
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ object Deps {
116116
val utest = ivy"com.lihaoyi::utest:0.8.1"
117117
}
118118

119-
trait AmmInternalModule extends CrossSbtModule with Bloop.Module with TestModule.Utest{
119+
trait AmmInternalModule extends CrossSbtModule with Bloop.Module {
120120
// We need it to be a Boolean, not T[Boolean]
121121
def isCrossFullScalaVersion: Boolean = false
122122
def crossFullScalaVersion = T { isCrossFullScalaVersion }
@@ -150,7 +150,7 @@ trait AmmInternalModule extends CrossSbtModule with Bloop.Module with TestModule
150150
ivy"$scalaO:scala-library:$scalaV"
151151
)
152152
}
153-
trait Tests extends super.Tests with TestModule.Utest{
153+
trait AmmTests extends super.Tests with TestModule.Utest{
154154
def ivyDeps = super.ivyDeps() ++ Agg(Deps.utest)
155155
def forkArgs = Seq("-Xmx2g", "-Dfile.encoding=UTF8")
156156
}
@@ -283,7 +283,7 @@ class TerminalModule(val crossScalaVersion: String) extends AmmModule{
283283
Deps.sourcecode
284284
)
285285
}
286-
object test extends Tests{
286+
object test extends AmmTests{
287287
def ivyDeps = super.ivyDeps() ++ Agg(Deps.sourcecode)
288288
}
289289
}
@@ -361,7 +361,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){
361361
transitiveSourceJars()
362362
}
363363

364-
object test extends Tests
364+
object test extends AmmTests
365365
}
366366

367367
object interp extends Cross[InterpModule](fullCrossScalaVersions:_*){
@@ -463,7 +463,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){
463463
)
464464
def compileIvyDeps = super.compileIvyDeps() ++ (if(isScala3(crossScalaVersion)) Agg.empty[Dep] else Agg(Deps.scalaReflect(scalaVersion())))
465465

466-
object test extends Tests with AmmDependenciesResourceFileModule {
466+
object test extends AmmTests with AmmDependenciesResourceFileModule {
467467
def crossScalaVersion = ReplModule.this.crossScalaVersion
468468
def scalaVersion = ReplModule.this.scalaVersion
469469
def dependencyResourceFileName = "amm-test-dependencies.txt"
@@ -578,7 +578,7 @@ class MainModule(val crossScalaVersion: String) extends AmmModule {
578578
}
579579
}
580580

581-
object test extends super.Tests {
581+
object test extends AmmTests {
582582
def moduleDeps = super.moduleDeps ++ Seq(amm.compiler().test, amm.repl().test)
583583
def ivyDeps = super.ivyDeps() ++ Agg(
584584
Deps.scalaJava8Compat
@@ -650,7 +650,7 @@ class IntegrationModule(val crossScalaVersion: String) extends AmmInternalModule
650650
Agg.empty
651651
)
652652
}
653-
object test extends Tests {
653+
object test extends AmmTests {
654654
def testLauncher = T {
655655
if (scala.util.Properties.isWin)
656656
amm().launcher().path.toString
@@ -672,7 +672,7 @@ class SshdModule(val crossScalaVersion: String) extends AmmModule{
672672
Deps.sshdCore,
673673
Deps.bcprovJdk15on
674674
)
675-
object test extends Tests {
675+
object test extends AmmTests {
676676
def ivyDeps = super.ivyDeps() ++ Agg(
677677
// slf4j-nop makes sshd server use logger that writes into the void
678678
Deps.slf4jNop,

0 commit comments

Comments
 (0)