@@ -28,6 +28,12 @@ class HotSbtBenchmark {
28
28
@ Param (value = Array (" 0.13.15" ))
29
29
var sbtVersion : String = _
30
30
31
+ @ Param (value = Array (" " ))
32
+ var extraBuild : String = _
33
+
34
+ @ Param (value= Array (" compile" ))
35
+ var compileCmd : String = _
36
+
31
37
// This parameter is set by ScalacBenchmarkRunner / UploadingRunner based on the Scala version.
32
38
// When running the benchmark directly the "latest" symlink is used.
33
39
@ Param (value = Array (" latest" ))
@@ -42,6 +48,19 @@ class HotSbtBenchmark {
42
48
var processInputReader : BufferedWriter = _
43
49
var output = new java.lang.StringBuilder ()
44
50
51
+ def compileRawSetting = if (sbtVersion.startsWith(" 1." )) " " else
52
+ """
53
+ |val compileRaw = taskKey[Unit]("Compile directly, bypassing the incremental compiler")
54
+ |
55
+ |def addCompileRaw = compileRaw := {
56
+ | val compiler = new sbt.compiler.RawCompiler(scalaInstance.value, sbt.ClasspathOptions.auto, streams.value.log)
57
+ | classDirectory.value.mkdirs()
58
+ | compiler.apply(sources.value, classDirectory.value +: dependencyClasspath.value.map(_.data), classDirectory.value, scalacOptions.value)
59
+ | }
60
+ |
61
+ |inConfig(Compile)(List(addCompileRaw))
62
+ """ .stripMargin
63
+
45
64
def buildDef =
46
65
s """
47
66
|scalaHome := Some(file(" ${scalaHome.toAbsolutePath.toString}"))
@@ -55,6 +74,12 @@ class HotSbtBenchmark {
55
74
|libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value
56
75
|libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
57
76
|
77
+ |traceLevel := Int.MaxValue
78
+ |traceLevel in runMain := Int.MaxValue
79
+ |
80
+ | $compileRawSetting
81
+ |
82
+ | $extraBuild
58
83
|// TODO support .java sources
59
84
""" .stripMargin
60
85
@@ -79,7 +104,7 @@ class HotSbtBenchmark {
79
104
80
105
@ Benchmark
81
106
def compile (): Unit = {
82
- issue(" ;cleanClasses;compile " )
107
+ issue(s " ;cleanClasses; $compileCmd " )
83
108
awaitPrompt()
84
109
}
85
110
0 commit comments