From 26a1e8c8236290b08fa4ea354c422bb286894d8f Mon Sep 17 00:00:00 2001 From: Mark Canlas Date: Thu, 1 Dec 2022 06:50:22 -0500 Subject: [PATCH] add zio demo --- build.sbt | 6 +++++- .../com/htmlism/firepower/demo/PrintPrograms.scala | 8 ++++++++ project/ProjectPlugin.scala | 10 ++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 firepower-demo/src/main/scala/com/htmlism/firepower/demo/PrintPrograms.scala diff --git a/build.sbt b/build.sbt index 9ef86e1..d6e17bd 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,7 @@ lazy val firepower = ) .withCats .withTesting - .aggregate(nescant, scratchpad) + .aggregate(nescant, scratchpad, demo) lazy val nescant = project.withCats.withTesting @@ -15,3 +15,7 @@ lazy val scratchpad = project .withCats .withTesting + +lazy val demo = + module("demo") + .withEfectMonad diff --git a/firepower-demo/src/main/scala/com/htmlism/firepower/demo/PrintPrograms.scala b/firepower-demo/src/main/scala/com/htmlism/firepower/demo/PrintPrograms.scala new file mode 100644 index 0000000..b39ef14 --- /dev/null +++ b/firepower-demo/src/main/scala/com/htmlism/firepower/demo/PrintPrograms.scala @@ -0,0 +1,8 @@ +import zio.* + +import java.io.IOException + +object PrintPrograms extends ZIOAppDefault: + def run: IO[IOException, Unit] = + Console + .printLine("Hello, World!") diff --git a/project/ProjectPlugin.scala b/project/ProjectPlugin.scala index 5c8b95b..847f83a 100644 --- a/project/ProjectPlugin.scala +++ b/project/ProjectPlugin.scala @@ -7,10 +7,20 @@ object ProjectPlugin extends AutoPlugin { val autoImport = ThingsToImport object ThingsToImport { + private def jarName(s: String) = + "firepower-" + s + + def module(s: String): Project = + Project(s, file(jarName(s))) + .settings(name := jarName(s)) + implicit class ProjectOps(p: Project) { def withCats: Project = p.settings(libraryDependencies += "org.typelevel" %% "cats-core" % "2.9.0") + def withEfectMonad: Project = + p.settings(libraryDependencies += "dev.zio" %% "zio" % "2.0.4") + def withTesting: Project = { val weaverVersion = "0.8.0"