Skip to content

Commit

Permalink
Cleanup Kotlin classes
Browse files Browse the repository at this point in the history
  • Loading branch information
lefou committed Oct 14, 2024
1 parent 43dc23e commit b7f1c66
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions kotlinlib/src/mill/kotlinlib/KotlinModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ trait KotlinModule extends JavaModule { outer =>
)
val compilerArgs: Seq[String] = Seq(
// destdir
Seq("-d", classes.toIO.getAbsolutePath()),
Seq("-d", classes.toString()),
// classpath
when(compileCp.iterator.nonEmpty)(
"-classpath",
Expand All @@ -253,7 +253,7 @@ trait KotlinModule extends JavaModule { outer =>
(kotlinSourceFiles ++ javaSourceFiles).map(_.toIO.getAbsolutePath())
).flatten

val workerResult = kotlinWorkerTask().compile(KotlinWorkerTarget.Jvm, compilerArgs: _*)
val workerResult = kotlinWorkerTask().compile(KotlinWorkerTarget.Jvm, compilerArgs)

val analysisFile = dest / "kotlin.analysis.dummy"
os.write(target = analysisFile, data = "", createFolders = true)
Expand Down Expand Up @@ -325,11 +325,10 @@ trait KotlinModule extends JavaModule { outer =>
/**
* A test sub-module linked to its parent module best suited for unit-tests.
*/
trait KotlinTests extends JavaModuleTests with KotlinModule {
trait KotlinTests extends JavaTests with KotlinModule {
override def kotlinVersion: T[String] = Task { outer.kotlinVersion() }
override def kotlinCompilerVersion: T[String] = Task { outer.kotlinCompilerVersion() }
override def kotlincOptions: T[Seq[String]] = Task { outer.kotlincOptions() }
override def defaultCommandName(): String = super.defaultCommandName()
}

}
2 changes: 1 addition & 1 deletion kotlinlib/src/mill/kotlinlib/PlatformKotlinModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ trait PlatformKotlinModule extends KotlinModule {
override def sources: T[Seq[PathRef]] = Task.Sources {
super.sources().flatMap { source =>
val platformPath =
PathRef(source.path / _root_.os.up / s"${source.path.last}-$platformKotlinSuffix")
PathRef(source.path / os.up / s"${source.path.last}-$platformKotlinSuffix")
Seq(source, platformPath)
}
}
Expand Down
2 changes: 1 addition & 1 deletion kotlinlib/src/mill/kotlinlib/js/KotlinJSModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ trait KotlinJSModule extends KotlinModule { outer =>
} else {
T.log.info(s"Linking IR to $compileDestination")
}
val workerResult = worker.compile(KotlinWorkerTarget.Js, compilerArgs: _*)
val workerResult = worker.compile(KotlinWorkerTarget.Js, compilerArgs)

val analysisFile = T.dest / "kotlin.analysis.dummy"
if (!os.exists(analysisFile)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler

class KotlinWorkerImpl extends KotlinWorker {

def compile(target: KotlinWorkerTarget, args: String*)(implicit ctx: Ctx): Result[Unit] = {
def compile(target: KotlinWorkerTarget, args: Seq[String])(implicit ctx: Ctx): Result[Unit] = {
ctx.log.debug("Using kotlin compiler arguments: " + args.map(v => s"'${v}'").mkString(" "))

val compiler = target match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import mill.api.{Ctx, Result}

trait KotlinWorker {

def compile(target: KotlinWorkerTarget, args: String*)(implicit ctx: Ctx): Result[Unit]
def compile(target: KotlinWorkerTarget, args: Seq[String])(implicit ctx: Ctx): Result[Unit]

}

Expand Down

0 comments on commit b7f1c66

Please sign in to comment.