|
| 1 | +//// SNIPPET:BUILD1 |
| 2 | +package build |
| 3 | +import mill._, kotlinlib._ |
| 4 | +import os._ |
| 5 | + |
| 6 | +object foo extends KotlinModule { |
| 7 | + def kotlinVersion = "1.9.24" // Specify your Kotlin version |
| 8 | + |
| 9 | + object test extends KotlinTests { |
| 10 | + def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" // Use JUnit 5 framework |
| 11 | + def mvnDeps = Seq( |
| 12 | + // JUnit 5 dependencies |
| 13 | + mvn"org.junit.jupiter:junit-jupiter-api:5.10.0", |
| 14 | + mvn"org.junit.jupiter:junit-jupiter-engine:5.10.0", |
| 15 | + // Test runner interface for Mill/sbt |
| 16 | + mvn"com.github.sbt.junit:jupiter-interface:0.13.3" |
| 17 | + ) |
| 18 | + } |
| 19 | + |
| 20 | + def replaceBar(args: String*) = Task.Command { |
| 21 | + val relativePath = os.RelPath("../../../foo/src/Bar.kt") |
| 22 | + val filePath = T.dest / relativePath |
| 23 | + os.write.over(filePath, os.read(filePath).replace( |
| 24 | + """return "Hi, $name!"""", |
| 25 | + """return "Ciao, $name!"""" |
| 26 | + )) |
| 27 | + } |
| 28 | + |
| 29 | + def replaceFooTest2(args: String*) = Task.Command { |
| 30 | + val relativePath = os.RelPath("../../../foo/test/src/FooTest2.kt") |
| 31 | + val filePath = T.dest / relativePath |
| 32 | + os.write.over(filePath, os.read(filePath).replace( |
| 33 | + """assertEquals("Hi, $name!", greeted)""", |
| 34 | + """assertEquals("Ciao, $name!", greeted)""" |
| 35 | + )) |
| 36 | + } |
| 37 | +} |
| 38 | +//// SNIPPET:END |
0 commit comments