mirror of https://github.com/sbt/sbt.git
continuations test for compiler plugin support
This commit is contained in:
parent
ed27a8077d
commit
fe75bade98
|
|
@ -8,8 +8,8 @@ object CacheTest extends Properties("Cache")
|
|||
implicit val functions: Arbitrary[Int => Int] = Arbitrary { Gen.elements(identity[Int], i => -i, i=>i/2, i => i+1) }
|
||||
|
||||
property("Cache") = Prop.forAll { (key: Int, keys: List[Int], map: Int => Int) =>
|
||||
val cache = new Cache(map)
|
||||
def toProperty(key: Int) = ("Key " + key) |: ("Value: " + map(key)) |: (cache.apply(key) == map(key))
|
||||
val cache = new Cache( (i: Int, _: Unit) => map(i) )
|
||||
def toProperty(key: Int) = ("Key " + key) |: ("Value: " + map(key)) |: (cache.apply(key, ()) == map(key))
|
||||
Prop.all( keys.map(toProperty) : _*)
|
||||
}
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ object Defaults
|
|||
mainClass <<= discoveredMainClasses map selectPackageMain,
|
||||
run <<= runTask(fullClasspath, mainClass in run, runner in run),
|
||||
runMain <<= runMainTask(fullClasspath, runner in run),
|
||||
scaladocOptions <<= scalacOptions(identity),
|
||||
scaladocOptions :== scalacOptions,
|
||||
doc <<= docTask,
|
||||
copyResources <<= copyResourcesTask
|
||||
)
|
||||
|
|
@ -744,9 +744,6 @@ object Classpaths
|
|||
import DependencyFilter._
|
||||
def managedJars(config: Configuration, jarTypes: Set[String], up: UpdateReport): Classpath = up.select( configuration = configurationFilter(config.name), artifact = artifactFilter(`type` = jarTypes) )
|
||||
|
||||
def autoPlugins(inputs: Compiler.Inputs, report: UpdateReport): Compiler.Inputs =
|
||||
inputs.copy(config = inputs.config.copy(options = autoPlugins(report) ++ inputs.config.options))
|
||||
|
||||
def autoPlugins(report: UpdateReport): Seq[String] =
|
||||
{
|
||||
val pluginClasspath = report matching configurationFilter(CompilerPlugin.name)
|
||||
|
|
@ -754,8 +751,8 @@ object Classpaths
|
|||
}
|
||||
|
||||
lazy val compilerPluginConfig = Seq(
|
||||
compileInputs <<= (compileInputs, autoCompilerPlugins, update) map { (inputs, auto, report) =>
|
||||
if(auto) autoPlugins(inputs, report) else inputs
|
||||
scalacOptions <<= (scalacOptions, autoCompilerPlugins, update) map { (options, auto, report) =>
|
||||
if(auto) options ++ autoPlugins(report) else options
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ object Keys
|
|||
// compile/doc keys
|
||||
val autoCompilerPlugins = SettingKey[Boolean]("auto-compiler-plugins")
|
||||
val maxErrors = SettingKey[Int]("max-errors")
|
||||
val scaladocOptions = SettingKey[Seq[String]]("scaladoc-options")
|
||||
val scalacOptions = SettingKey[Seq[String]]("scalac-options")
|
||||
val scaladocOptions = TaskKey[Seq[String]]("scaladoc-options")
|
||||
val scalacOptions = TaskKey[Seq[String]]("scalac-options")
|
||||
val javacOptions = SettingKey[Seq[String]]("javac-options")
|
||||
val compileOrder = SettingKey[CompileOrder.Value]("compile-order")
|
||||
val initialCommands = SettingKey[String]("initial-commands")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
scalaVersion := "2.8.1"
|
||||
|
||||
autoCompilerPlugins := true
|
||||
|
||||
addCompilerPlugin("org.scala-lang.plugins" % "continuations" % "2.8.1")
|
||||
|
||||
scalacOptions += "-P:continuations:enable"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"junit" % "junit" % "4.7" % "test",
|
||||
"com.novocode" % "junit-interface" % "0.5" % "test"
|
||||
)
|
||||
|
||||
initialCommands := """assert(Example.x == 20)"""
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
project.name=Continuations
|
||||
project.version=0.1
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class Continuations(info: ProjectInfo) extends DefaultProject(info) with AutoCompilerPlugins
|
||||
{
|
||||
val cont = compilerPlugin("org.scala-lang.plugins" % "continuations" % "2.8.0.RC1")
|
||||
override def compileOptions = super.compileOptions ++ compileOptions("-P:continuations:enable")
|
||||
|
||||
val junit = "junit" % "junit" % "4.7" % "test"
|
||||
val bryanjswift = "Bryan J Swift Repository" at "http://repos.bryanjswift.com/maven2/"
|
||||
val junitInterface = "com.novocode" % "junit-interface" % "0.4.0" % "test"
|
||||
|
||||
override def consoleInit = """assert(Examples.x == 20)"""
|
||||
}
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
> ++2.8.0.RC1
|
||||
> update
|
||||
> compile
|
||||
> console
|
||||
> test-only ContinuationsTest
|
||||
Loading…
Reference in New Issue