Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Conversation

@kciesielski
Copy link
Member

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.


override val global = superGlobal

override val runsAfter = List[String](" parser")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it intentionally " parser" not just "parser"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a typo :) Fixed

val DeltaEnd = AnsiReset
val DeltaStart = AnsiRed
val DeltaEnd = Console.RESET
val DeltaStart = Console.RED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@adamw adamw merged commit 9620098 into softwaremill:master Jan 12, 2017
@kciesielski kciesielski mentioned this pull request Jan 12, 2017
@adamw
Copy link
Member

adamw commented Jan 12, 2017

0.3.6 released

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants