Skip to content

Commit

Permalink
Issue #631 - Scala.js support is broken (In Progress)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-lee committed Dec 8, 2024
1 parent 918a240 commit 3f8bbf6
Show file tree
Hide file tree
Showing 8 changed files with 2,515 additions and 85 deletions.
171 changes: 87 additions & 84 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,34 @@ lazy val effectie = (project in file("."))
.settings(mavenCentralPublishSettings)
.aggregate(
testing4CatsJvm,
// testing4CatsJs,
testing4CatsJs,
coreJvm,
// coreJs,
coreJs,
syntaxJvm,
// syntaxJs,
syntaxJs,
catsJvm,
// catsJs,
catsJs,
timeJvm,
// timeJs,
timeJs,
timeCatsEffect2Jvm,
// timeCatsEffect2Js,
timeCatsEffect2Js,
timeCatsEffect3Jvm,
// timeCatsEffect3Js,
timeCatsEffect3Js,
catsEffect2Jvm,
// catsEffect2Js,
catsEffect2Js,
catsEffect3Jvm,
// catsEffect3Js,
catsEffect3Js,
monix3Jvm,
// monix3Js,
monix3Js,
)

lazy val core = module(ProjectName("core"), crossProject(JVMPlatform, JSPlatform))
.settings(
description := "Effect Utils - Core",
libraryDependencies ++= List(
libs.tests.extrasConcurrent,
libs.tests.extrasConcurrentTesting,
libs.libCatsCore(props.catsVersion) % Test,
libs.tests.extrasConcurrent.value,
libs.tests.extrasConcurrentTesting.value,
libs.libCatsCore(props.catsVersion).value % Test,
) ++ (
if (scalaVersion.value.startsWith("2.12"))
List("org.scala-lang.modules" %% "scala-collection-compat" % "2.8.1")
Expand All @@ -103,9 +103,9 @@ lazy val syntax = module(ProjectName("syntax"), crossProject(JVMPlatform, JSP
.settings(
description := "Effect Utils - Syntax",
libraryDependencies ++= List(
libs.libCatsCore(props.catsVersion),
libs.tests.extrasConcurrent,
libs.tests.extrasConcurrentTesting,
libs.libCatsCore(props.catsVersion).value,
libs.tests.extrasConcurrent.value,
libs.tests.extrasConcurrentTesting.value,
),
libraryDependencies :=
libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value),
Expand All @@ -120,9 +120,9 @@ lazy val cats = module(ProjectName("cats"), crossProject(JVMPlatform, JSPlatform
.settings(
description := "Effect Utils - Cats",
libraryDependencies ++= List(
libs.libCatsCore(props.catsVersion),
libs.tests.extrasConcurrent,
libs.tests.extrasConcurrentTesting,
libs.libCatsCore(props.catsVersion).value,
libs.tests.extrasConcurrent.value,
libs.tests.extrasConcurrentTesting.value,
),
libraryDependencies :=
libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value),
Expand All @@ -144,8 +144,8 @@ lazy val testing4Cats = module(ProjectName("test4cats"), crossProject(JVMPlat
description := "Effect's test utils for Cats",
libraryDependencies :=
libraryDependencies.value ++ List(
libs.libCatsCore(props.catsVersion)
) ++ List(libs.hedgehogCore, libs.hedgehogRunner),
libs.libCatsCore(props.catsVersion).value
) ++ List(libs.hedgehogCore.value, libs.hedgehogRunner.value),
libraryDependencies := libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value),
console / initialCommands :=
"""import effectie.testing.cats._""",
Expand All @@ -159,14 +159,14 @@ lazy val time = module(ProjectName("time"), crossProject(JVMPlatform, JSPlatform
.settings(
description := "Effect Utils - Time",
libraryDependencies ++= List(
libs.libCatsCore(props.catsVersion),
libs.tests.extrasConcurrent,
libs.tests.extrasConcurrentTesting,
libs.libCatsCore(props.catsVersion).value,
libs.tests.extrasConcurrent.value,
libs.tests.extrasConcurrentTesting.value,
) ++ (
if (scalaVersion.value.startsWith("2.12"))
List(libs.libCatsEffect(props.catsEffect2Version) % Test)
List(libs.libCatsEffect(props.catsEffect2Version).value % Test)
else
List(libs.libCatsEffect(props.catsEffect2LatestVersion) % Test)
List(libs.libCatsEffect(props.catsEffect2LatestVersion).value % Test)
),
libraryDependencies :=
libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value),
Expand All @@ -190,22 +190,22 @@ lazy val timeCatsEffect2 = module(ProjectName("time-cats-effect2"), crossProj
libraryDependencies :=
(SemVer.parseUnsafe(scalaVersion.value) match {
case SemVer(Major(2), Minor(11), _, _, _) =>
libraryDependencies.value ++ Seq(libs.libCatsCore_2_0_0, libs.libCatsEffect_2_0_0)
libraryDependencies.value ++ Seq(libs.libCatsCore_2_0_0.value, libs.libCatsEffect_2_0_0.value)
case SemVer(
Major(3),
Minor(0),
Patch(0),
Some(PreRelease(List(Dsv(List(Anh.Alphabet("RC"), Anh.Num("1")))))),
_,
) =>
Major(3),
Minor(0),
Patch(0),
Some(PreRelease(List(Dsv(List(Anh.Alphabet("RC"), Anh.Num("1")))))),
_,
) =>
libraryDependencies.value ++ Seq(
libs.libCatsCore(props.catsVersion),
libs.libCatsEffect(props.catsEffect2Version),
libs.libCatsCore(props.catsVersion).value,
libs.libCatsEffect(props.catsEffect2Version).value,
)
case x =>
libraryDependencies.value ++ Seq(
libs.libCatsCore(props.catsVersion),
libs.libCatsEffect(props.catsEffect2LatestVersion),
libs.libCatsCore(props.catsVersion).value,
libs.libCatsEffect(props.catsEffect2LatestVersion).value,
)
}),
libraryDependencies := libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value),
Expand All @@ -225,10 +225,10 @@ lazy val timeCatsEffect3 = module(ProjectName("time-cats-effect3"), crossProj
.settings(
description := "Effect Utils - Time with Cats Effect 3",
libraryDependencies ++= List(
libs.libCatsCore(props.catsVersion),
libs.libCatsEffect(props.catsEffect3Version),
libs.libCatsEffectTestKit % Test excludeAll ("org.scalacheck"),
libs.tests.extrasHedgehogCatsEffect3,
libs.libCatsCore(props.catsVersion).value,
libs.libCatsEffect(props.catsEffect3Version).value,
libs.libCatsEffectTestKit.value % Test excludeAll ("org.scalacheck"),
libs.tests.extrasHedgehogCatsEffect3.value,
),
libraryDependencies := libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value),
)
Expand All @@ -249,7 +249,7 @@ lazy val catsEffect2 = module(ProjectName("cats-effect2"), crossProject(JVMPl
libraryDependencies :=
(SemVer.parseUnsafe(scalaVersion.value) match {
case SemVer(Major(2), Minor(11), _, _, _) =>
libraryDependencies.value ++ Seq(libs.libCatsCore_2_0_0, libs.libCatsEffect_2_0_0)
libraryDependencies.value ++ Seq(libs.libCatsCore_2_0_0.value, libs.libCatsEffect_2_0_0.value)
case SemVer(
Major(3),
Minor(0),
Expand All @@ -258,13 +258,13 @@ lazy val catsEffect2 = module(ProjectName("cats-effect2"), crossProject(JVMPl
_,
) =>
libraryDependencies.value ++ Seq(
libs.libCatsCore(props.catsVersion),
libs.libCatsEffect(props.catsEffect2Version),
libs.libCatsCore(props.catsVersion).value,
libs.libCatsEffect(props.catsEffect2Version).value,
)
case x =>
libraryDependencies.value ++ Seq(
libs.libCatsCore(props.catsVersion),
libs.libCatsEffect(props.catsEffect2LatestVersion),
libs.libCatsCore(props.catsVersion).value,
libs.libCatsEffect(props.catsEffect2LatestVersion).value,
)
}),
libraryDependencies := libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value),
Expand All @@ -285,10 +285,10 @@ lazy val catsEffect3 = module(ProjectName("cats-effect3"), crossProject(JVMPl
.settings(
description := "Effect Utils - Cats Effect 3",
libraryDependencies ++= List(
libs.libCatsCore(props.catsVersion),
libs.libCatsEffect(props.catsEffect3Version),
libs.libCatsEffectTestKit % Test excludeAll ("org.scalacheck"),
libs.tests.extrasHedgehogCatsEffect3,
libs.libCatsCore(props.catsVersion).value,
libs.libCatsEffect(props.catsEffect3Version).value,
libs.libCatsEffectTestKit.value % Test excludeAll ("org.scalacheck"),
libs.tests.extrasHedgehogCatsEffect3.value,
),
libraryDependencies := libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value),
console / initialCommands :=
Expand All @@ -315,9 +315,9 @@ lazy val monix3 = module(ProjectName("monix3"), crossProject(JVMPlatform, JSP
SemVer.parseUnsafe(scalaVersion.value),
) {
case (Major(2), Minor(11), _) =>
libraryDependencies.value ++ List(libs.libMonix3_3_0)
libraryDependencies.value ++ List(libs.libMonix3_3_0.value)
case x =>
libraryDependencies.value ++ List(libs.libMonix)
libraryDependencies.value ++ List(libs.libMonix.value)
},
libraryDependencies := libraryDependenciesPostProcess(isScala3(scalaVersion.value), libraryDependencies.value),
)
Expand Down Expand Up @@ -347,8 +347,8 @@ lazy val docs = (project in file("docs-gen-tmp/docs"))
List(
"io.kevinlee" %% "effectie-cats-effect2" % latestTag,
"io.kevinlee" %% "effectie-monix3" % latestTag,
libs.extrasCats,
libs.extrasConcurrent,
libs.extrasCats.value,
libs.extrasConcurrent.value,
)
},
libraryDependencies := libraryDependenciesPostProcess(
Expand Down Expand Up @@ -476,39 +476,41 @@ lazy val props =
lazy val libs =
new {
val hedgehogVersion = props.hedgehogLatestVersion
lazy val hedgehogCore = "qa.hedgehog" %% "hedgehog-core" % hedgehogVersion
lazy val hedgehogRunner = "qa.hedgehog" %% "hedgehog-runner" % hedgehogVersion
lazy val hedgehogSbt = "qa.hedgehog" %% "hedgehog-sbt" % hedgehogVersion

lazy val hedgehogLibs: List[ModuleID] =
List(
hedgehogCore,
hedgehogRunner,
hedgehogSbt,
lazy val hedgehogCore = Def.setting("qa.hedgehog" %%% "hedgehog-core" % hedgehogVersion)
lazy val hedgehogRunner = Def.setting("qa.hedgehog" %%% "hedgehog-runner" % hedgehogVersion)
lazy val hedgehogSbt = Def.setting("qa.hedgehog" %%% "hedgehog-sbt" % hedgehogVersion)

lazy val hedgehogLibs =
Def.setting(
List(
hedgehogCore.value,
hedgehogRunner.value,
hedgehogSbt.value,
)
)

def libCatsCore(catsVersion: String): ModuleID = "org.typelevel" %% "cats-core" % catsVersion
def libCatsKernel(catsVersion: String): ModuleID = "org.typelevel" %% "cats-kernel" % catsVersion
def libCatsCore(catsVersion: String) = Def.setting("org.typelevel" %%% "cats-core" % catsVersion)
def libCatsKernel(catsVersion: String) = Def.setting("org.typelevel" %%% "cats-kernel" % catsVersion)

def libCatsEffect(catsEffectVersion: String): ModuleID = "org.typelevel" %% "cats-effect" % catsEffectVersion
def libCatsEffect(catsEffectVersion: String) = Def.setting("org.typelevel" %%% "cats-effect" % catsEffectVersion)

lazy val libCatsEffectTestKit = "org.typelevel" %% "cats-effect-kernel-testkit" % props.catsEffect3Version
lazy val libCatsEffectTestKit = Def.setting("org.typelevel" %%% "cats-effect-kernel-testkit" % props.catsEffect3Version)

lazy val libCatsCore_2_0_0: ModuleID = "org.typelevel" %% "cats-core" % props.cats2_0_0Version
lazy val libCatsEffect_2_0_0: ModuleID = "org.typelevel" %% "cats-effect" % props.catsEffect2_0_0Version
lazy val libCatsCore_2_0_0 = Def.setting("org.typelevel" %%% "cats-core" % props.cats2_0_0Version)
lazy val libCatsEffect_2_0_0= Def.setting("org.typelevel" %%% "cats-effect" % props.catsEffect2_0_0Version)

lazy val libMonix3_3_0: ModuleID = "io.monix" %% "monix" % props.monixVersion3_3_0
lazy val libMonix: ModuleID = "io.monix" %% "monix" % props.monixVersion
lazy val libMonix3_3_0= Def.setting("io.monix" %%% "monix" % props.monixVersion3_3_0)
lazy val libMonix = Def.setting("io.monix" %%% "monix" % props.monixVersion)

lazy val extrasCats = "io.kevinlee" %% "extras-cats" % props.ExtrasVersion
lazy val extrasCats = Def.setting("io.kevinlee" %%% "extras-cats" % props.ExtrasVersion)

lazy val extrasConcurrent = "io.kevinlee" %% "extras-concurrent" % props.ExtrasVersion
lazy val extrasConcurrentTesting = "io.kevinlee" %% "extras-concurrent-testing" % props.ExtrasVersion
lazy val extrasConcurrent = Def.setting("io.kevinlee" %%% "extras-concurrent" % props.ExtrasVersion)
lazy val extrasConcurrentTesting = Def.setting("io.kevinlee" %%% "extras-concurrent-testing" % props.ExtrasVersion)

lazy val tests = new {
lazy val extrasHedgehogCatsEffect3 = "io.kevinlee" %% "extras-hedgehog-ce3" % props.ExtrasVersion % Test
lazy val extrasConcurrent = "io.kevinlee" %% "extras-concurrent" % props.ExtrasVersion % Test
lazy val extrasConcurrentTesting = "io.kevinlee" %% "extras-concurrent-testing" % props.ExtrasVersion % Test
lazy val extrasHedgehogCatsEffect3 = Def.setting("io.kevinlee" %%% "extras-hedgehog-ce3" % props.ExtrasVersion % Test)
lazy val extrasConcurrent = Def.setting("io.kevinlee" %%% "extras-concurrent" % props.ExtrasVersion % Test)
lazy val extrasConcurrentTesting = Def.setting("io.kevinlee" %%% "extras-concurrent-testing" % props.ExtrasVersion % Test)
}
}

Expand Down Expand Up @@ -548,7 +550,7 @@ def module(projectName: ProjectName, crossProject: CrossProject.Builder): CrossP
else
((ThisBuild / baseDirectory).value / ".scalafix-scala2.conf").some
),
libraryDependencies ++= libs.hedgehogLibs.map(_ % Test) ++ List(libs.extrasCats % Test),
libraryDependencies ++= libs.hedgehogLibs.value.map(_ % Test) ++ List(libs.extrasCats.value % Test),
/* WartRemover and scalacOptions { */
// Compile / compile / wartremoverErrors ++= commonWarts((update / scalaBinaryVersion).value),
// Test / compile / wartremoverErrors ++= commonWarts((update / scalaBinaryVersion).value),
Expand Down Expand Up @@ -630,12 +632,13 @@ def module(projectName: ProjectName, crossProject: CrossProject.Builder): CrossP
.settings(mavenCentralPublishSettings)
}

lazy val jsSettingsForFuture: SettingsDefinition = List(
Test / scalacOptions ++= (if (scalaVersion.value.startsWith("3")) List.empty
else List("-P:scalajs:nowarnGlobalExecutionContext")),
Test / compile / scalacOptions ++= (if (scalaVersion.value.startsWith("3")) List.empty
else List("-P:scalajs:nowarnGlobalExecutionContext")),
)
lazy val jsSettingsForFuture: SettingsDefinition = List.empty
//lazy val jsSettingsForFuture: SettingsDefinition = List(
// Test / scalacOptions ++= (if (scalaVersion.value.startsWith("3")) List.empty
// else List("-P:scalajs:nowarnGlobalExecutionContext")),
// Test / compile / scalacOptions ++= (if (scalaVersion.value.startsWith("3")) List.empty
// else List("-P:scalajs:nowarnGlobalExecutionContext")),
//)

lazy val jsSettings: SettingsDefinition = List(
Test / fork := false
Expand Down
Loading

0 comments on commit 3f8bbf6

Please sign in to comment.