Skip to content

Commit

Permalink
Split Kotlin and Java compilation messages with count (#102)
Browse files Browse the repository at this point in the history
Pull Request: #102
  • Loading branch information
lefou authored Oct 23, 2023
1 parent ba13857 commit 3d9362d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
13 changes: 10 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ trait MillKotlinModule extends PublishModule with ScoverageModule with Cross.Mod
override def publishVersion: T[String] = VcsVersion.vcsState().format()
override def artifactSuffix: T[String] = s"_mill${millPlatform}_${artifactScalaVersion()}"

override def javacOptions = Seq("-source", "1.8", "-target", "1.8", "-encoding", "UTF-8")
override def javacOptions = {
val release =
if (scala.util.Properties.isJavaAtLeast(11)) Seq("-release", "8")
else Seq("-source", "1.8", "-target", "1.8")
release ++ Seq("-encoding", "UTF-8", "-deprecation")
}
override def scalacOptions = Seq("-target:jvm-1.8", "-encoding", "UTF-8", "-deprecation")

override def scoverageVersion = deps.scoverageVersion

def pomSettings = T {
Expand All @@ -96,8 +102,9 @@ object main extends Cross[MainCross](millApiVersions.map(_._1))
trait MainCross extends MillKotlinModule {
override def artifactName = "de.tobiasroeser.mill.kotlin"
override def moduleDeps: Seq[PublishModule] = Seq(worker)
override def ivyDeps = Agg(
ivy"${scalaOrganization()}:scala-library:${scalaVersion()}")
override def ivyDeps = Agg(
ivy"${scalaOrganization()}:scala-library:${scalaVersion()}"
)
override def sources = T.sources {
val suffixes =
ZincWorkerUtil.matchingVersions(millPlatform) ++
Expand Down
11 changes: 6 additions & 5 deletions main/src/de/tobiasroeser/mill/kotlin/KotlinModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,13 @@ trait KotlinModule extends JavaModule with KotlinModulePlatform { outer =>
val isJava = javaSourceFiles.nonEmpty
val isMixed = isKotlin && isJava

val counts = Seq("Kotlin" -> kotlinSourceFiles.size, "Java" -> javaSourceFiles.size)
ctx.log.info(
s"Compiling ${counts.filter(_._2 > 0).map { case (n, c) => s"$c $n" }.mkString(" and ")} sources to ${classes} ..."
)

val compileCp = compileClasspath().map(_.path).filter(os.exists)
val updateCompileOutput = upstreamCompileOutput()

def compileJava: Result[CompilationResult] = {
ctx.log.info(
s"Compiling ${javaSourceFiles.size} Java sources to ${classes} ..."
)
// The compile step is lazy, but it's dependencies are not!
internalCompileJavaFiles(
worker = zincWorkerRef().worker(),
Expand All @@ -164,6 +162,9 @@ trait KotlinModule extends JavaModule with KotlinModulePlatform { outer =>
}

if (isMixed || isKotlin) {
ctx.log.info(
s"Compiling ${kotlinSourceFiles.size} Kotlin sources to ${classes} ..."
)
val compilerArgs: Seq[String] = Seq(
// destdir
Seq("-d", classes.toIO.getAbsolutePath()),
Expand Down

0 comments on commit 3d9362d

Please sign in to comment.