Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split kotlin and java compilation messages with count #102

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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