From 543fdbe40fbe5e0a36a8273ab22418a6a854d440 Mon Sep 17 00:00:00 2001 From: James Judd Date: Sat, 6 Jul 2024 20:10:58 -0600 Subject: [PATCH] . --- .../rules_scala/common/worker/WorkerMain.scala | 2 +- .../workers/zinc/compile/ZincRunner.scala | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/scala/higherkindness/rules_scala/common/worker/WorkerMain.scala b/src/main/scala/higherkindness/rules_scala/common/worker/WorkerMain.scala index e1fb7a6f..c0e836f0 100644 --- a/src/main/scala/higherkindness/rules_scala/common/worker/WorkerMain.scala +++ b/src/main/scala/higherkindness/rules_scala/common/worker/WorkerMain.scala @@ -74,7 +74,7 @@ trait WorkerMain[S] { } catch { case AnnexWorkerError(code, _, _) => code } - }(ec) + }(scala.concurrent.ExecutionContext.global) f.onComplete { case Success(code) => { diff --git a/src/main/scala/higherkindness/rules_scala/workers/zinc/compile/ZincRunner.scala b/src/main/scala/higherkindness/rules_scala/workers/zinc/compile/ZincRunner.scala index c0cf9a75..3a297402 100644 --- a/src/main/scala/higherkindness/rules_scala/workers/zinc/compile/ZincRunner.scala +++ b/src/main/scala/higherkindness/rules_scala/workers/zinc/compile/ZincRunner.scala @@ -58,11 +58,22 @@ object ZincRunner extends WorkerMain[Namespace] { parser.parseArgsOrFail(args.getOrElse(Array.empty)) } + protected[this] def work(worker: Namespace, args: Array[String], out: PrintStream) = { + new ZincRunner(worker, args, out).work() + } +} + +class ZincRunner(worker: Namespace, args: Array[String], out: PrintStream) { + + private[this] def labelToPath(label: String): Path = { + Paths.get(label.replaceAll("^/+", "").replaceAll(raw"[^\w/]", "_")) + } + private def pathFrom(args: Namespace, name: String): Option[Path] = Option(args.getString(name)).map { dir => Paths.get(dir.replace("~", sys.props.getOrElse("user.home", ""))) } - protected[this] def work(worker: Namespace, args: Array[String], out: PrintStream) = { + def work() = { val usePersistence: Boolean = worker.getBoolean("use_persistence") match { case p: java.lang.Boolean => p case null => true