Direct assignment of our reporter into the global reporter field results in occasional sbt exceptions like:
java.lang.ClassCastException: com.softwaremill.clippy.DelegatingReporter cannot be cast to xsbt.DelegatingReporter
at xsbt.CachedCompiler0$Compiler.logUnreportedWarnings(CompilerInterface.scala:224)
at xsbt.CachedCompiler0.processUnreportedWarnings(CompilerInterface.scala:145)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:117)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
It's caused by sbt delegating reporter doing a direct cast of global reporter in the CachedCompiler.logUnreportedWarnings functions.
This PR introduces a custom compilation phase injected between parser and namer. This phase will replace global repoter with Clippy's one and looks like SBT won't do the casting afterwards.
However, our custom phase won't get injected when compilation is started from tests, so I added another "undocumented" plugin option testmode. When true, the reporter assignment will happen as previously.
Direct assignment of our reporter into the global reporter field results in occasional sbt exceptions like:
It's caused by sbt delegating reporter doing a direct cast of global reporter in the
CachedCompiler.logUnreportedWarnings
functions. This PR introduces a custom compilation phase injected betweenparser
andnamer
. This phase will replace global repoter with Clippy's one and looks like SBT won't do the casting afterwards.However, our custom phase won't get injected when compilation is started from tests, so I added another "undocumented" plugin option
testmode
. Whentrue
, the reporter assignment will happen as previously.