Skip to content

Commit 1e5b275

Browse files
authored
Merge pull request #47 from retronym/topic/smaller-classpath
Only automatically put scala-{library,compiler,reflect}.jar on the classpath
2 parents 83b3619 + 8ea0aae commit 1e5b275

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compilation/src/main/scalac/scala/tools/benchmark/BenchmarkDriver.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
package scala.tools.benchmark
22

3+
import java.io.File
34
import java.nio.file._
5+
46
import scala.tools.nsc._
57

68
trait BenchmarkDriver extends BaseBenchmarkDriver {
79
private var driver: MainClass = _
810
private var files: List[String] = _
911

12+
private def findScalaJars = {
13+
sys.props("java.class.path").split(File.pathSeparatorChar).filter(_.matches(""".*\bscala-(reflect|compiler|library).*\.jar""")).mkString(":")
14+
}
15+
1016
// MainClass is copy-pasted from compiler for source compatibility with 2.10.x - 2.13.x
1117
private class MainClass extends Driver with EvalLoop {
1218
var compiler: Global = _
@@ -15,11 +21,12 @@ trait BenchmarkDriver extends BaseBenchmarkDriver {
1521
compiler
1622
}
1723

24+
1825
override protected def processSettingsHook(): Boolean = {
1926
if (source == "scala")
2027
settings.sourcepath.value = Paths.get(s"../corpus/$source/$corpusVersion/library").toAbsolutePath.normalize.toString
2128
else
22-
settings.usejavacp.value = true
29+
settings.classpath.value = findScalaJars
2330
settings.outdir.value = tempDir.getAbsolutePath
2431
settings.nowarn.value = true
2532
if (depsClasspath != null)

0 commit comments

Comments
 (0)