diff options
Diffstat (limited to 'project/build/ExternalTaskRunner.scala')
-rw-r--r-- | project/build/ExternalTaskRunner.scala | 34 |
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 |