2009-06-26 03:26:06 +02:00
|
|
|
/* sbt -- Simple Build Tool
|
|
|
|
|
* Copyright 2008, 2009 Mark Harrah
|
|
|
|
|
*/
|
|
|
|
|
import sbt._
|
|
|
|
|
|
|
|
|
|
import java.io.File
|
2009-12-05 17:02:41 +01:00
|
|
|
import java.net.URL
|
2009-06-26 03:26:06 +02:00
|
|
|
|
2010-02-15 04:59:35 +01:00
|
|
|
class SbtProject(info: ProjectInfo) extends DefaultProject(info) //with test.SbtScripted with posterous.Publish
|
2009-06-26 03:26:06 +02:00
|
|
|
{
|
2009-10-19 17:14:27 +02:00
|
|
|
/* Additional resources to include in the produced jar.*/
|
2009-06-26 03:26:06 +02:00
|
|
|
def extraResources = descendents(info.projectPath / "licenses", "*") +++ "LICENSE" +++ "NOTICE"
|
|
|
|
|
override def mainResources = super.mainResources +++ extraResources
|
2009-10-19 17:14:27 +02:00
|
|
|
|
|
|
|
|
override def testOptions = ExcludeTests("sbt.ReflectiveSpecification" :: Nil) :: super.testOptions.toList
|
2009-10-10 01:31:55 +02:00
|
|
|
override def normalizedName = "sbt"
|
|
|
|
|
|
2009-10-24 04:03:53 +02:00
|
|
|
override def managedStyle = ManagedStyle.Ivy
|
2009-12-05 17:02:41 +01:00
|
|
|
//val publishTo = Resolver.file("technically", new File("/var/dbwww/repo/"))
|
|
|
|
|
val technically = Resolver.url("technically.us", new URL("http://databinder.net/repo/"))(Resolver.ivyStylePatterns)
|
2009-10-24 04:03:53 +02:00
|
|
|
|
2009-10-10 01:31:55 +02:00
|
|
|
override def compileOptions = Nil
|
2009-12-12 14:38:35 +01:00
|
|
|
|
2009-12-05 03:26:31 +01:00
|
|
|
/** configuration of scripted testing **/
|
|
|
|
|
// Set to false to show logging as it happens without buffering, true to buffer until it completes and only show if the task fails.
|
2010-02-15 04:59:35 +01:00
|
|
|
// The output of scripted tasks executed in parallel will be inteleaved if false.
|
|
|
|
|
//override def scriptedBufferLog = true
|
2009-12-05 03:26:31 +01:00
|
|
|
// Configure which versions of Scala to test against for those tests that do cross building
|
2010-02-15 04:59:35 +01:00
|
|
|
//override def scriptedCompatibility = sbt.test.CompatibilityLevel.Minimal
|
2009-10-10 01:31:55 +02:00
|
|
|
|
|
|
|
|
override def useDefaultConfigurations = false
|
|
|
|
|
val default = Configurations.Default
|
|
|
|
|
val optional = Configurations.Optional
|
|
|
|
|
val provided = Configurations.Provided
|
2010-01-11 01:06:16 +01:00
|
|
|
val testConf = Configurations.Test
|
2009-10-10 01:31:55 +02:00
|
|
|
|
2009-12-08 01:04:37 +01:00
|
|
|
//testing
|
2010-01-11 01:06:16 +01:00
|
|
|
val scalacheck = "org.scala-tools.testing" %% "scalacheck" % "1.6" % "test"
|
2009-12-08 01:04:37 +01:00
|
|
|
|
2009-12-18 15:47:02 +01:00
|
|
|
val ivy = "org.apache.ivy" % "ivy" % "2.1.0" intransitive()
|
2009-10-10 01:31:55 +02:00
|
|
|
val jsch = "com.jcraft" % "jsch" % "0.1.31" intransitive()
|
|
|
|
|
val jetty = "org.mortbay.jetty" % "jetty" % "6.1.14" % "optional"
|
2010-02-02 00:21:51 +01:00
|
|
|
|
|
|
|
|
val jetty7server = "org.eclipse.jetty" % "jetty-server" % "7.0.1.v20091125" % "optional"
|
|
|
|
|
val jetty7webapp = "org.eclipse.jetty" % "jetty-webapp" % "7.0.1.v20091125" % "optional"
|
2009-10-10 01:31:55 +02:00
|
|
|
|
2010-01-11 04:02:01 +01:00
|
|
|
val testInterface = "org.scala-tools.testing" % "test-interface" % "0.4"
|
2009-10-23 01:10:54 +02:00
|
|
|
|
2009-10-10 01:31:55 +02:00
|
|
|
// xsbt components
|
2009-10-19 17:14:27 +02:00
|
|
|
val xsbti = "org.scala-tools.sbt" % "launcher-interface" % projectVersion.value.toString % "provided"
|
|
|
|
|
val compiler = "org.scala-tools.sbt" %% "compile" % projectVersion.value.toString
|
2009-10-10 01:31:55 +02:00
|
|
|
|
2010-02-02 00:21:51 +01:00
|
|
|
/* For generating JettyRun for Jetty 6 and 7. The only difference is the imports, but the file has to be compiled against each set of imports. */
|
|
|
|
|
override def compileAction = super.compileAction dependsOn (generateJettyRun6, generateJettyRun7)
|
|
|
|
|
def jettySrcDir = mainScalaSourcePath / "sbt" / "jetty"
|
|
|
|
|
def jettyTemplate = jettySrcDir / "LazyJettyRun.scala.templ"
|
|
|
|
|
|
|
|
|
|
lazy val generateJettyRun6 = generateJettyRun(jettyTemplate, jettySrcDir / "LazyJettyRun6.scala", "6", jettySrcDir / "jetty6.imports")
|
|
|
|
|
lazy val generateJettyRun7 = generateJettyRun(jettyTemplate, jettySrcDir / "LazyJettyRun7.scala", "7", jettySrcDir / "jetty7.imports")
|
|
|
|
|
def generateJettyRun(in: Path, out: Path, version: String, importsPath: Path) =
|
|
|
|
|
task
|
|
|
|
|
{
|
|
|
|
|
(for(template <- FileUtilities.readString(in asFile, log).right; imports <- FileUtilities.readString(importsPath asFile, log).right) yield
|
|
|
|
|
FileUtilities.write(out asFile, processJettyTemplate(template, version, imports), log).toLeft(()) ).left.toOption
|
|
|
|
|
}
|
|
|
|
|
def processJettyTemplate(template: String, version: String, imports: String): String =
|
|
|
|
|
template.replaceAll("""\Q${jetty.version}\E""", version).replaceAll("""\Q${jetty.imports}\E""", imports)
|
2009-06-26 03:26:06 +02:00
|
|
|
}
|