Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Last active July 31, 2025 10:19
Show Gist options
  • Save xuwei-k/d5cb85c4e1024cf25ef424b497768090 to your computer and use it in GitHub Desktop.
Save xuwei-k/d5cb85c4e1024cf25ef424b497768090 to your computer and use it in GitHub Desktop.
import sjsonnew.BasicJsonProtocol._
import sbinary.DefaultProtocol._
val classFileCount = TaskKey[Int]("classFileCount")
Seq(Compile, Test).map { scope =>
scope / classFileCount := {
val s = streams.value.log
val dir = (scope / classDirectory).value
val current = (dir ** "*.class").get().size
val id = thisProject.value.id
val currentCount = s"[$id] current $current"
(scope / classFileCount).previous match {
case Some(previous) =>
s.info(s"$currentCount, previous $previous, diff ${current - previous}")
case None =>
s.info(currentCount)
}
current
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment