Skip to content

Commit

Permalink
Merge pull request #1497 from Friendseeker/sbt#7883
Browse files Browse the repository at this point in the history
[1.x] Print `javac` options in debug log
  • Loading branch information
eed3si9n authored Nov 15, 2024
2 parents ced4262 + ac27bfb commit f8cf093
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 f8cf093

Please sign in to comment.