sbt/project/build/XSbt.scala

81 lines
3.8 KiB
Scala
Raw Normal View History

2009-08-16 20:29:08 +02:00
import sbt._
class XSbt(info: ProjectInfo) extends ParentProject(info)
{
val testDeps = project("test-dependencies", "Dependencies", new TestDependencies(_))
val launchInterfaceSub = project(launchPath / "interface", "Launcher Interface", new InterfaceProject(_), testDeps)
2009-08-21 14:12:43 +02:00
val launchSub = project(launchPath, "Launcher", new LaunchProject(_), launchInterfaceSub)
val interfaceSub = project("interface", "Interface", new InterfaceProject(_))
2009-08-16 20:29:08 +02:00
val controlSub = project(utilPath / "control", "Control", new Base(_))
val collectionSub = project(utilPath / "collection", "Collections", new Base(_))
val ioSub = project(utilPath / "io", "IO", new Base(_), controlSub, testDeps)
2009-08-16 20:29:08 +02:00
val classpathSub = project(utilPath / "classpath", "Classpath", new Base(_))
2009-08-18 06:51:08 +02:00
val compilerInterfaceSub = project(compilePath / "interface", "Compiler Interface", new CompilerInterfaceProject(_), interfaceSub)
2009-08-18 06:51:08 +02:00
val ivySub = project("ivy", "Ivy", new IvyProject(_), interfaceSub)
2009-08-16 20:29:08 +02:00
val logSub = project(utilPath / "log", "Logging", new Base(_))
val taskSub = project("tasks", "Tasks", new TaskProject(_), controlSub, collectionSub, testDeps)
2009-08-16 20:29:08 +02:00
val cacheSub = project("cache", "Cache", new CacheProject(_), taskSub, ioSub)
2009-08-18 06:51:08 +02:00
val compilerSub = project(compilePath, "Compile", new Base(_), interfaceSub, ivySub, ioSub, compilerInterfaceSub)
2009-08-16 20:29:08 +02:00
2009-08-21 14:12:43 +02:00
def launchPath = path("launch")
2009-08-18 06:51:08 +02:00
def utilPath = path("util")
def compilePath = path("compile")
class LaunchProject(info: ProjectInfo) extends Base(info) with TestWithIO
2009-08-21 14:12:43 +02:00
{
val ivy = "org.apache.ivy" % "ivy" % "2.0.0"
}
class TestDependencies(info: ProjectInfo) extends DefaultProject(info)
2009-08-16 20:29:08 +02:00
{
val sc = "org.scala-tools.testing" % "scalacheck" % "1.5" % "test->default"
2009-08-18 06:51:08 +02:00
val sp = "org.scala-tools.testing" % "specs" % "1.5.0" % "test->default"
val ju = "junit" % "junit" % "4.5" % "test->default" // required by specs to compile properly
2009-08-16 20:29:08 +02:00
}
override def parallelExecution = true
class TaskProject(info: ProjectInfo) extends Base(info)
2009-08-16 20:29:08 +02:00
class CacheProject(info: ProjectInfo) extends Base(info)
{
//override def compileOptions = super.compileOptions ++ List(Unchecked,ExplainTypes, CompileOption("-Xlog-implicits"))
}
class Base(info: ProjectInfo) extends DefaultProject(info)
2009-08-16 20:29:08 +02:00
{
override def scratch = true
}
class IvyProject(info: ProjectInfo) extends Base(info) with TestWithIO
2009-08-16 20:29:08 +02:00
{
val ivy = "org.apache.ivy" % "ivy" % "2.0.0"
}
class InterfaceProject(info: ProjectInfo) extends DefaultProject(info)
{
2009-08-18 06:51:08 +02:00
override def mainSources = descendents(mainSourceRoots, "*.java")
override def compileOrder = CompileOrder.JavaThenScala
}
2009-08-18 06:51:08 +02:00
class CompilerInterfaceProject(info: ProjectInfo) extends Base(info) with SourceProject
{
// these set up the test so that the classes and resources are both in the output resource directory
// the main output path is removed so that the plugin (xsbt.Analyzer) is found in the output resource directory so that
// the tests can configure that directory as -Xpluginsdir (which requires the scalac-plugin.xml and the classes to be together)
override def testCompileAction = super.testCompileAction dependsOn(packageForTest, ioSub.testCompile)
2009-08-18 06:51:08 +02:00
override def mainResources = super.mainResources +++ "scalac-plugin.xml"
override def testClasspath = (super.testClasspath --- super.mainCompilePath) +++ ioSub.testClasspath +++ testPackagePath
def testPackagePath = outputPath / "test.jar"
lazy val packageForTest = packageTask(mainClasses +++ mainResources, testPackagePath, packageOptions).dependsOn(compile)
}
trait TestWithIO extends BasicScalaProject
{
// use IO from tests
override def testCompileAction = super.testCompileAction dependsOn(ioSub.testCompile)
override def testClasspath = super.testClasspath +++ ioSub.testClasspath
}
2009-08-18 06:51:08 +02:00
}
trait SourceProject extends BasicScalaProject
{
override def packagePaths = packageSourcePaths
2009-08-16 20:29:08 +02:00
}