Skip to content

Commit

Permalink
Renamings for conciseness: Scala*ModuleTests -> Scala*Tests, InnerCro…
Browse files Browse the repository at this point in the history
…ssModule -> CrossValue (com-lihaoyi#2572)

Last minute idea I had before we release 0.11.0 final

The current names are pretty verbose, especially for things that people
would use often, and especially compared to the old `Tests` name. This
cuts down the verbosity considerably.

WDYT @lefou @lolgab? If you don't like this I can skip it and release
0.11.0 as is, but I thought it's worth bringing up before the names
become locked in for a while
  • Loading branch information
lihaoyi committed Jun 6, 2023
1 parent 0842f31 commit 369a1d7
Show file tree
Hide file tree
Showing 38 changed files with 83 additions and 64 deletions.
13 changes: 13 additions & 0 deletions ci/mill-bootstrap.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/build.sc b/build.sc
index 8a61eaa089..464d12d012 100644
--- a/build.sc
+++ b/build.sc
@@ -315,7 +315,7 @@ trait MillScalaModule extends ScalaModule with MillJavaModule { outer =>

/** Default tests module. */
lazy val test: MillScalaModuleTests = new MillScalaModuleTests {}
- trait MillScalaModuleTests extends ScalaModuleTests with MillBaseTestsModule {
+ trait MillScalaModuleTests extends ScalaTests with MillBaseTestsModule {
def runClasspath = super.runClasspath() ++ writeLocalTestOverrides()
def forkArgs = super.forkArgs() ++ outer.testArgs()
def moduleDeps = outer.testModuleDeps
2 changes: 1 addition & 1 deletion contrib/bloop/test/src/mill/contrib/bloop/BloopTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object BloopTests extends TestSuite {
ivy"org.postgresql:postgresql:42.3.3"
)

object test extends ScalaModuleTests with TestModule.Utest
object test extends ScalaTests with TestModule.Utest
}

object scalaModule2 extends scalalib.ScalaModule {
Expand Down
2 changes: 1 addition & 1 deletion contrib/playlib/src/mill/playlib/PlayModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import mill.scalalib._
import mill.{Agg, Args, T}

trait PlayApiModule extends Dependencies with Router with Server {
trait PlayTests extends ScalaModuleTests with TestModule.ScalaTest {
trait PlayTests extends ScalaTests with TestModule.ScalaTest {
override def ivyDeps = T {
val scalatestPlusPlayVersion = playMinorVersion() match {
case Versions.PLAY_2_6 => "3.1.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ trait ScoverageModule extends ScalaModule { outer: ScalaModule =>
override def skipIdea = outer.skipIdea
}

trait ScoverageTests extends ScalaModuleTests {
trait ScoverageTests extends ScalaTests {
override def upstreamAssemblyClasspath = T {
super.upstreamAssemblyClasspath() ++
resolveDeps(T.task {
Expand Down
4 changes: 2 additions & 2 deletions contrib/testng/readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To use TestNG as test framework, you need to add it to the `TestModule.testFrame
import mill.scalalib._
object project extends ScalaModule {
object test extends ScalaModuleTests {
object test extends ScalaTests {
def testFramework = "mill.testng.TestNGFramework"
def ivyDeps = super.ivyDeps ++ Agg(
ivy"com.lihaoyi:mill-contrib-testng:${mill.BuildInfo.millVersion}"
Expand All @@ -29,6 +29,6 @@ You can also use the more convenient `TestModule.TestNg` trait.
import mill.scalalib._
object project extends ScalaModule {
object test extends ScalaModuleTests with TestModule.TestNg
object test extends ScalaTests with TestModule.TestNg
}
----
2 changes: 1 addition & 1 deletion example/basic/1-simple-scala/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ object foo extends RootModule with ScalaModule {
ivy"com.lihaoyi::mainargs:0.4.0"
)

object test extends ScalaModuleTests {
object test extends ScalaTests {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.11")
def testFramework = "utest.runner.Framework"
}
Expand Down
8 changes: 4 additions & 4 deletions example/cross/7-inner-cross-module/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ trait MyModule extends Module{

object foo extends Cross[FooModule]("a", "b")
trait FooModule extends Cross.Module[String] {
object bar extends MyModule with InnerCrossModule{
object bar extends MyModule with CrossValue{
def name = "Bar"
}
object qux extends MyModule with InnerCrossModule{
object qux extends MyModule with CrossValue{
def name = "Qux"
}
}

def baz = T { s"hello ${foo("a").bar.param()}" }

// You can use the `InnerCrossModule` trait within any `Cross.Module` to
// You can use the `CrossValue` trait within any `Cross.Module` to
// propagate the `crossValue` defined by an enclosing `Cross.Module` to some
// nested module. In this case, we use it to bind `crossValue` so it can be
// used in `def param`. This lets you reduce verbosity by defining the `Cross`
Expand All @@ -27,7 +27,7 @@ def baz = T { s"hello ${foo("a").bar.param()}" }
// modules that take multiple inputs.
//
// You can reference the modules and tasks defined within such a
// `InnerCrossModule` as is done in `def qux` above
// `CrossValue` as is done in `def qux` above

/** Usage
Expand Down
2 changes: 1 addition & 1 deletion example/scalabuilds/10-scala-realistic/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait MyModule extends PublishModule {

trait MyScalaModule extends MyModule with CrossScalaModule {
def ivyDeps = Agg(ivy"com.lihaoyi::scalatags:0.12.0")
object test extends ScalaModuleTests {
object test extends ScalaTests {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.11")
def testFramework = "utest.runner.Framework"
}
Expand Down
8 changes: 4 additions & 4 deletions example/scalabuilds/5-test-suite/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import mill._, scalalib._

object foo extends ScalaModule {
def scalaVersion = "2.13.8"
object test extends ScalaModuleTests {
object test extends ScalaTests {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.11")
def testFramework = "utest.runner.Framework"
}
Expand Down Expand Up @@ -47,7 +47,7 @@ compiling 1 Scala source...
object bar extends ScalaModule {
def scalaVersion = "2.13.8"

object test extends ScalaModuleTests with TestModule.Utest {
object test extends ScalaTests with TestModule.Utest {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.11")
}
}
Expand Down Expand Up @@ -87,10 +87,10 @@ object bar extends ScalaModule {
object qux extends ScalaModule {
def scalaVersion = "2.13.8"

object test extends ScalaModuleTests with TestModule.Utest {
object test extends ScalaTests with TestModule.Utest {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.11")
}
object integration extends ScalaModuleTests with TestModule.Utest {
object integration extends ScalaTests with TestModule.Utest {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.11")
}
}
Expand Down
4 changes: 2 additions & 2 deletions example/scalamodule/4-test-deps/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object qux extends ScalaModule {
def scalaVersion = "2.13.8"
def moduleDeps = Seq(baz)

object test extends ScalaModuleTests {
object test extends ScalaTests {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.11")
def testFramework = "utest.runner.Framework"
def moduleDeps = super.moduleDeps ++ Seq(baz.test)
Expand All @@ -26,7 +26,7 @@ object qux extends ScalaModule {
object baz extends ScalaModule {
def scalaVersion = "2.13.8"

object test extends ScalaModuleTests {
object test extends ScalaTests {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.11")
def testFramework = "utest.runner.Framework"
}
Expand Down
2 changes: 1 addition & 1 deletion example/thirdparty/acyclic/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait AcyclicModule extends CrossScalaModule with PublishModule {

def compileIvyDeps = Agg(Deps.scalaCompiler(crossScalaVersion))

object test extends ScalaModuleTests with TestModule.Utest {
object test extends ScalaTests with TestModule.Utest {
def sources = T.sources(millSourcePath / "src", millSourcePath / "resources")
def ivyDeps = Agg(Deps.utest, Deps.scalaCompiler(crossScalaVersion))
}
Expand Down
8 changes: 4 additions & 4 deletions example/thirdparty/fansi/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ trait FansiModule extends PublishModule with CrossScalaModule with PlatformScala

def ivyDeps = Agg(ivy"com.lihaoyi::sourcecode::0.3.0")

trait FansiTestModule extends ScalaModuleTests with TestModule.Utest {
trait FansiTests extends ScalaTests with TestModule.Utest {
def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.8.1")
}
}

object fansi extends Module {
object jvm extends Cross[JvmFansiModule](scalaVersions)
trait JvmFansiModule extends FansiModule with ScalaModule {
object test extends FansiTestModule with ScalaModuleTests
object test extends FansiTests with ScalaTests
}

object js extends Cross[JsFansiModule](scalaVersions)
trait JsFansiModule extends FansiModule with ScalaJSModule {
def scalaJSVersion = "1.10.1"
object test extends FansiTestModule with ScalaJSModuleTests
object test extends FansiTests with ScalaJSTests
}

object native extends Cross[NativeFansiModule](scalaVersions)
trait NativeFansiModule extends FansiModule with ScalaNativeModule {
def scalaNativeVersion = "0.4.5"
object test extends FansiTestModule with ScalaNativeModuleTests
object test extends FansiTests with ScalaNativeTests
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/web/1-todo-webapp/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ object app extends RootModule with ScalaModule {
ivy"com.lihaoyi::scalatags:0.12.0"
)

object test extends ScalaModuleTests {
object test extends ScalaTests {
def testFramework = "utest.runner.Framework"

def ivyDeps = Agg(
Expand Down
2 changes: 1 addition & 1 deletion example/web/2-webapp-cache-busting/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object app extends RootModule with ScalaModule {
Seq(PathRef(T.dest))
}

object test extends ScalaModuleTests {
object test extends ScalaTests {
def testFramework = "utest.runner.Framework"
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.10",
Expand Down
2 changes: 1 addition & 1 deletion example/web/3-scalajs-module/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object foo extends ScalaJSModule {
def scalaVersion = "2.13.8"
def scalaJSVersion = "1.13.0"
def ivyDeps = Agg(ivy"com.lihaoyi::scalatags::0.12.0")
object test extends ScalaJSModuleTests {
object test extends ScalaJSTests {
def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.7.11")
def testFramework = "utest.runner.Framework"
}
Expand Down
2 changes: 1 addition & 1 deletion example/web/4-webapp-scalajs/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object app extends RootModule with ScalaModule {
super.resources() ++ Seq(PathRef(T.dest))
}

object test extends ScalaModuleTests {
object test extends ScalaTests {
def testFramework = "utest.runner.Framework"

def ivyDeps = Agg(
Expand Down
2 changes: 1 addition & 1 deletion example/web/5-webapp-scalajs-shared/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object app extends RootModule with AppScalaModule {
super.resources() ++ Seq(PathRef(T.dest))
}

object test extends ScalaModuleTests {
object test extends ScalaTests {
def testFramework = "utest.runner.Framework"

def ivyDeps = Agg(
Expand Down
10 changes: 5 additions & 5 deletions example/web/6-cross-version-platform-publishing/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import mill._, scalalib._, scalajslib._, publish._

object foo extends Cross[FooModule]("2.13.8", "3.2.2")
trait FooModule extends Cross.Module[String] {
trait Shared extends CrossScalaModule with InnerCrossModule with PlatformScalaModule with PublishModule {
trait Shared extends CrossScalaModule with CrossValue with PlatformScalaModule with PublishModule {
def publishVersion = "0.0.1"

def pomSettings = PomSettings(
Expand All @@ -28,10 +28,10 @@ trait FooModule extends Cross.Module[String] {

object bar extends Module {
object jvm extends Shared{
object test extends ScalaModuleTests with FooTestModule
object test extends ScalaTests with FooTestModule
}
object js extends SharedJS {
object test extends ScalaJSModuleTests with FooTestModule
object test extends ScalaJSTests with FooTestModule
}
}

Expand All @@ -40,13 +40,13 @@ trait FooModule extends Cross.Module[String] {
def moduleDeps = Seq(bar.jvm)
def ivyDeps = super.ivyDeps() ++ Agg(ivy"com.lihaoyi::upickle::3.0.0")

object test extends ScalaModuleTests with FooTestModule
object test extends ScalaTests with FooTestModule
}

object js extends SharedJS {
def moduleDeps = Seq(bar.js)

object test extends ScalaJSModuleTests with FooTestModule
object test extends ScalaJSTests with FooTestModule
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions example/web/7-cross-platform-version-publishing/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ val scalaVersions = Seq("2.13.8", "3.2.2")
object bar extends Module {
object jvm extends Cross[JvmModule](scalaVersions)
trait JvmModule extends Shared {
object test extends ScalaModuleTests with SharedTestModule
object test extends ScalaTests with SharedTestModule
}

object js extends Cross[JsModule](scalaVersions)
trait JsModule extends SharedJS {
object test extends ScalaJSModuleTests with SharedTestModule
object test extends ScalaJSTests with SharedTestModule
}
}

Expand All @@ -44,14 +44,14 @@ object qux extends Module {
def moduleDeps = Seq(bar.jvm())
def ivyDeps = super.ivyDeps() ++ Agg(ivy"com.lihaoyi::upickle::3.0.0")

object test extends ScalaModuleTests with SharedTestModule
object test extends ScalaTests with SharedTestModule
}

object js extends Cross[JsModule](scalaVersions)
trait JsModule extends SharedJS {
def moduleDeps = Seq(bar.js())

object test extends ScalaJSModuleTests with SharedTestModule
object test extends ScalaJSTests with SharedTestModule
}
}

Expand Down
2 changes: 1 addition & 1 deletion integration/feature/bsp-install/repo/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import mill.scalalib._

trait HelloBspModule extends ScalaModule {
def scalaVersion = sys.props.getOrElse("TEST_SCALA_2_13_VERSION", ???)
object test extends ScalaModuleTests with TestModule.Utest
object test extends ScalaTests with TestModule.Utest

override def generatedSources = T {
Seq(PathRef(T.ctx().dest / "classes"))
Expand Down
2 changes: 1 addition & 1 deletion integration/feature/bsp-modules/repo/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import $file.proj3.{build => proj3}

trait HelloBspModule extends ScalaModule {
def scalaVersion = sys.props.getOrElse("TEST_SCALA_2_13_VERSION", ???)
object test extends ScalaModuleTests with TestModule.Utest
object test extends ScalaTests with TestModule.Utest
}

object HelloBsp extends HelloBspModule {
Expand Down
2 changes: 1 addition & 1 deletion integration/feature/gen-idea/repo/extended/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import mill.scalalib.TestModule

trait HelloWorldModule extends scalalib.ScalaModule {
override def scalaVersion = "2.13.6"
object test extends ScalaModuleTests with TestModule.Utest
object test extends ScalaTests with TestModule.Utest

override def generatedSources = T {
Seq(PathRef(T.dest / "classes"))
Expand Down
2 changes: 1 addition & 1 deletion integration/feature/gen-idea/repo/hello-world/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import mill.scalalib.{Dep, DepSyntax, TestModule}

trait HelloWorldModule extends scalalib.ScalaModule {
def scalaVersion = "2.12.5"
object test extends ScalaModuleTests with TestModule.Utest {
object test extends ScalaTests with TestModule.Utest {
override def compileIvyDeps: Target[Agg[Dep]] = Agg(
ivy"org.slf4j:jcl-over-slf4j:1.7.25"
)
Expand Down
4 changes: 2 additions & 2 deletions main/define/src/mill/define/Cross.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object Cross {
* trait that can be mixed into any sub-modules within the body of a
* [[Cross.Module]], to automatically inherit the [[crossValue]]
*/
trait InnerCrossModule extends Module[T1] {
trait CrossValue extends Module[T1] {
def crossValue: T1 = Module.this.crossValue
override def crossWrapperSegments: List[String] = Module.this.millModuleSegments.parts
}
Expand All @@ -38,7 +38,7 @@ object Cross {
* trait that can be mixed into any sub-modules within the body of a
* [[Cross.Arg2]], to automatically inherit the [[crossValue2]]
*/
trait InnerCrossModule2 extends InnerCrossModule with Module2[T1, T2] {
trait InnerCrossModule2 extends CrossValue with Module2[T1, T2] {
def crossValue2: T2 = Module2.this.crossValue2
}
}
Expand Down
4 changes: 2 additions & 2 deletions main/test/src/mill/util/TestGraphs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,11 @@ object TestGraphs {
object innerCrossModule extends TestUtil.BaseModule {
object myCross extends Cross[MyCrossModule]("a", "b")
trait MyCrossModule extends Cross.Module[String] {
object foo extends InnerCrossModule {
object foo extends CrossValue {
def bar = T { "foo " + crossValue }
}

object baz extends InnerCrossModule {
object baz extends CrossValue {
def bar = T { "baz " + crossValue }
}
}
Expand Down
Loading

0 comments on commit 369a1d7

Please sign in to comment.