Skip to content

Commit a705074

Browse files
authored
Merge pull request #1070 from japgolly/topic/upgrades
Upgrades
2 parents 644448f + 3232ae7 commit a705074

File tree

10 files changed

+88
-54
lines changed

10 files changed

+88
-54
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ jobs:
1515
ci:
1616
runs-on: ubuntu-latest
1717
strategy:
18+
fail-fast: false
1819
matrix:
1920
include:
20-
- java: 14
21+
- java: 18.0.1
2122
scala: 2
22-
- java: 8
23+
- java: 11.0.15
2324
scala: 3
2425
name: Scala v${{ matrix.scala }} / Java v${{ matrix.java }}
2526
steps:
@@ -32,7 +33,7 @@ jobs:
3233
- name: Setup Scala
3334
uses: japgolly/[email protected]
3435
with:
35-
java-version: adopt@1.${{ matrix.java }}
36+
java-version: adoptium@1.${{ matrix.java }}
3637

3738
- name: Build and test
3839
shell: bash

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Includes a router, testing utils, performance utils, more.
7373
##### Requirements:
7474
* React ≥ 17
7575
* Scala ≥ 2.13
76-
* Scala.JS ≥ 1.8
76+
* Scala.JS ≥ 1.10
7777

7878
##### Support:
7979
If you like what I do

doc/changelog/next.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 2.2.0
2+
3+
4+
* Scala.js upgraded to 1.10.0
5+
* microlibs upgraded to 4.1.0
6+
* Scala 3 upgraded to 3.1.2

downstream-tests/build.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ lazy val js = project
157157
Dep.microlibsCompileTime.value % Test,
158158
Dep.microlibsTestUtil.value % Test,
159159
Dep.scalaJsJavaTime.value % Test,
160+
Dep.scalaJsSecureRandom.value % Test,
160161
)
161162
},
162163
scalaJSLinkerConfig ~= { _
@@ -182,6 +183,7 @@ lazy val jsCE = project
182183
Dep.microlibsCompileTime.value % Test,
183184
Dep.microlibsTestUtil.value % Test,
184185
Dep.scalaJsJavaTime.value % Test,
186+
Dep.scalaJsSecureRandom.value % Test,
185187
)
186188
},
187189
)
@@ -202,6 +204,7 @@ lazy val jsCBIO = project
202204
Dep.microlibsCompileTime.value % Test,
203205
Dep.microlibsTestUtil.value % Test,
204206
Dep.scalaJsJavaTime.value % Test,
207+
Dep.scalaJsSecureRandom.value % Test,
205208
)
206209
},
207210
)

library/project/Build.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ object ScalaJsReact {
223223
Dep.nyayaGen.value % Test,
224224
Dep.nyayaTest.value % Test,
225225
Dep.scalaJsJavaTime.value % Test,
226+
Dep.scalaJsSecureRandom.value % Test,
226227
),
227228
jsDependencies ++= Seq(
228229
Dep.sizzleJs(Test).value,

library/project/Dependencies.scala

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ object Dependencies {
1111
// Externally observable
1212
val cats = "2.7.0"
1313
val catsEffect = "3.3.11"
14-
val microlibs = "4.0.0"
14+
val microlibs = "4.1.0"
1515
val monocle2 = "2.1.0"
1616
val monocle3 = "3.1.0"
1717
val scala2 = "2.13.8"
18-
val scala3 = "3.0.2"
18+
val scala3 = "3.1.2"
1919
val scalaJsDom = "2.0.0"
2020
val sourcecode = "0.2.8"
2121

@@ -28,38 +28,40 @@ object Dependencies {
2828
val nyaya = "1.0.0"
2929
val reactJs = "17.0.2"
3030
val scalaJsJavaTime = "1.0.0"
31+
val scalaJsSecureRandom = "1.0.0"
3132
val scalaTest = "3.2.11"
3233
val sizzleJs = "2.3.0"
3334
val univEq = "2.0.0"
3435
val utest = "0.7.11"
3536
}
3637

3738
object Dep {
38-
val cats = Def.setting("org.typelevel" %%% "cats-core" % Ver.cats)
39-
val catsEffect = Def.setting("org.typelevel" %%% "cats-effect" % Ver.catsEffect)
40-
val catsEffectLaws = Def.setting("org.typelevel" %%% "cats-effect-laws" % Ver.catsEffect)
41-
val catsEffectTestkit = Def.setting("org.typelevel" %%% "cats-effect-testkit" % Ver.catsEffect)
42-
val catsTestkit = Def.setting("org.typelevel" %%% "cats-testkit" % Ver.cats)
43-
val catsTestkitScalaTest = Def.setting("org.typelevel" %%% "cats-testkit-scalatest" % Ver.catsTestkitScalaTest)
44-
val disciplineScalaTest = Def.setting("org.typelevel" %%% "discipline-scalatest" % Ver.disciplineScalaTest)
45-
val macrotaskExecutor = Def.setting("org.scala-js" %%% "scala-js-macrotask-executor" % Ver.macrotaskExecutor)
46-
val microlibsCompileTime = Def.setting("com.github.japgolly.microlibs" %%% "compile-time" % Ver.microlibs)
47-
val microlibsTestUtil = Def.setting("com.github.japgolly.microlibs" %%% "test-util" % Ver.microlibs)
48-
val microlibsTypes = Def.setting("com.github.japgolly.microlibs" %%% "types" % Ver.microlibs)
49-
val monocle2 = Def.setting("com.github.julien-truffaut" %%% "monocle-core" % Ver.monocle2 cross CrossVersion.for3Use2_13 excludeAll(ExclusionRule(organization = "org.typelevel")))
50-
val monocle3 = Def.setting("dev.optics" %%% "monocle-core" % Ver.monocle3)
51-
val nyayaGen = Def.setting("com.github.japgolly.nyaya" %%% "nyaya-gen" % Ver.nyaya)
52-
val nyayaProp = Def.setting("com.github.japgolly.nyaya" %%% "nyaya-prop" % Ver.nyaya)
53-
val nyayaTest = Def.setting("com.github.japgolly.nyaya" %%% "nyaya-test" % Ver.nyaya)
54-
val scalaCompiler = Def.setting("org.scala-lang" % "scala-compiler" % scalaVersion.value)
55-
val scalaJsDom = Def.setting("org.scala-js" %%% "scalajs-dom" % Ver.scalaJsDom)
56-
val scalaJsJavaTime = Def.setting("org.scala-js" %%% "scalajs-java-time" % Ver.scalaJsJavaTime cross CrossVersion.for3Use2_13)
57-
val scalaReflect = Def.setting("org.scala-lang" % "scala-reflect" % scalaVersion.value)
58-
val scalaTest = Def.setting("org.scalatest" %%% "scalatest" % Ver.scalaTest)
59-
val sourcecode = Def.setting("com.lihaoyi" %%% "sourcecode" % Ver.sourcecode)
60-
val univEq = Def.setting("com.github.japgolly.univeq" %%% "univeq" % Ver.univEq)
61-
val univEqCats = Def.setting("com.github.japgolly.univeq" %%% "univeq-cats" % Ver.univEq)
62-
val utest = Def.setting("com.lihaoyi" %%% "utest" % Ver.utest)
39+
val cats = Def.setting("org.typelevel" %%% "cats-core" % Ver.cats)
40+
val catsEffect = Def.setting("org.typelevel" %%% "cats-effect" % Ver.catsEffect)
41+
val catsEffectLaws = Def.setting("org.typelevel" %%% "cats-effect-laws" % Ver.catsEffect)
42+
val catsEffectTestkit = Def.setting("org.typelevel" %%% "cats-effect-testkit" % Ver.catsEffect)
43+
val catsTestkit = Def.setting("org.typelevel" %%% "cats-testkit" % Ver.cats)
44+
val catsTestkitScalaTest = Def.setting("org.typelevel" %%% "cats-testkit-scalatest" % Ver.catsTestkitScalaTest)
45+
val disciplineScalaTest = Def.setting("org.typelevel" %%% "discipline-scalatest" % Ver.disciplineScalaTest)
46+
val macrotaskExecutor = Def.setting("org.scala-js" %%% "scala-js-macrotask-executor" % Ver.macrotaskExecutor)
47+
val microlibsCompileTime = Def.setting("com.github.japgolly.microlibs" %%% "compile-time" % Ver.microlibs)
48+
val microlibsTestUtil = Def.setting("com.github.japgolly.microlibs" %%% "test-util" % Ver.microlibs)
49+
val microlibsTypes = Def.setting("com.github.japgolly.microlibs" %%% "types" % Ver.microlibs)
50+
val monocle2 = Def.setting("com.github.julien-truffaut" %%% "monocle-core" % Ver.monocle2 cross CrossVersion.for3Use2_13 excludeAll(ExclusionRule(organization = "org.typelevel")))
51+
val monocle3 = Def.setting("dev.optics" %%% "monocle-core" % Ver.monocle3)
52+
val nyayaGen = Def.setting("com.github.japgolly.nyaya" %%% "nyaya-gen" % Ver.nyaya)
53+
val nyayaProp = Def.setting("com.github.japgolly.nyaya" %%% "nyaya-prop" % Ver.nyaya)
54+
val nyayaTest = Def.setting("com.github.japgolly.nyaya" %%% "nyaya-test" % Ver.nyaya)
55+
val scalaCompiler = Def.setting("org.scala-lang" % "scala-compiler" % scalaVersion.value)
56+
val scalaJsDom = Def.setting("org.scala-js" %%% "scalajs-dom" % Ver.scalaJsDom)
57+
val scalaJsJavaTime = Def.setting("org.scala-js" %%% "scalajs-java-time" % Ver.scalaJsJavaTime cross CrossVersion.for3Use2_13)
58+
val scalaJsSecureRandom = Def.setting("org.scala-js" %%% "scalajs-fake-insecure-java-securerandom" % Ver.scalaJsSecureRandom cross CrossVersion.for3Use2_13)
59+
val scalaReflect = Def.setting("org.scala-lang" % "scala-reflect" % scalaVersion.value)
60+
val scalaTest = Def.setting("org.scalatest" %%% "scalatest" % Ver.scalaTest)
61+
val sourcecode = Def.setting("com.lihaoyi" %%% "sourcecode" % Ver.sourcecode)
62+
val univEq = Def.setting("com.github.japgolly.univeq" %%% "univeq" % Ver.univEq)
63+
val univEqCats = Def.setting("com.github.japgolly.univeq" %%% "univeq-cats" % Ver.univEq)
64+
val utest = Def.setting("com.lihaoyi" %%% "utest" % Ver.utest)
6365

6466
// Compiler plugins
6567
val betterMonadicFor = compilerPlugin("com.olegpy" %% "better-monadic-for" % Ver.betterMonadicFor)

library/project/Lib.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ object Lib {
2222
"-language:higherKinds",
2323
"-language:existentials",
2424
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
25+
"-Wconf:msg=may.not.be.exhaustive:e", // Make non-exhaustive matches errors instead of warnings
26+
"-Wconf:msg=Reference.to.uninitialized.value:e", // Make uninitialised value calls errors instead of warnings
2527
"-Yno-generic-signatures", // Suppress generation of generic signatures for Java.
2628
)
2729

2830
def scalac2Flags = Seq(
2931
"-opt:l:inline",
3032
"-opt-inline-from:japgolly.scalajs.react.**",
31-
"-Wconf:msg=may.not.be.exhaustive:e", // Make non-exhaustive matches errors instead of warnings
32-
"-Wconf:msg=Reference.to.uninitialized.value:e", // Make uninitialised value calls errors instead of warnings
3333
"-Wunused:explicits", // Warn if an explicit parameter is unused.
3434
"-Wunused:implicits", // Warn if an implicit parameter is unused.
3535
"-Wunused:imports", // Warn if an import selector is not referenced.
@@ -61,6 +61,7 @@ object Lib {
6161

6262
def scalac3Flags = Seq(
6363
"-source:3.0-migration",
64+
"-Wconf:msg=unused:s", // Scala 3.1 doesn't support @nowarn("cat=unused")
6465
"-Ykind-projector",
6566
// "-Xprint:all",
6667
)

library/project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ libraryDependencies ++= Seq(
22
"org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0",
33
"org.scala-js" %% "scalajs-env-selenium" % "1.1.1")
44

5-
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")
5+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.0")
66
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
77
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
8-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0")
8+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")

library/scalafix.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ ThisBuild / scalacOptions ++= {
88
ThisBuild / semanticdbEnabled := true
99

1010
// NOTE: Upgrade downstream-tests/scalafix.sbt too!
11-
ThisBuild / semanticdbVersion := "4.4.35"
11+
ThisBuild / semanticdbVersion := "4.5.5"
1212

1313
ThisBuild / scalafixScalaBinaryVersion := "2.13"
1414

1515
ThisBuild / scalafixDependencies ++= Seq(
16-
"com.github.liancheng" %% "organize-imports" % "0.5.0"
16+
"com.github.liancheng" %% "organize-imports" % "0.6.0"
1717
)

library/tests/src/test/scala/japgolly/scalajs/react/core/ReusabilityTest.scala

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,31 @@ object ReusabilityTest extends TestSuite {
127127
assertEq(a ~=~ b, false)
128128
}
129129

130+
// Utest's Scala 3 macros don't handle inner macros well and will cause crash
131+
132+
private object derive {
133+
def CC0 = Reusability.derive[CC0]
134+
def CC1 = Reusability.derive[CC1]
135+
def CC2 = Reusability.derive[CC2]
136+
def CCT0_Int = Reusability.derive[CCT0[Int]]
137+
def CCT1_Int = Reusability.derive[CCT1[Int]]
138+
def CCT2_String = Reusability.derive[CCT2[String]]
139+
def CC1_i = Reusability.caseClassExcept[CC1]("i")
140+
def CC2_i = Reusability.caseClassExcept[CC2]("i")
141+
def CC2_n = Reusability.caseClassExcept[CC2]("n")
142+
def CC4_a_c = Reusability.caseClassExcept[CC4]("a", "c")
143+
}
144+
145+
private class DerivesByRef {
146+
class X
147+
implicit val x: Reusability[X] = Reusability.never
148+
val _ = x
149+
case class Y(x: X)
150+
implicit val y: Reusability[Y] = Reusability.derive[Y]
151+
val y1 = Y(new X)
152+
val y2 = Y(new X)
153+
}
154+
130155
override def tests = Tests {
131156

132157
"macros" - {
@@ -135,32 +160,32 @@ object ReusabilityTest extends TestSuite {
135160

136161
"caseClass" - {
137162
"cc0" - {
138-
implicit val r: Reusability[CC0] = Reusability.derive[CC0]
163+
implicit val r: Reusability[CC0] = derive.CC0
139164
test(CC0(), CC0(), true)
140165
}
141166
"cc1" - {
142-
implicit val r: Reusability[CC1] = Reusability.derive[CC1]
167+
implicit val r: Reusability[CC1] = derive.CC1
143168
test(CC1(2), CC1(2), true)
144169
test(CC1(2), CC1(3), false)
145170
}
146171
"cc2" - {
147-
implicit val r: Reusability[CC2] = Reusability.derive[CC2]
172+
implicit val r: Reusability[CC2] = derive.CC2
148173
test(CC2(3,"a"), CC2(3,"a"), true)
149174
test(CC2(3,"a"), CC2(3,"b"), false)
150175
test(CC2(3,"a"), CC2(4,"a"), false)
151176
}
152177

153178
"cct0" - {
154-
implicit val r: Reusability[CCT0[Int]] = Reusability.derive[CCT0[Int]]
179+
implicit val r: Reusability[CCT0[Int]] = derive.CCT0_Int
155180
test(CCT0[Int](), CCT0[Int](), true)
156181
}
157182
"cct1" - {
158-
implicit val r: Reusability[CCT1[Int]] = Reusability.derive[CCT1[Int]]
183+
implicit val r: Reusability[CCT1[Int]] = derive.CCT1_Int
159184
test(CCT1(2), CCT1(2), true)
160185
test(CCT1(2), CCT1(3), false)
161186
}
162187
"cct2" - {
163-
implicit val r: Reusability[CCT2[String]] = Reusability.derive[CCT2[String]]
188+
implicit val r: Reusability[CCT2[String]] = derive.CCT2_String
164189
test(CCT2(3,"a"), CCT2(3,"a"), true)
165190
test(CCT2(3,"a"), CCT2(3,"b"), false)
166191
test(CCT2(3,"a"), CCT2(4,"a"), false)
@@ -170,41 +195,36 @@ object ReusabilityTest extends TestSuite {
170195
()
171196
}
172197
"derivesByRef" - {
173-
class X
174-
implicit val x: Reusability[X] = Reusability.never
175-
val _ = x
176-
case class Y(x: X)
177-
implicit val y: Reusability[Y] = Reusability.derive[Y]
178-
val y1 = Y(new X)
179-
val y2 = Y(new X)
198+
val d = new DerivesByRef
199+
import d._
180200
test(y1, y2, false)
181201
test(y1, y1, true)
182202
}
183203
}
184204

185205
"caseClassExcept" - {
186206
"1/1" - {
187-
implicit val r: Reusability[CC1] = Reusability.caseClassExcept[CC1]("i")
207+
implicit val r: Reusability[CC1] = derive.CC1_i
188208
test(CC1(2), CC1(2), true)
189209
test(CC1(2), CC1(3), true)
190210
}
191211

192212
"1st of 2" - {
193-
implicit val r: Reusability[CC2] = Reusability.caseClassExcept[CC2]("i")
213+
implicit val r: Reusability[CC2] = derive.CC2_i
194214
test(CC2(3,"a"), CC2(3,"a"), true)
195215
test(CC2(3,"a"), CC2(3,"b"), false)
196216
test(CC2(3,"a"), CC2(4,"a"), true)
197217
}
198218

199219
"2nd of 2" - {
200-
implicit val r: Reusability[CC2] = Reusability.caseClassExcept[CC2]("n")
220+
implicit val r: Reusability[CC2] = derive.CC2_n
201221
test(CC2(3,"a"), CC2(3,"a"), true)
202222
test(CC2(3,"a"), CC2(3,"b"), true)
203223
test(CC2(3,"a"), CC2(4,"a"), false)
204224
}
205225

206226
"2/4" - {
207-
implicit val r: Reusability[CC4] = Reusability.caseClassExcept[CC4]("a", "c")
227+
implicit val r: Reusability[CC4] = derive.CC4_a_c
208228
test(CC4(1, 2, 3, 4), CC4(1, 2, 3, 4), true)
209229
test(CC4(1, 2, 3, 4), CC4(0, 2, 3, 4), true)
210230
test(CC4(1, 2, 3, 4), CC4(1, 0, 3, 4), false)

0 commit comments

Comments
 (0)