From a3ec3e570b4a28e3b4f21023e6f91fd0ab8e932f Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Tue, 22 Oct 2024 01:17:37 +0200 Subject: [PATCH] Rename `KotlinJS` to `KotlinJs` (#3801) Fix https://github.com/com-lihaoyi/mill/issues/3771 --- example/kotlinlib/web/3-hello-kotlinjs/build.mill | 4 ++-- example/kotlinlib/web/4-webapp-kotlinjs/build.mill | 2 +- .../web/5-webapp-kotlinjs-shared/build.mill | 6 +++--- .../{KotlinJSModule.scala => KotlinJsModule.scala} | 12 ++++++------ ...mpileTests.scala => KotlinJsCompileTests.scala} | 10 +++++----- ...Tests.scala => KotlinJsKotestModuleTests.scala} | 12 ++++++------ ... => KotlinJsKotlinTestPackageModuleTests.scala} | 12 ++++++------ ...sts.scala => KotlinJsKotlinVersionsTests.scala} | 14 +++++++------- ...inJSLinkTests.scala => KotlinJsLinkTests.scala} | 12 ++++++------ ...deRunTests.scala => KotlinJsNodeRunTests.scala} | 10 +++++----- 10 files changed, 47 insertions(+), 47 deletions(-) rename kotlinlib/src/mill/kotlinlib/js/{KotlinJSModule.scala => KotlinJsModule.scala} (98%) rename kotlinlib/test/src/mill/kotlinlib/js/{KotlinJSCompileTests.scala => KotlinJsCompileTests.scala} (83%) rename kotlinlib/test/src/mill/kotlinlib/js/{KotlinJSKotestModuleTests.scala => KotlinJsKotestModuleTests.scala} (80%) rename kotlinlib/test/src/mill/kotlinlib/js/{KotlinJSKotlinTestPackageModuleTests.scala => KotlinJsKotlinTestPackageModuleTests.scala} (80%) rename kotlinlib/test/src/mill/kotlinlib/js/{KotlinJSKotlinVersionsTests.scala => KotlinJsKotlinVersionsTests.scala} (77%) rename kotlinlib/test/src/mill/kotlinlib/js/{KotlinJSLinkTests.scala => KotlinJsLinkTests.scala} (83%) rename kotlinlib/test/src/mill/kotlinlib/js/{KotlinJSNodeRunTests.scala => KotlinJsNodeRunTests.scala} (94%) diff --git a/example/kotlinlib/web/3-hello-kotlinjs/build.mill b/example/kotlinlib/web/3-hello-kotlinjs/build.mill index 800fb8db491..f28b7dd95f9 100644 --- a/example/kotlinlib/web/3-hello-kotlinjs/build.mill +++ b/example/kotlinlib/web/3-hello-kotlinjs/build.mill @@ -10,14 +10,14 @@ package build import mill._, kotlinlib._, kotlinlib.js._ -object `package` extends RootModule with KotlinJSModule { +object `package` extends RootModule with KotlinJsModule { def moduleKind = ModuleKind.ESModule def kotlinVersion = "1.9.25" def kotlinJSRunTarget = Some(RunTarget.Node) def ivyDeps = Agg( ivy"org.jetbrains.kotlinx:kotlinx-html-js:0.11.0", ) - object test extends KotlinJSModule with KotestTests + object test extends KotlinJsModule with KotestTests } diff --git a/example/kotlinlib/web/4-webapp-kotlinjs/build.mill b/example/kotlinlib/web/4-webapp-kotlinjs/build.mill index 8b091b63b86..dbf5668ab90 100644 --- a/example/kotlinlib/web/4-webapp-kotlinjs/build.mill +++ b/example/kotlinlib/web/4-webapp-kotlinjs/build.mill @@ -33,7 +33,7 @@ object `package` extends RootModule with KotlinModule { ) } - object client extends KotlinJSModule { + object client extends KotlinJsModule { def kotlinVersion = "1.9.24" override def splitPerModule = false diff --git a/example/kotlinlib/web/5-webapp-kotlinjs-shared/build.mill b/example/kotlinlib/web/5-webapp-kotlinjs-shared/build.mill index 22888ec6264..1211cd1314e 100644 --- a/example/kotlinlib/web/5-webapp-kotlinjs-shared/build.mill +++ b/example/kotlinlib/web/5-webapp-kotlinjs-shared/build.mill @@ -5,7 +5,7 @@ trait AppKotlinModule extends KotlinModule { def kotlinVersion = "1.9.25" } -trait AppKotlinJSModule extends AppKotlinModule with KotlinJSModule +trait AppKotlinJsModule extends AppKotlinModule with KotlinJsModule object `package` extends RootModule with AppKotlinModule { @@ -63,7 +63,7 @@ object `package` extends RootModule with AppKotlinModule { ivy"org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:$kotlinxSerializationVersion", ) } - object js extends SharedModule with AppKotlinJSModule { + object js extends SharedModule with AppKotlinJsModule { def ivyDeps = super.ivyDeps() ++ Agg( ivy"org.jetbrains.kotlinx:kotlinx-html-js:$kotlinHtmlVersion", ivy"org.jetbrains.kotlinx:kotlinx-serialization-json-js:$kotlinxSerializationVersion", @@ -71,7 +71,7 @@ object `package` extends RootModule with AppKotlinModule { } } - object client extends AppKotlinJSModule { + object client extends AppKotlinJsModule { def splitPerModule = false def moduleDeps = Seq(shared.js) def ivyDeps = Agg( diff --git a/kotlinlib/src/mill/kotlinlib/js/KotlinJSModule.scala b/kotlinlib/src/mill/kotlinlib/js/KotlinJsModule.scala similarity index 98% rename from kotlinlib/src/mill/kotlinlib/js/KotlinJSModule.scala rename to kotlinlib/src/mill/kotlinlib/js/KotlinJsModule.scala index f0a46df5070..f8cf6633e1c 100644 --- a/kotlinlib/src/mill/kotlinlib/js/KotlinJSModule.scala +++ b/kotlinlib/src/mill/kotlinlib/js/KotlinJsModule.scala @@ -18,7 +18,7 @@ import java.util.zip.ZipFile /** * This module is very experimental. Don't use it, it is still under the development, APIs can change. */ -trait KotlinJSModule extends KotlinModule { outer => +trait KotlinJsModule extends KotlinModule { outer => // region Kotlin/JS configuration @@ -70,8 +70,8 @@ trait KotlinJSModule extends KotlinModule { outer => T.traverse(transitiveModuleCompileModuleDeps)(m => Task.Anon { val transitiveModuleArtifactPath = - (if (m.isInstanceOf[KotlinJSModule]) { - m.asInstanceOf[KotlinJSModule].createKlib(T.dest, m.compile().classes) + (if (m.isInstanceOf[KotlinJsModule]) { + m.asInstanceOf[KotlinJsModule].createKlib(T.dest, m.compile().classes) } else m.compile().classes) m.localCompileClasspath() ++ Agg(transitiveModuleArtifactPath) } @@ -420,7 +420,7 @@ trait KotlinJSModule extends KotlinModule { outer => * Generic trait to run tests for Kotlin/JS which doesn't specify test * framework. For the particular implementation see [[KotlinTestPackageTests]] or [[KotestTests]]. */ - trait KotlinJSTests extends KotlinTests with KotlinJSModule { + trait KotlinJsTests extends KotlinTests with KotlinJsModule { // region private @@ -489,7 +489,7 @@ trait KotlinJSModule extends KotlinModule { outer => /** * Run tests for Kotlin/JS target using `kotlin.test` package. */ - trait KotlinTestPackageTests extends KotlinJSTests { + trait KotlinTestPackageTests extends KotlinJsTests { override def ivyDeps = Agg( ivy"org.jetbrains.kotlin:kotlin-test-js:${kotlinVersion()}" ) @@ -498,7 +498,7 @@ trait KotlinJSModule extends KotlinModule { outer => /** * Run tests for Kotlin/JS target using Kotest framework. */ - trait KotestTests extends KotlinJSTests { + trait KotestTests extends KotlinJsTests { def kotestVersion: T[String] = "5.9.1" diff --git a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSCompileTests.scala b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsCompileTests.scala similarity index 83% rename from kotlinlib/test/src/mill/kotlinlib/js/KotlinJSCompileTests.scala rename to kotlinlib/test/src/mill/kotlinlib/js/KotlinJsCompileTests.scala index 1d54740d0cf..aa992797679 100644 --- a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSCompileTests.scala +++ b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsCompileTests.scala @@ -5,7 +5,7 @@ package js import mill.testkit.{TestBaseModule, UnitTester} import utest.{TestSuite, Tests, assert, test} -object KotlinJSCompileTests extends TestSuite { +object KotlinJsCompileTests extends TestSuite { private val kotlinVersion = "1.9.25" @@ -13,12 +13,12 @@ object KotlinJSCompileTests extends TestSuite { object module extends TestBaseModule { - object bar extends KotlinJSModule { - def kotlinVersion = KotlinJSCompileTests.kotlinVersion + object bar extends KotlinJsModule { + def kotlinVersion = KotlinJsCompileTests.kotlinVersion } - object foo extends KotlinJSModule { - override def kotlinVersion = KotlinJSCompileTests.kotlinVersion + object foo extends KotlinJsModule { + override def kotlinVersion = KotlinJsCompileTests.kotlinVersion override def moduleDeps = Seq(module.bar) } } diff --git a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSKotestModuleTests.scala b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsKotestModuleTests.scala similarity index 80% rename from kotlinlib/test/src/mill/kotlinlib/js/KotlinJSKotestModuleTests.scala rename to kotlinlib/test/src/mill/kotlinlib/js/KotlinJsKotestModuleTests.scala index b9327e55576..1fca10f08b4 100644 --- a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSKotestModuleTests.scala +++ b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsKotestModuleTests.scala @@ -5,7 +5,7 @@ import mill.eval.EvaluatorPaths import mill.testkit.{TestBaseModule, UnitTester} import utest.{assert, TestSuite, Tests, test} -object KotlinJSKotestModuleTests extends TestSuite { +object KotlinJsKotestModuleTests extends TestSuite { private val resourcePath = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "kotlin-js" @@ -13,15 +13,15 @@ object KotlinJSKotestModuleTests extends TestSuite { object module extends TestBaseModule { - object bar extends KotlinJSModule { - def kotlinVersion = KotlinJSKotestModuleTests.kotlinVersion + object bar extends KotlinJsModule { + def kotlinVersion = KotlinJsKotestModuleTests.kotlinVersion } - object foo extends KotlinJSModule { - def kotlinVersion = KotlinJSKotestModuleTests.kotlinVersion + object foo extends KotlinJsModule { + def kotlinVersion = KotlinJsKotestModuleTests.kotlinVersion override def moduleDeps = Seq(module.bar) - object test extends KotlinJSModule with KotestTests { + object test extends KotlinJsModule with KotestTests { override def allSourceFiles = super.allSourceFiles() .filter(!_.path.toString().endsWith("HelloKotlinTestPackageTests.kt")) } diff --git a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSKotlinTestPackageModuleTests.scala b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsKotlinTestPackageModuleTests.scala similarity index 80% rename from kotlinlib/test/src/mill/kotlinlib/js/KotlinJSKotlinTestPackageModuleTests.scala rename to kotlinlib/test/src/mill/kotlinlib/js/KotlinJsKotlinTestPackageModuleTests.scala index fdd9b2039a0..3540cc9fe57 100644 --- a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSKotlinTestPackageModuleTests.scala +++ b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsKotlinTestPackageModuleTests.scala @@ -6,7 +6,7 @@ import mill.eval.EvaluatorPaths import mill.testkit.{TestBaseModule, UnitTester} import utest.{assert, TestSuite, Tests, test} -object KotlinJSKotlinTestPackageModuleTests extends TestSuite { +object KotlinJsKotlinTestPackageModuleTests extends TestSuite { private val resourcePath = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "kotlin-js" @@ -14,15 +14,15 @@ object KotlinJSKotlinTestPackageModuleTests extends TestSuite { object module extends TestBaseModule { - object bar extends KotlinJSModule { - def kotlinVersion = KotlinJSKotlinTestPackageModuleTests.kotlinVersion + object bar extends KotlinJsModule { + def kotlinVersion = KotlinJsKotlinTestPackageModuleTests.kotlinVersion } - object foo extends KotlinJSModule { - def kotlinVersion = KotlinJSKotlinTestPackageModuleTests.kotlinVersion + object foo extends KotlinJsModule { + def kotlinVersion = KotlinJsKotlinTestPackageModuleTests.kotlinVersion override def moduleDeps = Seq(module.bar) - object test extends KotlinJSModule with KotlinTestPackageTests { + object test extends KotlinJsModule with KotlinTestPackageTests { override def allSourceFiles = super.allSourceFiles() .filter(!_.path.toString().endsWith("HelloKotestTests.kt")) } diff --git a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSKotlinVersionsTests.scala b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsKotlinVersionsTests.scala similarity index 77% rename from kotlinlib/test/src/mill/kotlinlib/js/KotlinJSKotlinVersionsTests.scala rename to kotlinlib/test/src/mill/kotlinlib/js/KotlinJsKotlinVersionsTests.scala index 1e324361836..6f5372a6916 100644 --- a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSKotlinVersionsTests.scala +++ b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsKotlinVersionsTests.scala @@ -6,22 +6,22 @@ import mill.testkit.{TestBaseModule, UnitTester} import mill.Cross import utest.{TestSuite, Tests, test} -object KotlinJSKotlinVersionsTests extends TestSuite { +object KotlinJsKotlinVersionsTests extends TestSuite { private val resourcePath = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "kotlin-js" private val kotlinLowestVersion = "1.8.20" private val kotlinHighestVersion = mill.kotlinlib.Versions.kotlinVersion private val kotlinVersions = Seq(kotlinLowestVersion, kotlinHighestVersion) - trait KotlinJSCrossModule extends KotlinJSModule with Cross.Module[String] { + trait KotlinJsCrossModule extends KotlinJsModule with Cross.Module[String] { def kotlinVersion = crossValue } - trait KotlinJSFooCrossModule extends KotlinJSCrossModule { + trait KotlinJsFooCrossModule extends KotlinJsCrossModule { override def moduleDeps = Seq(module.bar(crossValue), module.qux(crossValue)) } - trait KotlinJSQuxCrossModule extends KotlinJSCrossModule { + trait KotlinJsQuxCrossModule extends KotlinJsCrossModule { override def ivyDeps = { // 0.10+ cannot be built with Kotlin 1.8 (it was built with Kotlin 1.9.10 itself). ABI incompatibility? val kotlinxHtmlVersion = crossValue.split("\\.").map(_.toInt) match { @@ -35,9 +35,9 @@ object KotlinJSKotlinVersionsTests extends TestSuite { } object module extends TestBaseModule { - object foo extends Cross[KotlinJSFooCrossModule](kotlinVersions) - object bar extends Cross[KotlinJSCrossModule](kotlinVersions) - object qux extends Cross[KotlinJSQuxCrossModule](kotlinVersions) + object foo extends Cross[KotlinJsFooCrossModule](kotlinVersions) + object bar extends Cross[KotlinJsCrossModule](kotlinVersions) + object qux extends Cross[KotlinJsQuxCrossModule](kotlinVersions) } private def testEval() = UnitTester(module, resourcePath) diff --git a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSLinkTests.scala b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsLinkTests.scala similarity index 83% rename from kotlinlib/test/src/mill/kotlinlib/js/KotlinJSLinkTests.scala rename to kotlinlib/test/src/mill/kotlinlib/js/KotlinJsLinkTests.scala index 928a3fcb49e..6161c91b75c 100644 --- a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSLinkTests.scala +++ b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsLinkTests.scala @@ -6,14 +6,14 @@ import utest.{TestSuite, Tests, assert, test} import scala.util.Random -object KotlinJSLinkTests extends TestSuite { +object KotlinJsLinkTests extends TestSuite { private val kotlinVersion = "1.9.25" private val resourcePath = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "kotlin-js" - trait KotlinJSCrossModule extends KotlinJSModule with Cross.Module[Boolean] { - override def kotlinVersion = KotlinJSLinkTests.kotlinVersion + trait KotlinJsCrossModule extends KotlinJsModule with Cross.Module[Boolean] { + override def kotlinVersion = KotlinJsLinkTests.kotlinVersion override def splitPerModule: T[Boolean] = crossValue override def kotlinJSBinaryKind: T[Option[BinaryKind]] = Some(BinaryKind.Executable) override def moduleDeps = Seq(module.bar) @@ -21,11 +21,11 @@ object KotlinJSLinkTests extends TestSuite { object module extends TestBaseModule { - object bar extends KotlinJSModule { - def kotlinVersion = KotlinJSLinkTests.kotlinVersion + object bar extends KotlinJsModule { + def kotlinVersion = KotlinJsLinkTests.kotlinVersion } - object foo extends Cross[KotlinJSCrossModule](Seq(true, false)) + object foo extends Cross[KotlinJsCrossModule](Seq(true, false)) } private def testEval() = UnitTester(module, resourcePath) diff --git a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSNodeRunTests.scala b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsNodeRunTests.scala similarity index 94% rename from kotlinlib/test/src/mill/kotlinlib/js/KotlinJSNodeRunTests.scala rename to kotlinlib/test/src/mill/kotlinlib/js/KotlinJsNodeRunTests.scala index dbc3adc31c2..8075194da38 100644 --- a/kotlinlib/test/src/mill/kotlinlib/js/KotlinJSNodeRunTests.scala +++ b/kotlinlib/test/src/mill/kotlinlib/js/KotlinJsNodeRunTests.scala @@ -6,7 +6,7 @@ import mill.eval.EvaluatorPaths import mill.testkit.{TestBaseModule, UnitTester} import utest.{TestSuite, Tests, test} -object KotlinJSNodeRunTests extends TestSuite { +object KotlinJsNodeRunTests extends TestSuite { private val resourcePath = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "kotlin-js" private val kotlinVersion = "1.9.25" @@ -19,9 +19,9 @@ object KotlinJSNodeRunTests extends TestSuite { modules <- Seq("no", "plain", "es", "amd", "commonjs", "umd") } yield (splits, modules) - trait KotlinJsModuleKindCross extends KotlinJSModule with Cross.Module2[Boolean, String] { + trait KotlinJsModuleKindCross extends KotlinJsModule with Cross.Module2[Boolean, String] { - def kotlinVersion = KotlinJSNodeRunTests.kotlinVersion + def kotlinVersion = KotlinJsNodeRunTests.kotlinVersion override def moduleKind = crossValue2 match { case "no" => ModuleKind.NoModule @@ -37,8 +37,8 @@ object KotlinJSNodeRunTests extends TestSuite { override def kotlinJSRunTarget = Some(RunTarget.Node) } - object bar extends KotlinJSModule { - def kotlinVersion = KotlinJSNodeRunTests.kotlinVersion + object bar extends KotlinJsModule { + def kotlinVersion = KotlinJsNodeRunTests.kotlinVersion } object foo extends Cross[KotlinJsModuleKindCross](matrix)