Skip to content

Commit

Permalink
Merge pull request #4 from phaller/topic/sbt-build
Browse files Browse the repository at this point in the history
Topic/sbt build
  • Loading branch information
phaller committed Nov 5, 2012
2 parents d5409fd + 14ca71d commit ddb42b9
Show file tree
Hide file tree
Showing 39 changed files with 651 additions and 1,320 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
classes
target
.idea
.idea_modules
39 changes: 3 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,10 @@ Scala Async Project
Building
--------

The async macro can be built using the `build.sh` script.
It requires either Scala 2.10.0-RC1 or a nightly build of Scala 2.10.x.
The async macro and its test suite can be built and run with SBT.

Running the test suite
----------------------

Currently, the tests can be run using `partest` the testing tool used
to test the Scala compiler and standard library. At the moment,
running `partest` requires a working copy of the Scala compiler.

In the following it is assumed that the build of the Scala compiler is
located at `../scala` (root of the "scala" project when cloned using
git) relative to the root directory of the async project.

Moreover, in the Scala build it's necessary to copy the directory
"build/asm/classes/scala/tools/asm" into
"build/quick/classes/compiler/scala/tools".

Finally, it's necessary to set the following environment variables:

```
SCALAC_OPTS='-cp classes'
JAVA_OPTS='-cp classes'
```

After this setup, we can run `partest` as follows:

```
$ ../scala/test/partest --classpath ../scala/build/quick/classes --run
```

This runs all tests in the directory `test/files/run`.
It is also possible to run only a single test:

```
$ ../scala/test/partest --classpath ../scala/build/quick/classes test/files/run/await0
```
Contributing
------------

If you are interested in contributing code, we ask you to complete and submit
to us the Scala Contributor License Agreement, which allows us to ensure that
Expand Down
60 changes: 60 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
scalaVersion := "2.10.0-RC1"

organization := "org.typesafe.async"

name := "scala-async"

version := "0.1-SNAPSHOT"

libraryDependencies <++= (scalaVersion) {
sv => Seq(
"org.scala-lang" % "scala-reflect" % sv,
"org.scala-lang" % "scala-compiler" % sv % "test"
)
}

libraryDependencies += "junit" % "junit-dep" % "4.10" % "test"

libraryDependencies += "com.novocode" % "junit-interface" % "0.10-M2" % "test"

testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v", "-s")

autoCompilerPlugins := true

libraryDependencies <<= (scalaVersion, libraryDependencies) {
(ver, deps) =>
deps :+ compilerPlugin("org.scala-lang.plugins" % "continuations" % ver)
}

scalacOptions += "-P:continuations:enable"

scalacOptions ++= Seq("-deprecation", "-unchecked", "-Xlint")

description := "An asynchronous programminig facility for Scala, in the spirit of C# await/async"

homepage := Some(url("http://github.com/phaller/scala-async"))

startYear := Some(2012)

licenses +=("Scala license", url("http://github.com/phaller/scala-async/LICENCE"))

pomExtra := (
<developers>
<developer>
<id>phaller</id>
<name>Philipp Haller</name>
<timezone>+1</timezone>
<url>http://github.com/phaller</url>
</developer>
<developer>
<id>retronym</id>
<name>Jason Zaugg</name>
<timezone>+1</timezone>
<url>http://github.com/retronym</url>
</developer>
</developers>
<scm>
<url>git@github.com:phaller/scala-async.git/</url>
<connection>scm:git:git@github.com:phaller/scala-async.git</connection>
</scm>
)
Empty file.
File renamed without changes.
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=0.12.1
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ object Async extends AsyncUtils {
}
}
*/
val nonFatalModule = c.mirror.staticModule("scala.util.control.NonFatal")
val resumeFunTree: c.Tree = DefDef(Modifiers(), newTermName("resume"), List(), List(List()), Ident(definitions.UnitClass),
Try(Apply(Select(
Apply(Select(handlerExpr.tree, newTermName("orElse")), List(handlerForLastState.tree)),
newTermName("apply")), List(Ident(newTermName("state")))),
List(
CaseDef(
Apply(Select(Select(Select(Ident(newTermName("scala")), newTermName("util")), newTermName("control")), newTermName("NonFatal")), List(Bind(newTermName("t"), Ident(nme.WILDCARD)))),
Apply(Ident(nonFatalModule), List(Bind(newTermName("t"), Ident(nme.WILDCARD)))),
EmptyTree,
Block(List(
Apply(Select(Ident(newTermName("result")), newTermName("failure")), List(Ident(newTermName("t"))))),
Expand Down
File renamed without changes.
Loading

0 comments on commit ddb42b9

Please sign in to comment.