Skip to content

Commit aad81eb

Browse files
author
Vlad Ureche
committed
Merge pull request #6 from VladUreche/topic/build
Build infrastructure
2 parents 0e8d0bb + 426128d commit aad81eb

File tree

8 files changed

+118
-13
lines changed

8 files changed

+118
-13
lines changed

.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
*.class
2+
*.log
3+
4+
# sbt specific
5+
dist/*
6+
target/
7+
lib_managed/
8+
src_managed/
9+
project/boot/
10+
project/plugins/project/
11+
project/local-plugins.sbt
12+
.history
13+
14+
# Scala-IDE specific
15+
.scala_dependencies
16+
.cache
17+
.classpath
18+
.project
19+
.settings
20+
bin/
21+
22+
# idea
23+
.idea
24+
.idea_modules

build.sbt

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
12
name := "dotty"
23

3-
organization := "lamp"
4+
scalaVersion in Global := "2.11.0-M7"
45

5-
scalaVersion := "2.10.0"
6+
version in Global := "0.1-SNAPSHOT"
67

7-
scalaSource in Compile <<= baseDirectory / "src"
8+
organization in Global := "org.scala-lang"
89

9-
scalacOptions in Global ++= Seq("-feature", "-deprecation", "-language:_")
10+
organizationName in Global := "LAMP/EPFL"
1011

11-
libraryDependencies <+= scalaVersion ( sv => "org.scala-lang" % "scala-reflect" % sv )
12+
organizationHomepage in Global := Some(url("http://lamp.epfl.ch"))
1213

13-
scalaSource in Test <<= baseDirectory / "test"
14+
homepage in Global := Some(url("http://scala-lang.org"))

examples/hello.scala

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package hello
2+
3+
object world extends App {
4+
println("hello dotty!")
5+
}

gitignore.SAMPLE

-5
This file was deleted.

project/Build.scala

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
}

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.12.2
1+
sbt.version=0.13.0

project/plugins.sbt

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
// Add personal SBT plugins for IDEs, etc to `local-plugins.sbt`
22
//
33
// e.g. addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.1.0")
4+
5+
// Scala IDE project file generator
6+
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")

readme.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
dotty
22
=====
33

4-
The experimental compiler for a Scala dialect based on DOT
4+
The experimental compiler for a Scala dialect based on DOT.
5+
6+
### To get started:
7+
```
8+
sbt compile
9+
sbt run
10+
sbt test
11+
```
12+
At least half of the tests fail, we need to diagnose them.
13+
14+
15+
### To use the Scala IDE:
16+
```
17+
sbt eclipse
18+
```
19+
Notes:
20+
* You will need the Scala IDE for 2.11.0-M7
21+
* There are 2 spurious version incompatibility warnings
22+
* To run dotty in Eclipse:
23+
* Navigate to `dotty.tools.dotc.Main`
24+
* `Run As...` > `Scala Application`
25+
* then go to `Run Configurations` > `Main$` > `Classpath` > `Bootstrap entries`:
26+
* add the Scala library (`Advanced...` > `Add library...` > `Scala library`)
27+
* add the dotty classfiles (`Add projects...` > `[x] dotty`)
28+
* then go to `Run Configurations` > `Main$` > `Arguments` and add `${project_loc}/examples/hello.scala`

0 commit comments

Comments
 (0)