From e4013b7becd062da4378c549ec17cc585a95b3a9 Mon Sep 17 00:00:00 2001 From: Kevin Lee Date: Sun, 19 Mar 2023 23:59:22 +1100 Subject: [PATCH] Close #521 - Add support for Scala Native --- build.sbt | 50 +++++++++++++++++++++++++++++---------------- project/plugins.sbt | 5 +++++ 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/build.sbt b/build.sbt index ee232cb2..67e34daa 100644 --- a/build.sbt +++ b/build.sbt @@ -55,21 +55,28 @@ lazy val effectie = (project in file(".")) .aggregate( testing4CatsJvm, testing4CatsJs, + testing4CatsNative, coreJvm, coreJs, + coreNative, syntaxJvm, syntaxJs, + syntaxNative, catsJvm, catsJs, + catsNative, catsEffect2Jvm, catsEffect2Js, + catsEffect2Native, catsEffect3Jvm, catsEffect3Js, + catsEffect3Native, monix3Jvm, monix3Js, + monix3Native, ) -lazy val core = module(ProjectName("core"), crossProject(JVMPlatform, JSPlatform)) +lazy val core = module(ProjectName("core"), crossProject(JVMPlatform, JSPlatform, NativePlatform)) .settings( description := "Effect Utils - Core", libraryDependencies ++= List( @@ -87,13 +94,14 @@ lazy val core = module(ProjectName("core"), crossProject(JVMPlatform, JSPlatform ) .dependsOn(testing4Cats % Test) -lazy val coreJvm = core.jvm -lazy val coreJs = core +lazy val coreJvm = core.jvm +lazy val coreJs = core .js .settings(jsSettingsForFuture) .settings(jsSettings) +lazy val coreNative = core.native -lazy val syntax = module(ProjectName("syntax"), crossProject(JVMPlatform, JSPlatform)) +lazy val syntax = module(ProjectName("syntax"), crossProject(JVMPlatform, JSPlatform, NativePlatform)) .settings( description := "Effect Utils - Syntax", libraryDependencies ++= List( @@ -105,12 +113,13 @@ lazy val syntax = module(ProjectName("syntax"), crossProject(JVMPlatform, JSP libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value), ) .dependsOn(core % props.IncludeTest) -lazy val syntaxJvm = syntax.jvm -lazy val syntaxJs = syntax +lazy val syntaxJvm = syntax.jvm +lazy val syntaxJs = syntax .js .settings(jsSettings) +lazy val syntaxNative = syntax.native -lazy val cats = module(ProjectName("cats"), crossProject(JVMPlatform, JSPlatform)) +lazy val cats = module(ProjectName("cats"), crossProject(JVMPlatform, JSPlatform, NativePlatform)) .settings( description := "Effect Utils - Cats", libraryDependencies ++= List( @@ -127,13 +136,14 @@ lazy val cats = module(ProjectName("cats"), crossProject(JVMPlatform, JSPlatform testing4Cats % Test, ) -lazy val catsJvm = cats.jvm -lazy val catsJs = cats +lazy val catsJvm = cats.jvm +lazy val catsJs = cats .js .settings(jsSettingsForFuture) .settings(jsSettings) +lazy val catsNative = cats.native -lazy val testing4Cats = module(ProjectName("test4cats"), crossProject(JVMPlatform, JSPlatform)) +lazy val testing4Cats = module(ProjectName("test4cats"), crossProject(JVMPlatform, JSPlatform, NativePlatform)) .settings( description := "Effect's test utils for Cats", libraryDependencies := @@ -144,12 +154,13 @@ lazy val testing4Cats = module(ProjectName("test4cats"), crossProject(JVMPlat console / initialCommands := """import effectie.testing.cats._""", ) -lazy val testing4CatsJvm = testing4Cats.jvm -lazy val testing4CatsJs = testing4Cats +lazy val testing4CatsJvm = testing4Cats.jvm +lazy val testing4CatsJs = testing4Cats .js .settings(jsSettings) +lazy val testing4CatsNative = testing4Cats.native -lazy val catsEffect2 = module(ProjectName("cats-effect2"), crossProject(JVMPlatform, JSPlatform)) +lazy val catsEffect2 = module(ProjectName("cats-effect2"), crossProject(JVMPlatform, JSPlatform, NativePlatform)) .settings( description := "Effect Utils - Cats Effect 2", libraryDependencies := @@ -181,13 +192,14 @@ lazy val catsEffect2 = module(ProjectName("cats-effect2"), crossProject(JVMPl cats % props.IncludeTest, testing4Cats % Test, ) -lazy val catsEffect2Jvm = catsEffect2.jvm -lazy val catsEffect2Js = catsEffect2 +lazy val catsEffect2Jvm = catsEffect2.jvm +lazy val catsEffect2Js = catsEffect2 .js .settings(jsSettingsForFuture) .settings(jsSettings) +lazy val catsEffect2Native = catsEffect2.native -lazy val catsEffect3 = module(ProjectName("cats-effect3"), crossProject(JVMPlatform, JSPlatform)) +lazy val catsEffect3 = module(ProjectName("cats-effect3"), crossProject(JVMPlatform, JSPlatform, NativePlatform)) .settings( description := "Effect Utils - Cats Effect 3", libraryDependencies ++= List( @@ -211,8 +223,9 @@ lazy val catsEffect3Js = catsEffect3 .js .settings(jsSettingsForFuture) .settings(jsSettings) +lazy val catsEffect3Native = catsEffect3.native -lazy val monix3 = module(ProjectName("monix3"), crossProject(JVMPlatform, JSPlatform)) +lazy val monix3 = module(ProjectName("monix3"), crossProject(JVMPlatform, JSPlatform, NativePlatform)) .settings( description := "Effect Utils - Monix 3", libraryDependencies := @@ -239,6 +252,7 @@ lazy val monix3Js = monix3 .js .settings(jsSettingsForFuture) .settings(jsSettings) +lazy val monix3Native = monix3.native lazy val docs = (project in file("docs-gen-tmp/docs")) .enablePlugins(MdocPlugin, DocusaurPlugin) @@ -333,7 +347,7 @@ lazy val props = ) final val Scala2Version = Scala2Versions.head - final val Scala3Version = "3.0.2" + final val Scala3Version = "3.1.3" // final val ProjectScalaVersion = "2.12.13" final val ProjectScalaVersion = Scala2Version diff --git a/project/plugins.sbt b/project/plugins.sbt index d18ec386..ea5a0ea0 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -13,6 +13,11 @@ addSbtPlugin("io.kevinlee" % "sbt-docusaur" % "0.13.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.11") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") + +addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.2") + val sbtDevOopsVersion = "2.24.0" addSbtPlugin("io.kevinlee" % "sbt-devoops-scala" % sbtDevOopsVersion) addSbtPlugin("io.kevinlee" % "sbt-devoops-sbt-extra" % sbtDevOopsVersion)