Skip to content

Commit

Permalink
Print javac options in debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendseeker committed Nov 14, 2024
1 parent ced4262 commit ac27bfb
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import xsbti.{

import sbt.util.InterfaceUtil
import sbt.util.Logger
import xsbt.Log.debug

/**
* Define a Java compiler that reports on any discovered source dependencies or
Expand Down Expand Up @@ -165,18 +166,19 @@ final class AnalyzingJavaCompiler private[sbt] (
options,
scalaInstance,
classpathOptions
)
).toArray
val javaSources: Array[VirtualFile] =
sources.sortBy(_.id).toArray
debug(log, prettyPrintCompilationArguments(args))
val success =
javac.run(javaSources, args.toArray, output, incToolOptions, reporter, log)
javac.run(javaSources, args, output, incToolOptions, reporter, log)
if (!success) {
/* Assume that no Scalac problems are reported for a Javac-related
* reporter. This relies on the incremental compiler will not run
* Javac compilation if Scala compilation fails, which means that
* the same reporter won't be used for `AnalyzingJavaCompiler`. */
val msg = "javac returned non-zero exit code"
throw new CompileFailed(args.toArray, msg, reporter.problems())
throw new CompileFailed(args, msg, reporter.problems())
}
}

Expand Down Expand Up @@ -264,4 +266,7 @@ final class AnalyzingJavaCompiler private[sbt] (
log.debug(label + " took " + (elapsed / 1e9) + " s")
result
}

private def prettyPrintCompilationArguments(args: Array[String]) =
args.mkString("[zinc] The Java compiler is invoked with:\n\t", "\n\t", "")
}

0 comments on commit ac27bfb

Please sign in to comment.