|
| 1 | +import sbt._ |
| 2 | +import Keys._ |
| 3 | +import Process._ |
| 4 | + |
| 5 | +object DottyBuild extends Build { |
| 6 | + |
| 7 | + val defaults = Defaults.defaultSettings ++ Seq( |
| 8 | + // set sources to src/, tests to test/ and resources to resources/ |
| 9 | + scalaSource in Compile := baseDirectory.value / "src", |
| 10 | + javaSource in Compile := baseDirectory.value / "src", |
| 11 | + scalaSource in Test := baseDirectory.value / "test", |
| 12 | + javaSource in Test := baseDirectory.value / "test", |
| 13 | + resourceDirectory in Compile := baseDirectory.value / "resources", |
| 14 | + unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value), |
| 15 | + unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value), |
| 16 | + |
| 17 | + // include sources in eclipse (downloads source code for all dependencies) |
| 18 | + //http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728 |
| 19 | + com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys.withSource := true, |
| 20 | + |
| 21 | + // to get Scala 2.11 |
| 22 | + resolvers += Resolver.sonatypeRepo("releases"), |
| 23 | + |
| 24 | + // get reflect and xml onboard |
| 25 | + libraryDependencies ++= Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value, |
| 26 | + "org.scala-lang.modules" %% "scala-xml" % "1.0.0-RC7"), |
| 27 | + |
| 28 | + // get junit onboard |
| 29 | + libraryDependencies += "com.novocode" % "junit-interface" % "0.9" % "test", |
| 30 | + |
| 31 | + // scalac options |
| 32 | + scalacOptions in Global ++= Seq("-feature", "-deprecation", "-language:_"), |
| 33 | + |
| 34 | + // Adjust classpath for running dotty |
| 35 | + mainClass in (Compile, run) := Some("dotty.tools.dotc.Main"), |
| 36 | + fork in run := true, |
| 37 | + fork in Test := true, |
| 38 | + // http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala |
| 39 | + javaOptions <++= (managedClasspath in Runtime, packageBin in Compile) map { (attList, bin) => |
| 40 | + // put the Scala {library, reflect, compiler} in the classpath |
| 41 | + val path = for { |
| 42 | + file <- attList.map(_.data) |
| 43 | + path = file.getAbsolutePath |
| 44 | + } yield "-Xbootclasspath/p:" + path |
| 45 | + // dotty itself needs to be in the bootclasspath |
| 46 | + val fullpath = ("-Xbootclasspath/a:" + bin) :: path.toList |
| 47 | + // System.err.println("BOOTPATH: " + fullpath) |
| 48 | + fullpath |
| 49 | + } |
| 50 | + ) |
| 51 | + |
| 52 | + lazy val dotty = Project(id = "dotty", base = file("."), settings = defaults) |
| 53 | +} |
0 commit comments