aboutsummaryrefslogtreecommitdiff
path: root/project/Build.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-02-16 18:58:58 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-04-13 19:41:44 +0200
commit476778612e71379cf648693f7d02039301fb5607 (patch)
treea6d27763253f9de38ba03e155450039c9b6cead5 /project/Build.scala
parent0fe56ea73e6775a315f54772dc6bfb40815c7c98 (diff)
downloaddotty-476778612e71379cf648693f7d02039301fb5607.tar.gz
dotty-476778612e71379cf648693f7d02039301fb5607.tar.bz2
dotty-476778612e71379cf648693f7d02039301fb5607.zip
Fix #2184: Hyper Bootstrap! Integrate the backend as a git submodule
The backend lives in the scalac fork at https://github.com/lampepfl/scala/tree/sharing-backend. Before this commit, the scala-compiler built from this fork was a dependency of Scala just to get this backend. This made it much more cumbersome to test changes to the backend and also forced us to depend on Scala 2.11.5 since that is the version of scalac that the forked backend is based on. This commit changes this by adding a git submodule in the `scala-backend` directory that points to the scalac fork. We do not compile the whole submodule, instead we add the subset of files we need to the dotty-compiler project in the sbt build. See backend.md for more information (online at http://dotty.epfl.ch/docs/contributing/backend.html) once this commit is merged. The most important thing to note is that whenever you clone dotty you should do `git clone --recursive` to also clone the submodule. If you already have a cloned dotty you'll need to do: git submodule update --init You will need to repeat this command anytime you update dotty and the backend has been updated, otherwise the content of `scala-backend` will be stale.
Diffstat (limited to 'project/Build.scala')
-rw-r--r--project/Build.scala37
1 files changed, 25 insertions, 12 deletions
diff --git a/project/Build.scala b/project/Build.scala
index 8b1c0e31e..cc6b5a6c3 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -31,8 +31,6 @@ object Build {
val JENKINS_BUILD = "dotty.jenkins.build"
val DRONE_MEM = "dotty.drone.mem"
- val scalaCompiler = "me.d-d" % "scala-compiler" % "2.11.5-20170111-125332-40bdc7b65a"
-
val agentOptions = List(
// "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
// "-agentpath:/home/dark/opt/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so"
@@ -243,6 +241,26 @@ object Build {
// Settings shared between dotty-compiler and dotty-compiler-bootstrapped
lazy val dottyCompilerSettings = Seq(
+ // The scala-backend folder is a git submodule that contains a fork of the Scala 2.11
+ // compiler developed at https://github.com/lampepfl/scala/tree/sharing-backend.
+ // We do not compile the whole submodule, only the part of the Scala 2.11 GenBCode backend
+ // that we reuse for dotty.
+ // See http://dotty.epfl.ch/docs/contributing/backend.html for more information.
+ unmanagedSourceDirectories in Compile ++= {
+ val backendDir = baseDirectory.value / ".." / "scala-backend" / "src" / "compiler" / "scala" / "tools" / "nsc" / "backend"
+ val allScalaFiles = GlobFilter("*.scala")
+
+ // NOTE: Keep these exclusions synchronized with the ones in the tests (CompilationTests.scala)
+ ((backendDir *
+ (allScalaFiles - "JavaPlatform.scala" - "Platform.scala" - "ScalaPrimitives.scala")) +++
+ (backendDir / "jvm") *
+ (allScalaFiles - "BCodeICodeCommon.scala" - "GenASM.scala" - "GenBCode.scala" - "ScalacBackendInterface.scala")
+ ).get
+ },
+
+ // Used by the backend
+ libraryDependencies += "org.scala-lang.modules" % "scala-asm" % "5.1.0-scala-2",
+
// set system in/out for repl
connectInput in run := true,
outputStrategy := Some(StdoutOutput),
@@ -261,8 +279,7 @@ object Build {
// get libraries onboard
resolvers += Resolver.typesafeIvyRepo("releases"), // For org.scala-sbt:interface
- libraryDependencies ++= Seq(scalaCompiler,
- "org.scala-sbt" % "interface" % sbtVersion.value,
+ libraryDependencies ++= Seq("org.scala-sbt" % "interface" % sbtVersion.value,
"org.scala-lang.modules" %% "scala-xml" % "1.0.1",
"com.novocode" % "junit-interface" % "0.11" % "test",
"org.scala-lang" % "scala-reflect" % scalacVersion,
@@ -394,10 +411,10 @@ object Build {
if path.contains("scala-library") ||
// FIXME: currently needed for tests referencing scalac internals
path.contains("scala-reflect") ||
- // FIXME: currently needed for tests referencing scalac internals
- path.contains("scala-compile") ||
// FIXME: should go away when xml literal parsing is removed
path.contains("scala-xml") ||
+ // used for tests that compile dotty
+ path.contains("scala-asm") ||
// needed for the xsbti interface
path.contains("org.scala-sbt/interface/")
} yield "-Xbootclasspath/p:" + path
@@ -631,10 +648,7 @@ object DottyInjectedPlugin extends AutoPlugin {
baseDirectory in (Test,run) := (baseDirectory in `dotty-compiler`).value,
- libraryDependencies ++= Seq(
- scalaCompiler % Test,
- "com.storm-enroute" %% "scalameter" % "0.6" % Test
- ),
+ libraryDependencies += "com.storm-enroute" %% "scalameter" % "0.6" % Test,
fork in Test := true,
parallelExecution in Test := false,
@@ -686,8 +700,7 @@ object DottyInjectedPlugin extends AutoPlugin {
// depend on one of these projects.
lazy val `scala-compiler` = project.
settings(
- crossPaths := false,
- libraryDependencies := Seq(scalaCompiler)
+ crossPaths := false
).
settings(publishing)
lazy val `scala-reflect` = project.