@@ -48,11 +48,12 @@ object DottyBuild extends Build {
4848 incOptions := incOptions.value.withNameHashing(true ),
4949
5050 // enable verbose exception messages for JUnit
51- // JUnit from sbt only generates partest files, doesn't run tests
52- testOptions += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" , " --run-listener=test.ContextEscapeDetector" ,
53- " --exclude-categories=dotty.partest." + (if (isTravisBuild) " " else " Non" ) + " PartestTarget" ),
54- // test generates files, then we run partest
55- partest <<= runTask(Test , " dotty.partest.DPConsoleRunner" , " " ) dependsOn (test in Test ),
51+ testOptions in Test += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" , " --run-listener=test.ContextEscapeDetector" ),
52+ // when this file is present, running test generates the files for partest
53+ // otherwise it just executes the tests directly
54+ createPartestFile := { new java.io.File (" ./tests" , " runPartest.flag" ).createNewFile },
55+ runPartestRunner <<= runTask(Test , " dotty.partest.DPConsoleRunner" , " " ) dependsOn (test in Test ),
56+ deletePartestFile := { new java.io.File (" ./tests" , " runPartest.flag" ).delete },
5657
5758 // Adjust classpath for running dotty
5859 mainClass in (Compile , run) := Some (" dotty.tools.dotc.Main" ),
@@ -83,9 +84,7 @@ object DottyBuild extends Build {
8384
8485 tuning ::: agentOptions ::: travis_build ::: fullpath
8586 }
86- ) ++ (if (isTravisBuild) Seq () else addCommandAlias(" test" , " partest" ))
87- // alias so that "sbt test" executes partest (which dependsOn test) - no
88- // circular dependency because the setting is evaluated before
87+ ) ++ addCommandAlias(" partest" , " ;createPartestFile;runPartestRunner;deletePartestFile" )
8988
9089 lazy val dotty = Project (id = " dotty" , base = file(" ." ), settings = defaults)
9190
@@ -134,5 +133,8 @@ object DottyBuild extends Build {
134133 lazy val benchmarks = Project (id = " dotty-bench" , settings = benchmarkSettings,
135134 base = file(" bench" )) dependsOn(dotty % " compile->test" )
136135
137- lazy val partest = TaskKey [Unit ](" partest" , " Runs test and partests" )
136+ lazy val createPartestFile = TaskKey [Unit ](" createPartestFile" , " Creates the tests/runPartest.flag file" )
137+ lazy val runPartestRunner = TaskKey [Unit ](" runPartestRunner" , " Runs partests" )
138+ lazy val deletePartestFile = TaskKey [Unit ](" deletePartestFile" , " Deletes the tests/runPartest.flag file" )
139+
138140}
0 commit comments