Skip to content

Commit f8cf093

Browse files
authored
Merge pull request #1497 from Friendseeker/sbt#7883
[1.x] Print `javac` options in debug log
2 parents ced4262 + ac27bfb commit f8cf093

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala

+8-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import xsbti.{
3232

3333
import sbt.util.InterfaceUtil
3434
import sbt.util.Logger
35+
import xsbt.Log.debug
3536

3637
/**
3738
* Define a Java compiler that reports on any discovered source dependencies or
@@ -165,18 +166,19 @@ final class AnalyzingJavaCompiler private[sbt] (
165166
options,
166167
scalaInstance,
167168
classpathOptions
168-
)
169+
).toArray
169170
val javaSources: Array[VirtualFile] =
170171
sources.sortBy(_.id).toArray
172+
debug(log, prettyPrintCompilationArguments(args))
171173
val success =
172-
javac.run(javaSources, args.toArray, output, incToolOptions, reporter, log)
174+
javac.run(javaSources, args, output, incToolOptions, reporter, log)
173175
if (!success) {
174176
/* Assume that no Scalac problems are reported for a Javac-related
175177
* reporter. This relies on the incremental compiler will not run
176178
* Javac compilation if Scala compilation fails, which means that
177179
* the same reporter won't be used for `AnalyzingJavaCompiler`. */
178180
val msg = "javac returned non-zero exit code"
179-
throw new CompileFailed(args.toArray, msg, reporter.problems())
181+
throw new CompileFailed(args, msg, reporter.problems())
180182
}
181183
}
182184

@@ -264,4 +266,7 @@ final class AnalyzingJavaCompiler private[sbt] (
264266
log.debug(label + " took " + (elapsed / 1e9) + " s")
265267
result
266268
}
269+
270+
private def prettyPrintCompilationArguments(args: Array[String]) =
271+
args.mkString("[zinc] The Java compiler is invoked with:\n\t", "\n\t", "")
267272
}

0 commit comments

Comments
 (0)