Skip to content

Commit

Permalink
Close #521 - Add support for Scala Native
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-lee committed Mar 19, 2023
1 parent 7022232 commit e0ccb89
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
scala:
- { name: "Scala 2", version: "2.12.13", binary-version: "2.12", java-version: "11", java-distribution: "temurin", report: "" }
- { name: "Scala 2", version: "2.13.6", binary-version: "2.13", java-version: "11", java-distribution: "temurin", report: "report" }
- { name: "Scala 3", version: "3.0.2", binary-version: "3", java-version: "11", java-distribution: "temurin", report: "" }
- { name: "Scala 3", version: "3.1.3", binary-version: "3", java-version: "11", java-distribution: "temurin", report: "" }

steps:
- uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
scala:
- { name: "Scala 2", version: "2.12.13", binary-version: "2.12", java-version: "11", java-distribution: "temurin", report: "" }
- { name: "Scala 2", version: "2.13.6", binary-version: "2.13", java-version: "11", java-distribution: "temurin", report: "" }
# - { name: "Scala 3", version: "3.0.2", binary-version: "3", java-version: "11", java-distribution: "temurin", report: "" }
# - { name: "Scala 3", version: "3.1.3", binary-version: "3", java-version: "11", java-distribution: "temurin", report: "" }

steps:
- uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
scala:
- { name: "Scala 2", version: "2.12.13", binary-version: "2.12", java-version: "11", java-distribution: "temurin", report: "" }
- { name: "Scala 2", version: "2.13.6", binary-version: "2.13", java-version: "11", java-distribution: "temurin", report: "report" }
- { name: "Scala 3", version: "3.0.2", binary-version: "3", java-version: "11", java-distribution: "temurin", report: "" }
- { name: "Scala 3", version: "3.1.3", binary-version: "3", java-version: "11", java-distribution: "temurin", report: "" }

steps:
- uses: actions/[email protected]
Expand Down
62 changes: 40 additions & 22 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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.settings(nativeSettings)

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(
Expand All @@ -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.settings(nativeSettings)

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(
Expand All @@ -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.settings(nativeSettings)

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 :=
Expand All @@ -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.settings(nativeSettings)

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 :=
Expand Down Expand Up @@ -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.settings(nativeSettings)

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(
Expand All @@ -206,13 +218,14 @@ lazy val catsEffect3 = module(ProjectName("cats-effect3"), crossProject(JVMPl
cats % props.IncludeTest,
testing4Cats % Test,
)
lazy val catsEffect3Jvm = catsEffect3.jvm
lazy val catsEffect3Js = catsEffect3
lazy val catsEffect3Jvm = catsEffect3.jvm
lazy val catsEffect3Js = catsEffect3
.js
.settings(jsSettingsForFuture)
.settings(jsSettings)
lazy val catsEffect3Native = catsEffect3.native.settings(nativeSettings)

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 :=
Expand All @@ -234,11 +247,12 @@ lazy val monix3 = module(ProjectName("monix3"), crossProject(JVMPlatform, JSP
catsEffect2 % props.IncludeTest,
testing4Cats % Test,
)
lazy val monix3Jvm = monix3.jvm
lazy val monix3Js = monix3
lazy val monix3Jvm = monix3.jvm
lazy val monix3Js = monix3
.js
.settings(jsSettingsForFuture)
.settings(jsSettings)
lazy val monix3Native = monix3.native.settings(nativeSettings)

lazy val docs = (project in file("docs-gen-tmp/docs"))
.enablePlugins(MdocPlugin, DocusaurPlugin)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -546,3 +560,7 @@ lazy val jsSettingsForFuture: SettingsDefinition = List(
lazy val jsSettings: SettingsDefinition = List(
Test / fork := false
)

lazy val nativeSettings: SettingsDefinition = List(
Test / fork := false
)
5 changes: 5 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e0ccb89

Please sign in to comment.