Skip to content

Commit 92f3cd5

Browse files
committed
introduce -with-compiler and merge with user -classpath
1 parent 8ea863b commit 92f3cd5

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

bench/src/main/scala/Benchmarks.scala

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,20 @@ object Bench {
5353
def removeCompileOptions: Unit = new File(COMPILE_OPTS_FILE).delete()
5454

5555
def storeCompileOptions(args: Array[String]): Unit = {
56-
val libs = System.getProperty("BENCH_CLASS_PATH")
56+
val standard_libs = System.getProperty("BENCH_CLASS_PATH")
57+
val compiler_libs = System.getProperty("BENCH_COMPILER_CLASS_PATH")
58+
59+
val libs = if (args.contains("-with-compiler")) compiler_libs else standard_libs
60+
var argsNorm = args.filter(_ != "-with-compiler")
61+
62+
var cpIndex = argsNorm.indexOf("-classpath")
63+
if (cpIndex == -1) cpIndex = argsNorm.indexOf("-cp")
64+
if (cpIndex != -1) argsNorm(cpIndex + 1) = argsNorm(cpIndex + 1) + ":" + libs
65+
else argsNorm = argsNorm :+ "-classpath" :+ libs
5766

5867
val file = new File(COMPILE_OPTS_FILE)
5968
val bw = new BufferedWriter(new FileWriter(file))
60-
bw.write(args.mkString("", "\n", "\n"))
61-
bw.write("-classpath\n")
62-
bw.write(libs)
69+
bw.write(argsNorm.mkString("", "\n", "\n"))
6370
bw.close()
6471
}
6572

project/Build.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ object Build {
302302
lazy val commonBenchmarkSettings = Seq(
303303
outputStrategy := Some(StdoutOutput),
304304
mainClass in (Jmh, run) := Some("dotty.tools.benchmarks.Bench"), // custom main for jmh:run
305-
javaOptions += "-DBENCH_CLASS_PATH=" + Attributed.data((fullClasspath in Compile).value).mkString("", ":", "")
305+
javaOptions += "-DBENCH_COMPILER_CLASS_PATH=" + Attributed.data((fullClasspath in (`dotty-bootstrapped`, Compile)).value).mkString("", ":", ""),
306+
javaOptions += "-DBENCH_CLASS_PATH=" + Attributed.data((fullClasspath in (`dotty-library-bootstrapped`, Compile)).value).mkString("", ":", "")
306307
)
307308

308309
// sbt >= 0.13.12 will automatically rewrite transitive dependencies on

0 commit comments

Comments
 (0)