aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-01-11 00:50:50 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-01-27 13:57:58 +0100
commitcbe6846fc789f2f5e233e82972e38ee672fa3931 (patch)
treef6107dc14c69eae153ab7bfade557c2fb16925a4 /project
parent6419a0668b3d4e0bfd42f9a1f69fde66a3944fd6 (diff)
downloaddotty-cbe6846fc789f2f5e233e82972e38ee672fa3931.tar.gz
dotty-cbe6846fc789f2f5e233e82972e38ee672fa3931.tar.bz2
dotty-cbe6846fc789f2f5e233e82972e38ee672fa3931.zip
Add sbt-based bootstrap
This adds two new project to the sbt build: dotty-library-bootstrapped and dotty-compiler bootstrapped. These projects use the same source files as dotty-library and dotty-compiler but are compiled using dotty itself. The main usecase for this is that we can now run the JUnit tests (which are _not_ just a subset of the tests run by partest, for example the REPL tests are only run through JUnit) with a bootstrapped compiler: $ sbt > publishLocal # Non-bootstrapped dotty needs to be published first > dotty-compiler-bootstrapped/test But this also allows one to experiment with a bootstrapped dotty much more easily in general. This revealed many issues in the compiler that are fixed in subsequent commits in this PR.
Diffstat (limited to 'project')
-rw-r--r--project/Build.scala146
1 files changed, 96 insertions, 50 deletions
diff --git a/project/Build.scala b/project/Build.scala
index de4ab563f..4c8854267 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -11,8 +11,17 @@ import sbt.Package.ManifestAttributes
object DottyBuild extends Build {
- val baseVersion = "0.1.1"
- val isNightly = sys.env.get("NIGHTLYBUILD") == Some("yes")
+ val scalacVersion = "2.11.5"
+
+ val dottyOrganization = "ch.epfl.lamp"
+ val dottyVersion = {
+ val baseVersion = "0.1.1"
+ val isNightly = sys.env.get("NIGHTLYBUILD") == Some("yes")
+ if (isNightly)
+ baseVersion + "-" + VersionUtil.commitDate + "-" + VersionUtil.gitHash + "-NIGHTLY"
+ else
+ baseVersion + "-SNAPSHOT"
+ }
val jenkinsMemLimit = List("-Xmx1500m")
@@ -45,14 +54,9 @@ object DottyBuild extends Build {
override def settings: Seq[Setting[_]] = {
super.settings ++ Seq(
- scalaVersion in Global := "2.11.5",
- version in Global := {
- if (isNightly)
- baseVersion + "-" + VersionUtil.commitDate + "-" + VersionUtil.gitHash + "-NIGHTLY"
- else
- baseVersion + "-SNAPSHOT"
- },
- organization in Global := "ch.epfl.lamp",
+ scalaVersion in Global := scalacVersion,
+ version in Global := dottyVersion,
+ organization in Global := dottyOrganization,
organizationName in Global := "LAMP/EPFL",
organizationHomepage in Global := Some(url("http://lamp.epfl.ch")),
homepage in Global := Some(url("https://github.com/lampepfl/dotty")),
@@ -82,6 +86,17 @@ object DottyBuild extends Build {
resourceDirectory in Compile := baseDirectory.value / "resources"
)
+ // Settings used by all dotty-compiled projects
+ lazy val commonBootstrappedSettings = Seq(
+ scalaOrganization := dottyOrganization,
+ scalaVersion := dottyVersion,
+ scalaBinaryVersion := "2.11",
+ scalaCompilerBridgeSource :=
+ (dottyOrganization % "dotty-sbt-bridge" % scalaVersion.value % "component").sources(),
+
+ // sbt gets very unhappy if two projects use the same target
+ target := baseDirectory.value / ".." / "out" / name.value
+ )
/** Projects -------------------------------------------------------------- */
@@ -141,25 +156,8 @@ object DottyBuild extends Build {
).
settings(publishing)
- lazy val `dotty-compiler` = project.in(file("compiler")).
- dependsOn(`dotty-interfaces`).
- dependsOn(`dotty-library`).
- settings(sourceStructure).
- settings(
- overrideScalaVersionSetting,
-
- // Disable scaladoc generation, it's way too slow and we'll replace it
- // by dottydoc anyway. We still publish an empty -javadoc.jar to make
- // sonatype happy.
- sources in (Compile, doc) := Seq(),
-
- // necessary evil: dottydoc currently needs to be included in the dotty
- // project, for sbt integration
- unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),
- unmanagedSourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "src",
- unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value),
- unmanagedSourceDirectories in Test += baseDirectory.value / ".." / "doc-tool" / "test",
-
+ // Settings shared between dotty-compiler and dotty-compiler-bootstrapped
+ lazy val dottyCompilerSettings = Seq(
// set system in/out for repl
connectInput in run := true,
outputStrategy := Some(StdoutOutput),
@@ -178,28 +176,18 @@ object DottyBuild extends Build {
// get libraries onboard
partestDeps := Seq(scalaCompiler,
- "org.scala-lang" % "scala-reflect" % scalaVersion.value,
- "org.scala-lang" % "scala-library" % scalaVersion.value % "test"),
+ "org.scala-lang" % "scala-reflect" % scalacVersion,
+ "org.scala-lang" % "scala-library" % scalacVersion % "test"),
libraryDependencies ++= partestDeps.value,
libraryDependencies ++= Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.1",
"org.scala-lang.modules" %% "scala-partest" % "1.0.11" % "test",
- "ch.epfl.lamp" % "dottydoc-client" % "0.1.0",
+ dottyOrganization % "dottydoc-client" % "0.1.0",
"com.novocode" % "junit-interface" % "0.11" % "test",
"com.github.spullara.mustache.java" % "compiler" % "0.9.3",
"com.typesafe.sbt" % "sbt-interface" % sbtVersion.value),
// enable improved incremental compilation algorithm
incOptions := incOptions.value.withNameHashing(true),
- // packageAll packages all and then returns a map with the abs location
- packageAll := {
- Map(
- "dotty-interfaces" -> (packageBin in (`dotty-interfaces`, Compile)).value,
- "dotty-compiler" -> (packageBin in Compile).value,
- "dotty-library" -> (packageBin in (`dotty-library`, Compile)).value,
- "dotty-compiler-test" -> (packageBin in Test).value
- ) map { case (k, v) => (k, v.getAbsolutePath) }
- },
-
// For convenience, change the baseDirectory when running the compiler
baseDirectory in (Compile, run) := baseDirectory.value / "..",
// .. but not when running partest
@@ -274,8 +262,8 @@ object DottyBuild extends Build {
val args = Def.spaceDelimited("<arg>").parsed
val jars = List(
(packageBin in Compile).value.getAbsolutePath,
- (packageBin in (`dotty-library`, Compile)).value.getAbsolutePath,
- (packageBin in (`dotty-interfaces`, Compile)).value.getAbsolutePath
+ packageAll.value("dotty-library"),
+ packageAll.value("dotty-interfaces")
) ++ getJarPaths(partestDeps.value, ivyPaths.value.ivyHome)
val dottyJars =
s"""-dottyJars ${jars.length + 2} dotty.jar dotty-lib.jar ${jars.mkString(" ")}"""
@@ -364,9 +352,59 @@ object DottyBuild extends Build {
("-DpartestParentID=" + pid) :: jars ::: tuning ::: agentOptions ::: ci_build ::: path.toList
}
+ )
+
+ lazy val `dotty-compiler` = project.in(file("compiler")).
+ dependsOn(`dotty-interfaces`).
+ dependsOn(`dotty-library`).
+ settings(sourceStructure).
+ settings(dottyCompilerSettings).
+ settings(
+ overrideScalaVersionSetting,
+
+ // necessary evil: dottydoc currently needs to be included in the dotty
+ // project, for sbt integration
+ // FIXME: note part of dottyCompilerSettings because the doc-tool does not
+ // compile with dotty
+ unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),
+ unmanagedSourceDirectories in Compile += baseDirectory.value / ".." / "doc-tool" / "src",
+ unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value),
+ unmanagedSourceDirectories in Test += baseDirectory.value / ".." / "doc-tool" / "test",
+
+ // Disable scaladoc generation, it's way too slow and we'll replace it
+ // by dottydoc anyway. We still publish an empty -javadoc.jar to make
+ // sonatype happy.
+ sources in (Compile, doc) := Seq(),
+
+ // packageAll packages all and then returns a map with the abs location
+ packageAll := {
+ Map(
+ "dotty-interfaces" -> (packageBin in (`dotty-interfaces`, Compile)).value,
+ "dotty-compiler" -> (packageBin in Compile).value,
+ "dotty-library" -> (packageBin in (`dotty-library`, Compile)).value,
+ "dotty-compiler-test" -> (packageBin in Test).value
+ ) map { case (k, v) => (k, v.getAbsolutePath) }
+ }
).
settings(publishing)
+ lazy val `dotty-compiler-bootstrapped` = project.in(file("compiler")).
+ dependsOn(`dotty-library-bootstrapped`).
+ settings(sourceStructure).
+ settings(commonBootstrappedSettings).
+ settings(dottyCompilerSettings).
+ settings(
+ // Used instead of "dependsOn(`dotty-interfaces`)" because the latter breaks sbt somehow
+ libraryDependencies += scalaOrganization.value % "dotty-interfaces" % version.value,
+
+ packageAll := {
+ (packageAll in `dotty-compiler`).value ++ Seq(
+ ("dotty-compiler" -> (packageBin in Compile).value.getAbsolutePath),
+ ("dotty-library" -> (packageBin in (`dotty-library-bootstrapped`, Compile)).value.getAbsolutePath)
+ )
+ }
+ )
+
/* Contains unit tests for the scripts */
lazy val `dotty-bin-tests` = project.in(file("bin")).
settings(sourceStructure).
@@ -377,17 +415,25 @@ object DottyBuild extends Build {
"com.novocode" % "junit-interface" % "0.11" % "test"
)
- lazy val `dotty-library` = project.in(file("library")).
- settings(sourceStructure).
- settings(
+ // Settings shared between dotty-library and dotty-library-bootstrapped
+ lazy val dottyLibrarySettings = Seq(
libraryDependencies ++= Seq(
- "org.scala-lang" % "scala-reflect" % scalaVersion.value,
- "org.scala-lang" % "scala-library" % scalaVersion.value,
+ "org.scala-lang" % "scala-reflect" % scalacVersion,
+ "org.scala-lang" % "scala-library" % scalacVersion,
"com.novocode" % "junit-interface" % "0.11" % "test"
)
- ).
+ )
+
+ lazy val `dotty-library` = project.in(file("library")).
+ settings(sourceStructure).
+ settings(dottyLibrarySettings).
settings(publishing)
+ lazy val `dotty-library-bootstrapped` = project.in(file("library")).
+ settings(sourceStructure).
+ settings(commonBootstrappedSettings).
+ settings(dottyLibrarySettings)
+
// until sbt/sbt#2402 is fixed (https://github.com/sbt/sbt/issues/2402)
lazy val cleanSbtBridge = TaskKey[Unit]("cleanSbtBridge", "delete dotty-sbt-bridge cache")