aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorSébastien Doeraene <sjrdoeraene@gmail.com>2016-03-04 22:02:18 +0100
committerSébastien Doeraene <sjrdoeraene@gmail.com>2016-03-04 22:02:18 +0100
commit902479264127c7aa9f478e1145ad0e037bf83665 (patch)
tree42fae736d508d6f27bd056c977ebebcbe6cd97fc /project
parent18505cb2061235dba1b064b9379164e2a48254a6 (diff)
downloaddotty-902479264127c7aa9f478e1145ad0e037bf83665.tar.gz
dotty-902479264127c7aa9f478e1145ad0e037bf83665.tar.bz2
dotty-902479264127c7aa9f478e1145ad0e037bf83665.zip
Add the sources of scalajs-ir to dotty instead of its binaries.
This guarantees that we can bootstrap dotty without depending on the binaries of scalajs-ir compiled by another Scala compiler.
Diffstat (limited to 'project')
-rw-r--r--project/Build.scala34
1 files changed, 32 insertions, 2 deletions
diff --git a/project/Build.scala b/project/Build.scala
index 4a22f3d82..d6c39d2ef 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -83,8 +83,6 @@ object DottyBuild extends Build {
"org.scala-lang.modules" %% "scala-partest" % "1.0.11" % "test",
"com.novocode" % "junit-interface" % "0.11" % "test",
"jline" % "jline" % "2.12"),
- libraryDependencies +=
- "org.scala-js" %% "scalajs-ir" % scalaJSVersion,
// enable improved incremental compilation algorithm
incOptions := incOptions.value.withNameHashing(true),
@@ -116,6 +114,38 @@ object DottyBuild extends Build {
runTask(Test, "dotty.partest.DPConsoleRunner", dottyJars + " " + args.mkString(" "))
},
+ /* Add the sources of scalajs-ir.
+ * To guarantee that dotty can bootstrap without depending on a version
+ * of scalajs-ir built with a different Scala compiler, we add its
+ * sources instead of depending on the binaries.
+ */
+ ivyConfigurations += config("sourcedeps").hide,
+ libraryDependencies +=
+ "org.scala-js" %% "scalajs-ir" % scalaJSVersion % "sourcedeps",
+ sourceGenerators in Compile += Def.task {
+ val s = streams.value
+ val cacheDir = s.cacheDirectory
+ val trgDir = (sourceManaged in Compile).value / "scalajs-ir-src"
+
+ val report = updateClassifiers.value
+ val scalaJSIRSourcesJar = report.select(
+ configuration = Set("sourcedeps"),
+ module = (_: ModuleID).name.startsWith("scalajs-ir_"),
+ artifact = artifactFilter(`type` = "src")).headOption.getOrElse {
+ sys.error(s"Could not fetch scalajs-ir sources")
+ }
+
+ FileFunction.cached(cacheDir / s"fetchScalaJSIRSource",
+ FilesInfo.lastModified, FilesInfo.exists) { dependencies =>
+ s.log.info(s"Unpacking scalajs-ir sources to $trgDir...")
+ if (trgDir.exists)
+ IO.delete(trgDir)
+ IO.createDirectory(trgDir)
+ IO.unzip(scalaJSIRSourcesJar, trgDir)
+ (trgDir ** "*.scala").get.toSet
+ } (Set(scalaJSIRSourcesJar)).toSeq
+ }.taskValue,
+
// Adjust classpath for running dotty
mainClass in (Compile, run) := Some("dotty.tools.dotc.Main"),
fork in run := true,