Merge pull request #1328 from gkossakowski/cleanup-incremental-tests

Cleanup incremental tests
This commit is contained in:
Josh Suereth 2014-05-13 14:52:47 -04:00
commit bb8bb1e667
3 changed files with 14 additions and 11 deletions

View File

@ -6,11 +6,13 @@ incOptions := incOptions.value.withAntStyle(true)
* a) checks in which compilation given set of files was recompiled * a) checks in which compilation given set of files was recompiled
* b) checks overall number of compilations performed * b) checks overall number of compilations performed
*/ */
TaskKey[Unit]("check-compilations") <<= (compile in Compile, scalaSource in Compile) map { (a: sbt.inc.Analysis, src: java.io.File) => TaskKey[Unit]("check-compilations") := {
def relative(f: java.io.File): java.io.File = f.relativeTo(src) getOrElse f val analysis = (compile in Compile).value
val allCompilations = a.compilations.allCompilations val srcDir = (scalaSource in Compile).value
def relative(f: java.io.File): java.io.File = f.relativeTo(srcDir) getOrElse f
val allCompilations = analysis.compilations.allCompilations
val recompiledFiles: Seq[Set[java.io.File]] = allCompilations map { c => val recompiledFiles: Seq[Set[java.io.File]] = allCompilations map { c =>
val recompiledFiles = a.apis.internal.collect { val recompiledFiles = analysis.apis.internal.collect {
case (file, api) if api.compilation.startTime == c.startTime => relative(file) case (file, api) if api.compilation.startTime == c.startTime => relative(file)
} }
recompiledFiles.toSet recompiledFiles.toSet

View File

@ -1,9 +1,8 @@
# introduces first compile iteration # introduces first compile iteration
> compile > compile
# this change is local to method and does not change api so introduces # remove A.foo method
# only one additional compile iteration
$ copy-file changes/A1.scala src/main/scala/A.scala $ copy-file changes/A1.scala src/main/scala/A.scala
# second iteration # recompiles just A.scala in Ant mode so it introduces one more iteration
> compile > compile
# check if there are only two compile iterations performed # check if there are only two compile iterations performed
> check-compilations > check-compilations

View File

@ -12,11 +12,13 @@ incOptions := incOptions.value.copy(recompileAllFraction = 1.0)
* a) checks in which compilation given set of files was recompiled * a) checks in which compilation given set of files was recompiled
* b) checks overall number of compilations performed * b) checks overall number of compilations performed
*/ */
TaskKey[Unit]("check-compilations") <<= (compile in Compile, scalaSource in Compile) map { (a: sbt.inc.Analysis, src: java.io.File) => TaskKey[Unit]("check-compilations") := {
def relative(f: java.io.File): java.io.File = f.relativeTo(src) getOrElse f val analysis = (compile in Compile).value
val allCompilations = a.compilations.allCompilations val srcDir = (scalaSource in Compile).value
def relative(f: java.io.File): java.io.File = f.relativeTo(srcDir) getOrElse f
val allCompilations = analysis.compilations.allCompilations
val recompiledFiles: Seq[Set[java.io.File]] = allCompilations map { c => val recompiledFiles: Seq[Set[java.io.File]] = allCompilations map { c =>
val recompiledFiles = a.apis.internal.collect { val recompiledFiles = analysis.apis.internal.collect {
case (file, api) if api.compilation.startTime == c.startTime => relative(file) case (file, api) if api.compilation.startTime == c.startTime => relative(file)
} }
recompiledFiles.toSet recompiledFiles.toSet