Skip to content

Commit 7b32a68

Browse files
committed
Factor compiler jar path settings
1 parent 4a1bd37 commit 7b32a68

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

project/Build.scala

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,29 @@ object Build {
431431
def findArtifactPath(classpath: Def.Classpath, name: String): String =
432432
findArtifact(classpath, name).getAbsolutePath
433433

434+
// Settings shared between dotty-compiler, dotty-compiler-bootstrapped and dotty-staging
435+
lazy val commonDottyJarClasspathSettings = Seq(
436+
// http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
437+
// packageAll should always be run before tests
438+
javaOptions ++= {
439+
val externalDeps = externalCompilerClasspathTask.value
440+
val jars = packageAll.in(LocalProject("dotty-compiler-bootstrapped")).value
441+
442+
List(
443+
"-Ddotty.tests.classes.dottyInterfaces=" + jars("dotty-interfaces"),
444+
"-Ddotty.tests.classes.dottyLibrary=" + jars("dotty-library"),
445+
"-Ddotty.tests.classes.dottyCompiler=" + jars("dotty-compiler"),
446+
"-Ddotty.tests.classes.compilerInterface=" + findArtifactPath(externalDeps, "compiler-interface"),
447+
"-Ddotty.tests.classes.scalaLibrary=" + findArtifactPath(externalDeps, "scala-library"),
448+
"-Ddotty.tests.classes.scalaAsm=" + findArtifactPath(externalDeps, "scala-asm"),
449+
"-Ddotty.tests.classes.jlineTerminal=" + findArtifactPath(externalDeps, "jline-terminal"),
450+
"-Ddotty.tests.classes.jlineReader=" + findArtifactPath(externalDeps, "jline-reader")
451+
)
452+
}
453+
)
454+
434455
// Settings shared between dotty-compiler and dotty-compiler-bootstrapped
435-
lazy val commonDottyCompilerSettings = Seq(
456+
lazy val commonDottyCompilerSettings = commonDottyJarClasspathSettings ++ Seq(
436457
// set system in/out for repl
437458
connectInput in run := true,
438459
outputStrategy := Some(StdoutOutput),
@@ -490,9 +511,6 @@ object Build {
490511
// http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
491512
// packageAll should always be run before tests
492513
javaOptions ++= {
493-
val externalDeps = externalCompilerClasspathTask.value
494-
val jars = packageAll.value
495-
496514
val ci_build = // propagate if this is a ci build
497515
sys.props.get("dotty.drone.mem") match {
498516
case Some(prop) => List("-Xmx" + prop)
@@ -512,19 +530,10 @@ object Build {
512530
(sourceManaged in Compile).value
513531
}
514532

515-
val jarOpts = List(
516-
"-Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir,
517-
"-Ddotty.tests.classes.dottyInterfaces=" + jars("dotty-interfaces"),
518-
"-Ddotty.tests.classes.dottyLibrary=" + jars("dotty-library"),
519-
"-Ddotty.tests.classes.dottyCompiler=" + jars("dotty-compiler"),
520-
"-Ddotty.tests.classes.compilerInterface=" + findArtifactPath(externalDeps, "compiler-interface"),
521-
"-Ddotty.tests.classes.scalaLibrary=" + findArtifactPath(externalDeps, "scala-library"),
522-
"-Ddotty.tests.classes.scalaAsm=" + findArtifactPath(externalDeps, "scala-asm"),
523-
"-Ddotty.tests.classes.jlineTerminal=" + findArtifactPath(externalDeps, "jline-terminal"),
524-
"-Ddotty.tests.classes.jlineReader=" + findArtifactPath(externalDeps, "jline-reader")
525-
)
533+
val jarOpt =
534+
"-Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir
526535

527-
jarOpts ::: tuning ::: agentOptions ::: ci_build
536+
jarOpt :: tuning ::: agentOptions ::: ci_build
528537
},
529538

530539
testCompilation := Def.inputTaskDyn {
@@ -754,23 +763,13 @@ object Build {
754763
dependsOn(dottyCompiler(Bootstrapped)).
755764
dependsOn(dottyCompiler(Bootstrapped) % "test->test").
756765
settings(commonBootstrappedSettings).
766+
settings(commonDottyJarClasspathSettings).
757767
settings(
758768
fork in run := true,
759769
fork in Test := true,
760770
javaOptions ++= {
761-
val externalDeps = externalCompilerClasspathTask.value
762771
val jars = packageAll.in(`dotty-compiler-bootstrapped`).value
763-
List(
764-
"-Ddotty.tests.classes.dottyInterfaces=" + jars("dotty-interfaces"),
765-
"-Ddotty.tests.classes.dottyLibrary=" + jars("dotty-library"),
766-
"-Ddotty.tests.classes.dottyCompiler=" + jars("dotty-compiler"),
767-
"-Ddotty.tests.classes.dottyStaging=" + jars("dotty-staging"),
768-
"-Ddotty.tests.classes.compilerInterface=" + findArtifactPath(externalDeps, "compiler-interface"),
769-
"-Ddotty.tests.classes.scalaLibrary=" + findArtifactPath(externalDeps, "scala-library"),
770-
"-Ddotty.tests.classes.scalaAsm=" + findArtifactPath(externalDeps, "scala-asm"),
771-
"-Ddotty.tests.classes.jlineTerminal=" + findArtifactPath(externalDeps, "jline-terminal"),
772-
"-Ddotty.tests.classes.jlineReader=" + findArtifactPath(externalDeps, "jline-reader")
773-
)
772+
List("-Ddotty.tests.classes.dottyStaging=" + jars("dotty-staging"))
774773
}
775774
)
776775

0 commit comments

Comments
 (0)