Skip to content

Commit 3a59592

Browse files
committed
Log IRCache stats once at the end of each run
This is much simpler and good enough. It also will not force us to expose a strange setting in the next commit.
1 parent 328e74a commit 3a59592

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPlugin.scala

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,6 @@ object ScalaJSPlugin extends AutoPlugin {
171171

172172
import autoImport._
173173

174-
/** Logs the current statistics about the global IR cache. */
175-
def logIRCacheStats(logger: Logger): Unit = {
176-
import ScalaJSPluginInternal.globalIRCache
177-
logger.debug("Global IR cache stats: " + globalIRCache.stats.logLine)
178-
}
179-
180174
override def globalSettings: Seq[Setting[_]] = {
181175
Seq(
182176
scalaJSStage := Stage.FastOpt,
@@ -187,12 +181,15 @@ object ScalaJSPlugin extends AutoPlugin {
187181

188182
// Clear the IR cache stats every time a sequence of tasks ends
189183
onComplete := {
184+
import ScalaJSPluginInternal.globalIRCache
185+
190186
val prev = onComplete.value
191187

192188
{ () =>
193189
prev()
194190
ScalaJSPluginInternal.closeAllTestAdapters()
195-
ScalaJSPluginInternal.globalIRCache.clearStats()
191+
sLog.value.debug("Global IR cache stats: " + globalIRCache.stats.logLine)
192+
globalIRCache.clearStats()
196193
}
197194
},
198195

sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPluginInternal.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import sjsonnew.BasicJsonProtocol.seqFormat
4848
private[sbtplugin] object ScalaJSPluginInternal {
4949

5050
import ScalaJSPlugin.autoImport.{ModuleKind => _, _}
51-
import ScalaJSPlugin.logIRCacheStats
5251

5352
/** The global Scala.js IR cache */
5453
val globalIRCache: IRFileCache = StandardImpl.irFileCache()
@@ -216,8 +215,6 @@ private[sbtplugin] object ScalaJSPluginInternal {
216215
throw new MessageOnlyException(e.getMessage)
217216
}
218217

219-
logIRCacheStats(log)
220-
221218
Set(output, sourceMapFile)
222219
} (realFiles.toSet)
223220

@@ -310,8 +307,6 @@ private[sbtplugin] object ScalaJSPluginInternal {
310307
new IRTreePrinter(stdout).print(tree)
311308
stdout.flush()
312309
}
313-
314-
logIRCacheStats(streams.value.log)
315310
},
316311

317312
artifactPath in fastOptJS :=

0 commit comments

Comments
 (0)