Skip to content

Commit

Permalink
Close #433 - Add support for Scala Native
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-lee committed Apr 13, 2024
1 parent fe1ce6e commit 5e83940
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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/checkout@v4
Expand Down
148 changes: 89 additions & 59 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,41 @@ lazy val loggerF = (project in file("."))
.aggregate(
coreJvm,
coreJs,
coreNative,
slf4jLoggerJvm,
slf4jLoggerJs,
slf4jLoggerNative,
log4sLoggerJvm,
log4sLoggerJs,
log4sLoggerNative,
log4jLoggerJvm,
log4jLoggerJs,
log4jLoggerNative,
sbtLoggingJvm,
sbtLoggingJs,
sbtLoggingNative,
catsJvm,
catsJs,
catsNative,
logbackMdcMonix3Jvm,
logbackMdcMonix3Js,
logbackMdcMonix3Native,
testKitJvm,
testKitJs,
testKitNative,
catsEffectJvm,
catsEffectJs,
catsEffectNative,
catsEffect3Jvm,
catsEffect3Js,
catsEffect3Native,
monixJvm,
monixJs,
monixNative,
)

lazy val core =
module(ProjectName("core"), crossProject(JVMPlatform, JSPlatform))
lazy val core =
module(ProjectName("core"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - Core",
libraryDependencies ++= List(
Expand All @@ -108,10 +119,11 @@ lazy val core =
libraryDependencies.value,
),
)
lazy val coreJvm = core.jvm
lazy val coreJs = core.js
lazy val coreJvm = core.jvm
lazy val coreJs = core.js
lazy val coreNative = core.native.settings(nativeSettings)

lazy val slf4jLogger = module(ProjectName("slf4j"), crossProject(JVMPlatform, JSPlatform))
lazy val slf4jLogger = module(ProjectName("slf4j"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - Logger with Slf4j",
libraryDependencies ++= Seq(
Expand All @@ -123,11 +135,12 @@ lazy val slf4jLogger = module(ProjectName("slf4j"), crossProject(JVMPlatform,
),
)
.dependsOn(core)
lazy val slf4jLoggerJvm = slf4jLogger.jvm
lazy val slf4jLoggerJs = slf4jLogger.js
lazy val slf4jLoggerJvm = slf4jLogger.jvm
lazy val slf4jLoggerJs = slf4jLogger.js
lazy val slf4jLoggerNative = slf4jLogger.native.settings(nativeSettings)

lazy val log4sLogger =
module(ProjectName("log4s"), crossProject(JVMPlatform, JSPlatform))
lazy val log4sLogger =
module(ProjectName("log4s"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - Logger with Log4s",
libraryDependencies := libraryDependenciesRemoveScala3Incompatible(
Expand All @@ -139,11 +152,12 @@ lazy val log4sLogger =
),
)
.dependsOn(core)
lazy val log4sLoggerJvm = log4sLogger.jvm
lazy val log4sLoggerJs = log4sLogger.js
lazy val log4sLoggerJvm = log4sLogger.jvm
lazy val log4sLoggerJs = log4sLogger.js
lazy val log4sLoggerNative = log4sLogger.native.settings(nativeSettings)

lazy val log4jLogger =
module(ProjectName("log4j"), crossProject(JVMPlatform, JSPlatform))
lazy val log4jLogger =
module(ProjectName("log4j"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - Logger with Log4j",
Compile / unmanagedSourceDirectories ++= {
Expand Down Expand Up @@ -199,11 +213,12 @@ lazy val log4jLogger =
),
)
.dependsOn(core)
lazy val log4jLoggerJvm = log4jLogger.jvm
lazy val log4jLoggerJs = log4jLogger.js
lazy val log4jLoggerJvm = log4jLogger.jvm
lazy val log4jLoggerJs = log4jLogger.js
lazy val log4jLoggerNative = log4jLogger.native.settings(nativeSettings)

lazy val sbtLogging =
module(ProjectName("sbt-logging"), crossProject(JVMPlatform, JSPlatform))
lazy val sbtLogging =
module(ProjectName("sbt-logging"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - Logger with sbt logging",
libraryDependencies ++= crossVersionProps(
Expand Down Expand Up @@ -231,11 +246,12 @@ lazy val sbtLogging =
),
)
.dependsOn(core)
lazy val sbtLoggingJvm = sbtLogging.jvm
lazy val sbtLoggingJs = sbtLogging.js
lazy val sbtLoggingJvm = sbtLogging.jvm
lazy val sbtLoggingJs = sbtLogging.js
lazy val sbtLoggingNative = sbtLogging.native.settings(nativeSettings)

lazy val cats =
module(ProjectName("cats"), crossProject(JVMPlatform, JSPlatform))
lazy val cats =
module(ProjectName("cats"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - Cats",
libraryDependencies ++= libs.tests.hedgehogLibs ++ List(
Expand All @@ -250,10 +266,11 @@ lazy val cats =
),
)
.dependsOn(core % props.IncludeTest)
lazy val catsJvm = cats.jvm
lazy val catsJs = cats.js
lazy val catsJvm = cats.jvm
lazy val catsJs = cats.js
lazy val catsNative = cats.native.settings(nativeSettings)

lazy val logbackMdcMonix3 = module(ProjectName("logback-mdc-monix3"), crossProject(JVMPlatform, JSPlatform))
lazy val logbackMdcMonix3 = module(ProjectName("logback-mdc-monix3"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - logback MDC context map support for Monix 3",
libraryDependencies ++= Seq(
Expand All @@ -273,11 +290,12 @@ lazy val logbackMdcMonix3 = module(ProjectName("logback-mdc-monix3"), crossPr
monix % Test,
slf4jLogger % Test,
)
lazy val logbackMdcMonix3Jvm = logbackMdcMonix3.jvm
lazy val logbackMdcMonix3Js = logbackMdcMonix3.js
lazy val logbackMdcMonix3Jvm = logbackMdcMonix3.jvm
lazy val logbackMdcMonix3Js = logbackMdcMonix3.js
lazy val logbackMdcMonix3Native = logbackMdcMonix3.native.settings(nativeSettings)

lazy val testKit =
module(ProjectName("test-kit"), crossProject(JVMPlatform, JSPlatform))
lazy val testKit =
module(ProjectName("test-kit"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - Test Kit",
libraryDependencies ++= libs.tests.hedgehogLibs ++
Expand All @@ -291,11 +309,12 @@ lazy val testKit =
),
)
.dependsOn(core % props.IncludeTest)
lazy val testKitJvm = testKit.jvm
lazy val testKitJs = testKit.js
lazy val testKitJvm = testKit.jvm
lazy val testKitJs = testKit.js
lazy val testKitNative = testKit.native.settings(nativeSettings)

lazy val catsEffect =
module(ProjectName("cats-effect"), crossProject(JVMPlatform, JSPlatform))
lazy val catsEffect =
module(ProjectName("cats-effect"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - Cats Effect",
libraryDependencies ++= libs.tests.hedgehogLibs ++ List(libs.effectieCatsEffect2 % Test),
Expand All @@ -306,11 +325,12 @@ lazy val catsEffect =
)
.settings(noPublish)
.dependsOn(core % props.IncludeTest, cats)
lazy val catsEffectJvm = catsEffect.jvm
lazy val catsEffectJs = catsEffect.js
lazy val catsEffectJvm = catsEffect.jvm
lazy val catsEffectJs = catsEffect.js
lazy val catsEffectNative = catsEffect.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 := "Logger for F[_] - Cats Effect 3",
libraryDependencies ++= libs.tests.hedgehogLibs ++ List(
Expand All @@ -324,11 +344,12 @@ lazy val catsEffect3 =
)
.settings(noPublish)
.dependsOn(core % props.IncludeTest, cats)
lazy val catsEffect3Jvm = catsEffect3.jvm
lazy val catsEffect3Js = catsEffect3.js
lazy val catsEffect3Jvm = catsEffect3.jvm
lazy val catsEffect3Js = catsEffect3.js
lazy val catsEffect3Native = catsEffect3.native.settings(nativeSettings)

lazy val monix =
module(ProjectName("monix"), crossProject(JVMPlatform, JSPlatform))
lazy val monix =
module(ProjectName("monix"), crossProject(JVMPlatform, JSPlatform, NativePlatform))
.settings(
description := "Logger for F[_] - Monix",
libraryDependencies ++= libs.tests.hedgehogLibs ++ List(libs.effectieMonix % Test),
Expand All @@ -339,13 +360,14 @@ lazy val monix =
)
.settings(noPublish)
.dependsOn(core % props.IncludeTest, cats)
lazy val monixJvm = monix.jvm
lazy val monixJs = monix.js
lazy val monixJvm = monix.jvm
lazy val monixJs = monix.js
lazy val monixNative = monix.native.settings(nativeSettings)

lazy val testCatsEffectWithSlf4jLogger =
lazy val testCatsEffectWithSlf4jLogger =
testProject(
ProjectName("cats-effect-slf4j"),
crossProject(JVMPlatform, JSPlatform),
crossProject(JVMPlatform, JSPlatform, NativePlatform),
)
.settings(
description := "Test Logger for F[_] - Logger with Slf4j",
Expand All @@ -357,13 +379,14 @@ lazy val testCatsEffectWithSlf4jLogger =
)
.settings(noPublish)
.dependsOn(core % props.IncludeTest, slf4jLogger, catsEffect % props.IncludeTest)
lazy val testCatsEffectWithSlf4jLoggerJvm = testCatsEffectWithSlf4jLogger.jvm
lazy val testCatsEffectWithSlf4jLoggerJs = testCatsEffectWithSlf4jLogger.js
lazy val testCatsEffectWithSlf4jLoggerJvm = testCatsEffectWithSlf4jLogger.jvm
lazy val testCatsEffectWithSlf4jLoggerJs = testCatsEffectWithSlf4jLogger.js
lazy val testCatsEffectWithSlf4jLoggerNative = testCatsEffectWithSlf4jLogger.native.settings(nativeSettings)

lazy val testMonixWithSlf4jLogger =
lazy val testMonixWithSlf4jLogger =
testProject(
ProjectName("monix-slf4j"),
crossProject(JVMPlatform, JSPlatform),
crossProject(JVMPlatform, JSPlatform, NativePlatform),
)
.settings(
description := "Test Logger for F[_] - Logger with Slf4j",
Expand All @@ -375,13 +398,14 @@ lazy val testMonixWithSlf4jLogger =
)
.settings(noPublish)
.dependsOn(core % props.IncludeTest, slf4jLogger, monix % props.IncludeTest)
lazy val testMonixWithSlf4jLoggerJvm = testMonixWithSlf4jLogger.jvm
lazy val testMonixWithSlf4jLoggerJs = testMonixWithSlf4jLogger.js
lazy val testMonixWithSlf4jLoggerJvm = testMonixWithSlf4jLogger.jvm
lazy val testMonixWithSlf4jLoggerJs = testMonixWithSlf4jLogger.js
lazy val testMonixWithSlf4jLoggerNative = testMonixWithSlf4jLogger.native.settings(nativeSettings)

lazy val testCatsEffectWithLog4sLogger =
lazy val testCatsEffectWithLog4sLogger =
testProject(
ProjectName("cats-effect-log4s"),
crossProject(JVMPlatform, JSPlatform),
crossProject(JVMPlatform, JSPlatform, NativePlatform),
)
.settings(
description := "Test Logger for F[_] - Logger with Log4s",
Expand All @@ -393,13 +417,14 @@ lazy val testCatsEffectWithLog4sLogger =
)
.settings(noPublish)
.dependsOn(core % props.IncludeTest, log4sLogger, catsEffect % props.IncludeTest)
lazy val testCatsEffectWithLog4sLoggerJvm = testCatsEffectWithLog4sLogger.jvm
lazy val testCatsEffectWithLog4sLoggerJs = testCatsEffectWithLog4sLogger.js
lazy val testCatsEffectWithLog4sLoggerJvm = testCatsEffectWithLog4sLogger.jvm
lazy val testCatsEffectWithLog4sLoggerJs = testCatsEffectWithLog4sLogger.js
lazy val testCatsEffectWithLog4sLoggerNative = testCatsEffectWithLog4sLogger.native.settings(nativeSettings)

lazy val testCatsEffectWithLog4jLogger =
lazy val testCatsEffectWithLog4jLogger =
testProject(
ProjectName("cats-effect-log4j"),
crossProject(JVMPlatform, JSPlatform),
crossProject(JVMPlatform, JSPlatform, NativePlatform),
)
.settings(
description := "Test Logger for F[_] - Logger with Log4j",
Expand All @@ -411,8 +436,9 @@ lazy val testCatsEffectWithLog4jLogger =
)
.settings(noPublish)
.dependsOn(core % props.IncludeTest, log4jLogger, catsEffect % props.IncludeTest)
lazy val testCatsEffectWithLog4jLoggerJvm = testCatsEffectWithLog4jLogger.jvm
lazy val testCatsEffectWithLog4jLoggerJs = testCatsEffectWithLog4jLogger.js
lazy val testCatsEffectWithLog4jLoggerJvm = testCatsEffectWithLog4jLogger.jvm
lazy val testCatsEffectWithLog4jLoggerJs = testCatsEffectWithLog4jLogger.js
lazy val testCatsEffectWithLog4jLoggerNative = testCatsEffectWithLog4jLogger.native.settings(nativeSettings)

lazy val docs = (project in file("docs-gen-tmp/docs"))
.enablePlugins(MdocPlugin, DocusaurPlugin)
Expand Down Expand Up @@ -514,7 +540,7 @@ lazy val props =
final val GitHubUsername = "Kevin-Lee"
final val RepoName = "logger-f"

final val Scala3Versions = List("3.0.2")
final val Scala3Versions = List("3.1.3")
final val Scala2Versions = List("2.13.6", "2.12.13")

// final val ProjectScalaVersion = Scala3Versions.head
Expand Down Expand Up @@ -693,3 +719,7 @@ def projectCommonSettings(projectName: String, crossProject: CrossProject.Builde
.settings(
mavenCentralPublishSettings
)

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 @@ -15,6 +15,11 @@ addSbtPlugin("io.kevinlee" % "sbt-docusaur" % "0.15.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 = "3.0.0"
addSbtPlugin("io.kevinlee" % "sbt-devoops-scala" % sbtDevOopsVersion)
addSbtPlugin("io.kevinlee" % "sbt-devoops-sbt-extra" % sbtDevOopsVersion)
Expand Down

0 comments on commit 5e83940

Please sign in to comment.