diff --git a/sbt/src/sbt-test/dependency-management/info/build.sbt b/sbt/src/sbt-test/dependency-management/info/build.sbt new file mode 100644 index 000000000..b1387ed93 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/info/build.sbt @@ -0,0 +1,40 @@ +import scala.xml._ + +lazy val root = (project in file(".")). + settings( + ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), + ivyXML <<= (customInfo, organization, moduleName, version) apply inlineXML, + scalaVersion := "2.9.1", + projectID ~= (_ cross false), + customInfo <<= baseDirectory{_ / "info" exists }, + TaskKey[Unit]("check-download") <<= checkDownload, + delivered <<= deliverLocal map XML.loadFile, + TaskKey[Unit]("check-info") <<= checkInfo + ) + +lazy val delivered = TaskKey[NodeSeq]("delivered") +lazy val customInfo = SettingKey[Boolean]("custom-info") + +def inlineXML(addInfo: Boolean, organization: String, moduleID: String, version: String): NodeSeq = + if(addInfo) + ( + + + ScalaQuery is a type-safe database query API for Scala. + + + ) + else + + +def checkDownload = (dependencyClasspath in Compile) map { cp => if(cp.isEmpty) sys.error("Dependency not downloaded"); () } +def checkInfo = (customInfo, delivered) map { (addInfo, d) => + if((d \ "info").isEmpty) + sys.error("No info tag generated") + else if(addInfo) { + if( !deliveredWithCustom(d) ) sys.error("Expected 'license' and 'description' tags in info tag, got: \n" + (d \ "info")) else () + } else + if( deliveredWithCustom(d) ) sys.error("Expected empty 'info' tag, got: \n" + (d \ "info")) else () +} +def deliveredWithCustom(d: NodeSeq) = (d \ "info" \ "license").nonEmpty && (d \ "info" \ "description").nonEmpty + diff --git a/sbt/src/sbt-test/dependency-management/info/project/InfoTest.scala b/sbt/src/sbt-test/dependency-management/info/project/InfoTest.scala deleted file mode 100644 index 504dc23b0..000000000 --- a/sbt/src/sbt-test/dependency-management/info/project/InfoTest.scala +++ /dev/null @@ -1,43 +0,0 @@ - import sbt._ - import Import._ - import Keys._ - import scala.xml._ - -object InfoTest extends Build -{ - lazy val root = Project("root", file(".")) settings( - ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), - ivyXML <<= (customInfo, organization, moduleName, version) apply inlineXML, - scalaVersion := "2.9.1", - projectID ~= (_ cross false), - customInfo <<= baseDirectory{_ / "info" exists }, - TaskKey[Unit]("check-download") <<= checkDownload, - delivered <<= deliverLocal map XML.loadFile, - TaskKey[Unit]("check-info") <<= checkInfo - ) - lazy val delivered = TaskKey[NodeSeq]("delivered") - lazy val customInfo = SettingKey[Boolean]("custom-info") - - def inlineXML(addInfo: Boolean, organization: String, moduleID: String, version: String): NodeSeq = - if(addInfo) - ( - - - ScalaQuery is a type-safe database query API for Scala. - - - ) - else - - - def checkDownload = (dependencyClasspath in Compile) map { cp => if(cp.isEmpty) sys.error("Dependency not downloaded"); () } - def checkInfo = (customInfo, delivered) map { (addInfo, d) => - if((d \ "info").isEmpty) - sys.error("No info tag generated") - else if(addInfo) { - if( !deliveredWithCustom(d) ) sys.error("Expected 'license' and 'description' tags in info tag, got: \n" + (d \ "info")) else () - } else - if( deliveredWithCustom(d) ) sys.error("Expected empty 'info' tag, got: \n" + (d \ "info")) else () - } - def deliveredWithCustom(d: NodeSeq) = (d \ "info" \ "license").nonEmpty && (d \ "info" \ "description").nonEmpty -}