* Added execTask that runs a ProcessBuilder

* Added implicit from scala.xml.Elem to ProcessBuilder that uses the element's text as the command.  For example:
    <x> {command.absolutePath} -x {a.absolutePath} </x>
 * Added methods to PathFinder to get the results as Strings or Files



git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@839 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
dmharrah 2009-07-04 17:32:14 +00:00
parent 8147101b3a
commit f3c776dab3
3 changed files with 12 additions and 0 deletions

View File

@ -264,6 +264,8 @@ sealed abstract class PathFinder extends NotNull
addTo(pathSet)
wrap.Wrappers.readOnly(pathSet)
}
final def getFiles: scala.collection.Set[File] = Set( get.map(_.asFile).toSeq : _*)
final def getPaths: scala.collection.Set[String] = Set( get.map(_.absolutePath).toSeq : _*)
private[sbt] def addTo(pathSet: Set[Path])
}
private class BasePathFinder(base: PathFinder) extends PathFinder

View File

@ -17,6 +17,7 @@ object Process
implicit def apply(builder: JProcessBuilder): ProcessBuilder = new SimpleProcessBuilder(builder)
implicit def apply(file: File): FilePartialBuilder = new FileBuilder(file)
implicit def apply(url: URL): URLPartialBuilder = new URLBuilder(url)
implicit def apply(command: scala.xml.Elem): ProcessBuilder = apply(command.text)
}
trait URLPartialBuilder extends NotNull

View File

@ -53,6 +53,15 @@ trait SimpleScalaProject extends Project
pathClean orElse restored
}
}
def execTask(command: => ProcessBuilder): Task =
task
{
val exitValue = command ! log
if(exitValue == 0)
None
else
Some("Nonzero exit value: " + exitValue)
}
}
trait ScalaProject extends SimpleScalaProject with FileTasks with MultiTaskProject
{