Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Add Scala 3 support. (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
quelgar authored Feb 16, 2022
1 parent 76e1eac commit 9b6fc67
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
fail-fast: false
matrix:
java: ['8', '11', '17']
scala: ['2.12.15', '2.13.8']
scala: ['2.12.15', '2.13.8', '3.1.1']
steps:
- name: Checkout current branch
uses: actions/checkout@v2.4.0
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
| --- | --- | --- | --- | --- |
| [![Project stage][Stage]][Stage-Page] | ![CI][Badge-CI] | [![Release Artifacts][Badge-SonatypeReleases]][Link-SonatypeReleases] | [![Snapshot Artifacts][Badge-SonatypeSnapshots]][Link-SonatypeSnapshots] | [![Discord][Badge-Discord]][Link-Discord] |

This library provides interoperability between **Monix 3.4** and **ZIO 1 and ZIO 2**.
This library provides interoperability between **Monix 3.4** and **ZIO 1 and ZIO 2**. Both JVM and Scala.js are supported.

## Tasks

Expand Down Expand Up @@ -54,7 +54,6 @@ def zioBasedProcessor(s: String): Task[Unit] = ???

val zioEffects = for {
zioRuntime <- ZIO.runtime[Any]
monixTask =
_ <- ZIO.fromMonixTask {
monixBasedApi(s =>
zioBasedProcessor(s).toMonixTaskUsingRuntime(zioRuntime)
Expand Down
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ lazy val interopMonix = crossProject(JSPlatform, JVMPlatform)
.in(file("interop-monix"))
.enablePlugins(BuildInfoPlugin)
.settings(stdSettings("zio-interop-monix"))
.settings(dottySettings)
.settings(crossProjectSettings)
.settings(testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")))
.settings(buildInfoSettings("zio.interop.monix"))
Expand Down
31 changes: 30 additions & 1 deletion project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ object BuildHelper {

val Scala212: String = versions("2.12")
val Scala213: String = versions("2.13")
val Scala3: String = versions("3.1")

private val stdOptions = Seq(
"-deprecation",
Expand Down Expand Up @@ -63,8 +64,36 @@ object BuildHelper {
buildInfoPackage := packageName
)

val dottySettings = Seq(
scalacOptions ++= {
if (scalaVersion.value == Scala3)
Seq("-noindent")
else
Seq()
},
Compile / doc / sources := {
val old = (Compile / doc / sources).value
if (scalaVersion.value == Scala3)
Nil
else
old
},
Test / parallelExecution := {
val old = (Test / parallelExecution).value
if (scalaVersion.value == Scala3)
false
else
old
}
)

def extraOptions(scalaVersion: String, optimize: Boolean) =
CrossVersion.partialVersion(scalaVersion) match {
case Some((3, _)) =>
Seq(
"-language:implicitConversions",
"-Xignore-scala2-macros"
)
case Some((2, 13)) =>
Seq(
"-Ywarn-unused:params,-implicits"
Expand Down Expand Up @@ -151,7 +180,7 @@ object BuildHelper {
def stdSettings(prjName: String) =
Seq(
name := s"$prjName",
crossScalaVersions := Seq(Scala212, Scala213),
crossScalaVersions := Seq(Scala212, Scala213, Scala3),
ThisBuild / scalaVersion := Scala213,
scalacOptions ++= stdOptions ++ extraOptions(scalaVersion.value, optimize = !isSnapshot.value),
Test / parallelExecution := true,
Expand Down

0 comments on commit 9b6fc67

Please sign in to comment.