fix tests

This commit is contained in:
Mark Harrah 2011-05-28 17:02:16 -04:00
parent d81273a0c6
commit 14e91b1a17
42 changed files with 61 additions and 142 deletions

View File

@ -2,7 +2,7 @@ import sbt._
object SingleBuild extends Build with Marker object SingleBuild extends Build with Marker
{ {
lazy val projects = if(file("multi").exists) Seq(root, sub, sub2) else Seq(root) override def projects = if(file("multi").exists) Seq(root, sub, sub2) else Seq(root)
lazy val root = Project("root", file("."), aggregate = if(file("aggregate").exists) Seq(sub) else Nil ) lazy val root = Project("root", file("."), aggregate = if(file("aggregate").exists) Seq(sub) else Nil )
lazy val sub = Project("sub", file("sub"), aggregate = Seq(sub2)) lazy val sub = Project("sub", file("sub"), aggregate = Seq(sub2))
lazy val sub2 = Project("sub2", file("sub") / "sub") lazy val sub2 = Project("sub2", file("sub") / "sub")

View File

@ -3,7 +3,6 @@ import Keys._
object B extends Build object B extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
myRun, myRun,
fork in demo := true, fork in demo := true,

View File

@ -3,7 +3,6 @@
object ArtifactTest extends Build object ArtifactTest extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
publishTo := Some(Resolver.file("Test Publish Repo", file("test-repo"))), publishTo := Some(Resolver.file("Test Publish Repo", file("test-repo"))),

View File

@ -3,7 +3,6 @@
object ExcludeScala extends Build object ExcludeScala extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
libraryDependencies <++= baseDirectory(dependencies), libraryDependencies <++= baseDirectory(dependencies),
scalaVersion := "2.8.1", scalaVersion := "2.8.1",

View File

@ -3,12 +3,11 @@
object TestProject extends Build object TestProject extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
libraryDependencies <+= baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")), libraryDependencies <+= baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")),
TaskKey("check-transitive") <<= check(true), TaskKey[Unit]("check-transitive") <<= check(true),
TaskKey("check-intransitive") <<= check(false) TaskKey[Unit]("check-intransitive") <<= check(false)
) )
def transitive(dep: ModuleID)(base: File) = def transitive(dep: ModuleID)(base: File) =

View File

@ -4,15 +4,14 @@
object InfoTest extends Build object InfoTest extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
ivyXML <<= (customInfo, organization, moduleID, version) apply inlineXML, ivyXML <<= (customInfo, organization, moduleID, version) apply inlineXML,
projectID ~= (_ cross false), projectID ~= (_ cross false),
customInfo <<= baseDirectory{_ / "info" exists }, customInfo <<= baseDirectory{_ / "info" exists },
TaskKey("check-download") <<= checkDownload, TaskKey[Unit]("check-download") <<= checkDownload,
delivered <<= deliverLocal map XML.loadFile, delivered <<= deliverLocal map XML.loadFile,
TaskKey("check-info") <<= checkInfo TaskKey[Unit]("check-info") <<= checkInfo
) )
lazy val delivered = TaskKey[NodeSeq]("delivered") lazy val delivered = TaskKey[NodeSeq]("delivered")
lazy val customInfo = SettingKey[Boolean]("custom-info") lazy val customInfo = SettingKey[Boolean]("custom-info")
@ -29,14 +28,14 @@ object InfoTest extends Build
else else
<dependency org="org.scalacheck" name="scalacheck" rev="1.5"/> <dependency org="org.scalacheck" name="scalacheck" rev="1.5"/>
def checkDownload = (dependencyClasspath in Compile) map { cp => if(cp.isEmpty) error("Dependency not downloaded") } def checkDownload = (dependencyClasspath in Compile) map { cp => if(cp.isEmpty) error("Dependency not downloaded"); () }
def checkInfo = (customInfo, delivered) map { (addInfo, d) => def checkInfo = (customInfo, delivered) map { (addInfo, d) =>
if((d \ "info").isEmpty) if((d \ "info").isEmpty)
error("No info tag generated") error("No info tag generated")
else if(addInfo) { else if(addInfo) {
if( !deliveredWithCustom(d) ) error("Expected 'license' and 'description' tags in info tag, got: \n" + (d \ "info")) if( !deliveredWithCustom(d) ) error("Expected 'license' and 'description' tags in info tag, got: \n" + (d \ "info")) else ()
} else } else
if( deliveredWithCustom(d) ) error("Expected empty 'info' tag, got: \n" + (d \ "info")) if( deliveredWithCustom(d) ) error("Expected empty 'info' tag, got: \n" + (d \ "info")) else ()
} }
def deliveredWithCustom(d: NodeSeq) = !(d \ "info" \ "license").isEmpty && !(d \ "info" \ "description").isEmpty def deliveredWithCustom(d: NodeSeq) = !(d \ "info" \ "license").isEmpty && !(d \ "info" \ "description").isEmpty
} }

View File

@ -6,7 +6,6 @@ object TestProject extends Build
override lazy val settings = super.settings :+ override lazy val settings = super.settings :+
( ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) ) ( ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) )
lazy val projects = Seq(a, b)
lazy val a = Project("a", file("a")) delegateTo(b) settings( lazy val a = Project("a", file("a")) delegateTo(b) settings(
libraryDependencies += "com.camptocamp.tl.caltar" % "core" % "0.5" intransitive() libraryDependencies += "com.camptocamp.tl.caltar" % "core" % "0.5" intransitive()
) )

View File

@ -1,2 +0,0 @@
project.name=test
project.version=1.0.0

View File

@ -1,19 +0,0 @@
import sbt._
class TestProject(info: ProjectInfo) extends DefaultProject(info)
{
val httpclient = "org.apache.httpcomponents" % "httpclient" % "4.0-beta2" intransitive()
override def useDefaultConfigurations =
if("useDefaultConfigurations".asFile.exists) true else false
lazy val checkDefault = task { check(Configurations.Default) }
lazy val checkCompile = task { check(Configurations.Compile) }
lazy val checkClasspath = task { if(compileClasspath.get.isEmpty) Some("Dependency in default configuration not added to classpath") else None }
private def check(config: Configuration) =
if(configurationClasspath(config).get.isEmpty)
Some("Dependency in " + config.name + " configuration not downloaded")
else
None
}

View File

@ -1,41 +0,0 @@
## run test with useDefaultConfigurations=false
# Download jars. If successful, httpclient should be downloaded to the 'default' configuration
> update
# The jar should exist in the 'default' configuration ...
> check-default
# but not in the 'compile' configuration ...
-> check-compile
# It should be present on the compile classpath
> check-classpath
# reset test
> clean-lib
# Indicate to the project definition that we now want useDefaultConfigurations = true
$ touch useDefaultConfigurations
# Reload for change to take effect
> reload
## Rerun test with useDefaultConfigurations=true
# Download jars. If successful, httpclient should be downloaded to the 'compile' configuration
> update
# The jar should not exist in the 'default' configuration ...
-> check-default
# It should exist in the 'compile' configuration
> check-compile
# It should be present on the compile classpath
> check-classpath

View File

@ -2,7 +2,7 @@ libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5"
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home")))
TaskKey("check") <<= update map { report => TaskKey[Unit]("check") <<= update map { report =>
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") ) val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(!files.isEmpty, "ScalaCheck module not found in update report") assert(!files.isEmpty, "ScalaCheck module not found in update report")
val missing = files.filter(! _.exists) val missing = files.filter(! _.exists)

View File

@ -1,6 +1,6 @@
seq(externalIvySettings(), externalIvyFile()) seq(externalIvySettings(), externalIvyFile())
TaskKey("check") <<= (baseDirectory, update) map { (base, report) => TaskKey[Unit]("check") <<= (baseDirectory, update) map { (base, report) =>
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") ) val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(!files.isEmpty, "ScalaCheck module not found in update report") assert(!files.isEmpty, "ScalaCheck module not found in update report")
} }

View File

@ -2,7 +2,7 @@ externalIvySettings()
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5"
TaskKey("check") <<= (baseDirectory, update) map { (base, report) => TaskKey[Unit]("check") <<= (baseDirectory, update) map { (base, report) =>
val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") ) val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") )
assert(!files.isEmpty, "ScalaCheck module not found in update report") assert(!files.isEmpty, "ScalaCheck module not found in update report")
} }

View File

@ -4,11 +4,10 @@
object MakePomTest extends Build object MakePomTest extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
readPom <<= makePom map XML.loadFile, readPom <<= makePom map XML.loadFile,
TaskKey("check-pom") <<= checkPom, TaskKey[Unit]("check-pom") <<= checkPom,
TaskKey("check-extra") <<= checkExtra, TaskKey[Unit]("check-extra") <<= checkExtra,
makePomConfiguration ~= { _.copy(extra = <extra-tag/>) } makePomConfiguration ~= { _.copy(extra = <extra-tag/>) }
) )
@ -30,7 +29,7 @@ object MakePomTest extends Build
lazy val checkExtra = readPom map { pomXML => lazy val checkExtra = readPom map { pomXML =>
checkProject(pomXML) checkProject(pomXML)
val extra = pomXML \ extraTagName val extra = pomXML \ extraTagName
if(extra.isEmpty) error("'" + extraTagName + "' not found in generated pom.xml.") if(extra.isEmpty) error("'" + extraTagName + "' not found in generated pom.xml.") else ()
} }
lazy val checkPom = (readPom, fullResolvers) map { (pomXML, ivyRepositories) => lazy val checkPom = (readPom, fullResolvers) map { (pomXML, ivyRepositories) =>
@ -44,6 +43,8 @@ object MakePomTest extends Build
if( writtenRepositories != mavenStyleRepositories ) if( writtenRepositories != mavenStyleRepositories )
error("Written repositories did not match declared repositories.\n\t" + explain) error("Written repositories did not match declared repositories.\n\t" + explain)
else
()
} }
} }

View File

@ -1,7 +1,9 @@
<ivysettings> <ivysettings>
<settings defaultResolver="lag"/> <settings defaultResolver="chain"/>
<caches defaultCacheDir="${ivy.settings.dir}/target/cache"/> <caches defaultCacheDir="${ivy.settings.dir}/target/cache"/>
<resolvers> <resolvers>
<ibiblio name="lag" m2compatible="true" root="http://www.lag.net/repo/"/> <chain name="chain" returnFirst="true">
<ibiblio name="scala-tools-releases" m2compatible="true" root="http://scala-tools.org/repo-releases/"/>
</chain>
</resolvers> </resolvers>
</ivysettings> </ivysettings>

View File

@ -3,15 +3,14 @@
object SettingsTest extends Build object SettingsTest extends Build
{ {
lazy val projects = Seq(parent, sub, configgy)
lazy val parent: Project = Project("Parent", file(".")) aggregate(sub) settings( lazy val parent: Project = Project("Parent", file(".")) aggregate(sub) settings(
externalIvySettings(), externalIvySettings(),
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home")))
) )
lazy val sub: Project = Project("Sub", file("sub"), delegates = parent :: Nil) dependsOn(configgy) aggregate(configgy) settings( lazy val sub: Project = Project("Sub", file("sub"), delegates = parent :: Nil) dependsOn(compiler) aggregate(compiler) settings(
externalIvySettings() externalIvySettings()
) )
lazy val configgy = Project("Configgy", file("configgy"), delegates = sub :: Nil) settings( lazy val compiler = Project("Compiler", file("compiler"), delegates = sub :: Nil) settings(
libraryDependencies += "net.lag" % "configgy" % "1.1" libraryDependencies <+= scalaVersion( "org.scala-lang" % "scala-compiler" % _ )
) )
} }

View File

@ -1,2 +0,0 @@
project.version=1.0
project.name=Settings Test

View File

@ -1,11 +0,0 @@
import sbt._
class SettingsTest(info: ProjectInfo) extends DefaultProject(info)
{
val child = project("sub", "Sub", new SubProject(_))
class SubProject(info: ProjectInfo) extends DefaultProject(info)
{
val configgy = "net.lag" % "configgy" % "1.1"
}
}

View File

@ -2,7 +2,6 @@
object ParentTest extends Build object ParentTest extends Build
{ {
lazy val projects = Seq(parent, core, reporters, jfreechart)
lazy val parent: Project = Project("Flowmodel", file(".")) aggregate(core, reporters) lazy val parent: Project = Project("Flowmodel", file(".")) aggregate(core, reporters)
lazy val core: Project = Project("Flowmodel core", file("core"), delegates = parent :: Nil) lazy val core: Project = Project("Flowmodel core", file("core"), delegates = parent :: Nil)
lazy val reporters: Project = Project("Extra reporters", file("reporters"), delegates = parent :: Nil) aggregate(jfreechart) dependsOn(jfreechart) lazy val reporters: Project = Project("Extra reporters", file("reporters"), delegates = parent :: Nil) aggregate(jfreechart) dependsOn(jfreechart)

View File

@ -4,10 +4,9 @@
object PomRepoTest extends Build object PomRepoTest extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
resolvers ++= Seq(local, ScalaToolsSnapshots), resolvers ++= Seq(local, ScalaToolsSnapshots),
InputKey("check-pom") <<= InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories }, InputKey[Unit]("check-pom") <<= InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories },
makePomConfiguration <<= (makePomConfiguration, baseDirectory) { (conf, base) => makePomConfiguration <<= (makePomConfiguration, baseDirectory) { (conf, base) =>
conf.copy(filterRepositories = pomIncludeRepository(base, conf.filterRepositories) ) conf.copy(filterRepositories = pomIncludeRepository(base, conf.filterRepositories) )
}, },

View File

@ -10,7 +10,6 @@ object MultiPublishTest extends Build
externalResolvers <<= baseDirectory { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil } externalResolvers <<= baseDirectory { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
} }
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
name := "Retrieve Test", name := "Retrieve Test",
libraryDependencies := if("mavenStyle".asFile.exists) mavenStyleDependencies else ivyStyleDependencies libraryDependencies := if("mavenStyle".asFile.exists) mavenStyleDependencies else ivyStyleDependencies

View File

@ -10,7 +10,6 @@ object MultiPublishTest extends Build
externalResolvers <<= baseDirectory { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil } externalResolvers <<= baseDirectory { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }
) )
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( mavenStyle, name = "Publish Test" ) lazy val root = Project("root", file(".")) settings( mavenStyle, name = "Publish Test" )
lazy val sub = Project("sub", file("sub")) settings( mavenStyle, name = "Sub Project" ) lazy val sub = Project("sub", file("sub")) settings( mavenStyle, name = "Sub Project" )

View File

@ -3,23 +3,27 @@ import Keys._
object Test extends Build object Test extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
libraryDependencies += "net.liftweb" % "lift-webkit" % "1.0" intransitive(), libraryDependencies += "net.liftweb" % "lift-webkit" % "1.0" intransitive(),
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" intransitive(), libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" intransitive(),
transitiveClassifiers := Seq("sources"), transitiveClassifiers := Seq("sources"),
TaskKey("check-sources") <<= updateClassifiers map checkSources, TaskKey[Unit]("check-sources") <<= updateClassifiers map checkSources,
TaskKey("check-binaries") <<= update map checkBinaries TaskKey[Unit]("check-binaries") <<= update map checkBinaries
) )
def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") ) def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") )
def checkSources(report: UpdateReport) = def checkSources(report: UpdateReport): Unit =
{ {
val srcs = getSources(report) val srcs = getSources(report)
if(srcs.isEmpty) error("No sources retrieved") else if(srcs.size != 2) error("Incorrect sources retrieved:\n\t" + srcs.mkString("\n\t")) if(srcs.isEmpty)
error("No sources retrieved")
else if(srcs.size != 2)
error("Incorrect sources retrieved:\n\t" + srcs.mkString("\n\t"))
else
()
} }
def checkBinaries(report: UpdateReport) = def checkBinaries(report: UpdateReport): Unit =
{ {
val srcs = getSources(report) val srcs = getSources(report)
if(!srcs.isEmpty) error("Sources retrieved:\n\t" + srcs.mkString("\n\t")) if(!srcs.isEmpty) error("Sources retrieved:\n\t" + srcs.mkString("\n\t")) else ()
} }
} }

View File

@ -3,11 +3,10 @@
object TestProject extends Build object TestProject extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( lazy val root = Project("root", file(".")) settings(
libraryDependencies += "slinky" % "slinky" % "2.1" % "test" from "http://slinky2.googlecode.com/svn/artifacts/2.1/slinky.jar", libraryDependencies += "slinky" % "slinky" % "2.1" % "test" from "http://slinky2.googlecode.com/svn/artifacts/2.1/slinky.jar",
TaskKey("check-in-test") <<= checkClasspath(Test), TaskKey[Unit]("check-in-test") <<= checkClasspath(Test),
TaskKey("check-in-compile") <<= checkClasspath(Compile) TaskKey[Unit]("check-in-compile") <<= checkClasspath(Compile)
) )
lazy val checkInTest = checkClasspath(testClasspath) lazy val checkInTest = checkClasspath(testClasspath)
@ -18,6 +17,7 @@ object TestProject extends Build
{ {
val loader = ClasspathUtilities.toLoader(cp) val loader = ClasspathUtilities.toLoader(cp)
Class.forName("slinky.http.Application", false, loader) Class.forName("slinky.http.Application", false, loader)
()
} }
catch catch
{ {

View File

@ -2,7 +2,7 @@ scalaSource in Configurations.Compile <<= sourceDirectory( _ / " scala test " )
javaSource in Configurations.Compile <<= sourceDirectory( _ / " java test " ) javaSource in Configurations.Compile <<= sourceDirectory( _ / " java test " )
TaskKey("init") <<= (scalaSource in Configurations.Compile, javaSource in Configurations.Compile) map { (ss, js) => TaskKey[Unit]("init") <<= (scalaSource in Configurations.Compile, javaSource in Configurations.Compile) map { (ss, js) =>
import IO._ import IO._
createDirectories(ss :: js :: Nil) createDirectories(ss :: js :: Nil)
copyFile(file("changes") / "Test.scala", ss / " Test s.scala") copyFile(file("changes") / "Test.scala", ss / " Test s.scala")

View File

@ -1,11 +1,15 @@
import sbt.complete.DefaultParsers._ import sbt.complete.DefaultParsers._
InputKey("check-output") <<= { InputKey[Unit]("check-output") <<= {
val parser = token(Space ~> ( ("exists" ^^^ true) | ("absent" ^^^ false) ) ) val parser = token(Space ~> ( ("exists" ^^^ true) | ("absent" ^^^ false) ) )
def action(result: TaskKey[Boolean]) = def action(result: TaskKey[Boolean]) =
(classDirectory in Configurations.Compile, result) map { (dir, shouldExist) => (classDirectory in Configurations.Compile, result) map { (dir, shouldExist) =>
if((dir / "Anon.class").exists != shouldExist) error("Top level class incorrect" ) if((dir / "Anon.class").exists != shouldExist)
else if( (dir / "Anon$1.class").exists != shouldExist) error("Inner class incorrect" ) error("Top level class incorrect" )
else if( (dir / "Anon$1.class").exists != shouldExist)
error("Inner class incorrect" )
else
()
} }
InputTask(s => parser)(action) InputTask(s => parser)(action)
} }

View File

@ -1,3 +1,3 @@
crossPaths :== false crossPaths :== false
TaskKey("use-jar") := { injar.Test.other; () } TaskKey[Unit]("use-jar") := { injar.Test.other; () }

View File

@ -2,8 +2,6 @@ import sbt._
object B extends Build object B extends Build
{ {
lazy val projects = Seq(root, sub1, sub2, sub3)
lazy val root = Project("root", file(".")) lazy val root = Project("root", file("."))
lazy val sub1 = Project("sub1", file("sub1")) lazy val sub1 = Project("sub1", file("sub1"))
lazy val sub2 = Project("sub2", file("sub2")) lazy val sub2 = Project("sub2", file("sub2"))

View File

@ -11,7 +11,6 @@ object B extends Build
val sample = SettingKey[Int]("sample") val sample = SettingKey[Int]("sample")
val check = TaskKey[Unit]("check") val check = TaskKey[Unit]("check")
lazy val projects = Seq(root, sub)
lazy val root = Project("root", file("."), settings = Nil) lazy val root = Project("root", file("."), settings = Nil)
lazy val sub = Project("sub", file("."), delegates = root :: Nil, configurations = newConfig :: Nil, settings = incSample :: checkTask(4) :: Nil) lazy val sub = Project("sub", file("."), delegates = root :: Nil, configurations = newConfig :: Nil, settings = incSample :: checkTask(4) :: Nil)
override lazy val settings = override lazy val settings =

View File

@ -6,7 +6,6 @@ object B extends Build
{ {
val check = InputKey[Unit]("check-max-errors") val check = InputKey[Unit]("check-max-errors")
lazy val projects = Seq(root, sub)
lazy val root = Project("root", file(".")) lazy val root = Project("root", file("."))
lazy val sub = Project("sub", file(".")) delegateTo(root) settings(check <<= checkTask) lazy val sub = Project("sub", file(".")) delegateTo(root) settings(check <<= checkTask)

View File

@ -4,7 +4,6 @@ import Configurations.{Compile, Test}
object Flat extends Build object Flat extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file("."), lazy val root = Project("root", file("."),
settings = Defaults.defaultSettings ++ forConfig(Compile, "src") ++ forConfig(Test, "test-src") ++ baseSettings settings = Defaults.defaultSettings ++ forConfig(Compile, "src") ++ forConfig(Test, "test-src") ++ baseSettings
) )

View File

@ -3,7 +3,7 @@ import Keys.name
object TestBuild extends Build object TestBuild extends Build
{ {
lazy val projects = Seq( override def projects = Seq(
proj("a", "."), proj("a", "."),
proj("b", "b") proj("b", "b")
) )

View File

@ -3,11 +3,11 @@ import Keys.name
object TestBuild extends MakeBuild object TestBuild extends MakeBuild
{ {
lazy val projects = Seq( proj("a", ".") ) lazy val a = proj("a", ".")
} }
object SecondBuild extends MakeBuild object SecondBuild extends MakeBuild
{ {
lazy val projects = Seq( proj("b", "b") ) lazy val b = proj("b", "b")
} }
trait MakeBuild extends Build trait MakeBuild extends Build
{ {

View File

@ -1 +1 @@
TaskKey("example") := () TaskKey[Unit]("example") := ()

View File

@ -1 +1 @@
TaskKey("sample") := () TaskKey[Unit]("sample") := ()

View File

@ -1 +1 @@
TaskKey("sample2") := () TaskKey[Unit]("sample2") := ()

View File

@ -1,4 +1,4 @@
TaskKey("check") := { TaskKey[Unit]("check") := {
import antlr.Tool // verify that antlr is on compile classpath import antlr.Tool // verify that antlr is on compile classpath
Class.forName("antlr.Tool") // verify antlr is on runtime classpath Class.forName("antlr.Tool") // verify antlr is on runtime classpath
() ()

View File

@ -2,5 +2,5 @@ import sbt._
object B extends Build object B extends Build
{ {
lazy val projects = Project("root", file(".")).dependsOn( file("../../plugin") ) :: Nil lazy val root = Project("root", file(".")).dependsOn( file("../../plugin") )
} }

View File

@ -1,4 +1,4 @@
TaskKey("output-empty") <<= classDirectory in Configurations.Compile map { outputDirectory => TaskKey[Unit]("output-empty") <<= classDirectory in Configurations.Compile map { outputDirectory =>
def classes = (outputDirectory ** "*.class").get def classes = (outputDirectory ** "*.class").get
if(!classes.isEmpty) error("Classes existed:\n\t" + classes.mkString("\n\t")) if(!classes.isEmpty) error("Classes existed:\n\t" + classes.mkString("\n\t")) else ()
} }

View File

@ -1,6 +1,6 @@
name :== "test" name :== "test"
TaskKey("check-same") <<= compile in Configurations.Compile map { analysis => TaskKey[Unit]("check-same") <<= compile in Configurations.Compile map { analysis =>
analysis.apis.internal foreach { case (_, api) => analysis.apis.internal foreach { case (_, api) =>
assert( xsbt.api.APIUtil.verifyTypeParameters(api) ) assert( xsbt.api.APIUtil.verifyTypeParameters(api) )
assert( xsbt.api.SameAPI(api, api) ) assert( xsbt.api.SameAPI(api, api) )

View File

@ -4,16 +4,16 @@ import java.net.URLClassLoader
object B extends Build object B extends Build
{ {
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( ss : _*) lazy val root = Project("root", file(".")) settings( ss : _*)
def ss = Seq( def ss = Seq(
TaskKey("check-first") <<= checkTask("First"), TaskKey[Unit]("check-first") <<= checkTask("First"),
TaskKey("check-second") <<= checkTask("Second") TaskKey[Unit]("check-second") <<= checkTask("Second")
) )
private def checkTask(className: String) = private def checkTask(className: String) =
fullClasspath in Configurations.Runtime map { runClasspath => fullClasspath in Configurations.Runtime map { runClasspath =>
val cp = runClasspath.map(_.data.toURI.toURL).toArray val cp = runClasspath.map(_.data.toURI.toURL).toArray
Class.forName(className, false, new URLClassLoader(cp)) Class.forName(className, false, new URLClassLoader(cp))
()
} }
} }

View File

@ -3,7 +3,6 @@
object B extends Build object B extends Build
{ {
lazy val projects = Seq(root)
lazy val root = lazy val root =
Project("root", file(".")) Project("root", file("."))
.configs( IntegrationTest ) .configs( IntegrationTest )