Skip to content

Commit

Permalink
Rename KotlinJS to KotlinJs (#3801)
Browse files Browse the repository at this point in the history
Fix #3771
  • Loading branch information
lefou authored Oct 21, 2024
1 parent ffe0609 commit a3ec3e5
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 47 deletions.
4 changes: 2 additions & 2 deletions example/kotlinlib/web/3-hello-kotlinjs/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down
2 changes: 1 addition & 1 deletion example/kotlinlib/web/4-webapp-kotlinjs/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions example/kotlinlib/web/5-webapp-kotlinjs-shared/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -63,15 +63,15 @@ 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",
)
}
}

object client extends AppKotlinJSModule {
object client extends AppKotlinJsModule {
def splitPerModule = false
def moduleDeps = Seq(shared.js)
def ivyDeps = Agg(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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()}"
)
Expand All @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ 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"

private val resourcePath = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "kotlin-js"

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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ 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"

private val kotlinVersion = "1.9.25"

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"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ 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"

private val kotlinVersion = "1.9.25"

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"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ 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)
}

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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit a3ec3e5

Please sign in to comment.