Clear compiler cache in clearCaches

Resident compilation actually works pretty well most of the time*,
but if there ever is an issue with the cached compilation, we should be
able to easily clear the cache.

* I've only had issues when package objects are involved
This commit is contained in:
Ethan Atkins 2019-01-30 18:52:52 -08:00
parent f14bc7a503
commit f44e2a2e74
1 changed files with 2 additions and 1 deletions

View File

@ -837,6 +837,7 @@ object BuiltinCommands {
}
def registerCompilerCache(s: State): State = {
s.get(Keys.stateCompilerCache).foreach(_.clear())
val maxCompilers = System.getProperty("sbt.resident.limit")
val cache =
if (maxCompilers == null)
@ -875,7 +876,7 @@ object BuiltinCommands {
def clearCaches: Command = {
val help = Help.more(ClearCaches, ClearCachesDetailed)
Command.command(ClearCaches, help)(registerGlobalCaches)
Command.command(ClearCaches, help)(registerGlobalCaches _ andThen registerCompilerCache)
}
def shell: Command = Command.command(Shell, Help.more(Shell, ShellDetailed)) { s0 =>