summaryrefslogtreecommitdiff
path: root/project/build/ExternalTaskRunner.scala
diff options
context:
space:
mode:
authormoix <moix@epfl.ch>2010-07-29 09:52:28 +0000
committermoix <moix@epfl.ch>2010-07-29 09:52:28 +0000
commite3ca222e48fa917d631c1ee6ecbc8a594ae76d10 (patch)
treec5c719ee1b38d5f238ee513279fda4f8cb263283 /project/build/ExternalTaskRunner.scala
parent26bbdbe3a21d17f5b2a94ea528eb4508d2b3b13e (diff)
downloadscala-e3ca222e48fa917d631c1ee6ecbc8a594ae76d10.tar.gz
scala-e3ca222e48fa917d631c1ee6ecbc8a594ae76d10.tar.bz2
scala-e3ca222e48fa917d631c1ee6ecbc8a594ae76d10.zip
First version of SBT build for Scala compiler/l...
First version of SBT build for Scala compiler/library (see README)
Diffstat (limited to 'project/build/ExternalTaskRunner.scala')
-rw-r--r--project/build/ExternalTaskRunner.scala34
1 files changed, 34 insertions, 0 deletions
diff --git a/project/build/ExternalTaskRunner.scala b/project/build/ExternalTaskRunner.scala
new file mode 100644
index 0000000000..c9ad97b970
--- /dev/null
+++ b/project/build/ExternalTaskRunner.scala
@@ -0,0 +1,34 @@
+import sbt._
+import ExternalTaskRunner._
+
+/**
+ * Provide a way to launch a specific task in a new sbt instance.
+ * As the compilation process need to be able to compile in a different process (due to memory related
+ * performance issue) and that in order to keep incremental compilation, we allow to launch a task from a
+ * specific project / sub-project in a different instance of sbt that disappear once the task has finished.
+ */
+class ExternalTaskRunner(root:Path,projectName:String, taskName :String, log: Logger ){
+
+ def runTask:Option[String] ={
+
+ val cmd:Seq[String] = Seq("project "+projectName,taskName) // TODO forward logging level (for example debug)
+ val externalSbt = Process(sbtCommand ++ cmd)
+ log.info("Launching task ["+taskName+"] of project ["+projectName+"] in new sbt instance")
+ externalSbt.! match{
+ case 0 => None
+ case _ => Some("External Task Failed")
+ }
+
+ }
+
+}
+
+object ExternalTaskRunner{
+ /**
+ * parameters needed to launch another instance of sbt
+ */
+ val sbtCommand = Seq("sbt") // TODO remove dependency on sbt being on the path of the user
+
+
+
+} \ No newline at end of file