From ac27bfbe4312df0f1cca15f9b236b51a13ac3d5e Mon Sep 17 00:00:00 2001 From: friendseeker <66892505+Friendseeker@users.noreply.github.com> Date: Thu, 14 Nov 2024 09:56:41 -0800 Subject: [PATCH] Print javac options in debug log --- .../internal/inc/javac/AnalyzingJavaCompiler.scala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala b/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala index 2ae4c34cd..a7b6faa78 100644 --- a/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala +++ b/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala @@ -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 @@ -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()) } } @@ -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", "") }