@@ -21,7 +21,8 @@ trait BaseBenchmarkDriver {
21
21
def depsClasspath : String
22
22
def tempDir : File
23
23
def corpusSourcePath : Path
24
- def compilerArgs : Array [String ]
24
+ def compilerArgs : List [String ]
25
+ def sourceFiles : List [String ]
25
26
}
26
27
27
28
@ State (Scope .Benchmark )
@@ -39,39 +40,7 @@ class ScalacBenchmark extends BenchmarkDriver {
39
40
40
41
var depsClasspath : String = _
41
42
42
- def compileImpl (): Unit = {
43
-
44
- // MainClass is copy-pasted from compiler for source compatibility with 2.10.x - 2.13.x
45
- class MainClass extends Driver with EvalLoop {
46
- def resident (compiler : Global ): Unit = loop { line =>
47
- val command = new CompilerCommand (line split " \\ s+" toList, new Settings (scalacError))
48
- compiler.reporter.reset()
49
- new compiler.Run () compile command.files
50
- }
51
-
52
- override def newCompiler (): Global = Global (settings, reporter)
53
-
54
- override protected def processSettingsHook (): Boolean = {
55
- if (source == " scala" )
56
- settings.sourcepath.value = Paths .get(s " ../corpus/ $source/ $corpusVersion/library " ).toAbsolutePath.normalize.toString
57
- else
58
- settings.usejavacp.value = true
59
- settings.outdir.value = tempDir.getAbsolutePath
60
- settings.nowarn.value = true
61
- if (depsClasspath != null )
62
- settings.processArgumentString(s " -cp $depsClasspath" )
63
- true
64
- }
65
- }
66
- val driver = new MainClass
67
-
68
- val extras = if (extraArgs != null && extraArgs != " " ) extraArgs.split('|' ).toList else Nil
69
- val allArgs = compilerArgs ++ extras ++ sourceFiles
70
- driver.process(allArgs.toArray)
71
- assert(! driver.reporter.hasErrors)
72
- }
73
-
74
- def compilerArgs : List [String ] = if (source.startsWith(" @" )) List (source) else Nil
43
+ def compilerArgs : List [String ] = if (source.startsWith(" @" )) source :: Nil else Nil
75
44
76
45
def sourceFiles : List [String ] =
77
46
if (source.startsWith(" @" )) Nil
@@ -81,7 +50,7 @@ class ScalacBenchmark extends BenchmarkDriver {
81
50
val files = allFiles.filter(f => {
82
51
val name = f.getFileName.toString
83
52
name.endsWith(" .scala" ) || name.endsWith(" .java" )
84
- }).map(_.toAbsolutePath.normalize.toString).toList
53
+ }).map(_.toAbsolutePath.normalize.toString)
85
54
files
86
55
}
87
56
0 commit comments