Skip to content

Commit 92edb6e

Browse files
authored
Merge pull request #112 from jozanek/cross-scala-3
Cross compile to scala 3, update dependencies and plugins.
2 parents 18f48e1 + 8e00e51 commit 92edb6e

File tree

28 files changed

+2455
-95
lines changed

28 files changed

+2455
-95
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
strategy:
2222
matrix:
2323
os: [ubuntu-latest]
24-
scala: [2.13.11, 2.12.18, 2.11.12]
24+
scala: [3.3.5, 2.13.13, 2.12.20, 2.11.12]
2525
2626
runs-on: ${{ matrix.os }}
2727
steps:
2828
- name: Checkout current branch (full)
29-
uses: actions/checkout@v2
29+
uses: actions/checkout@v4
3030
with:
3131
fetch-depth: 0
3232

@@ -36,7 +36,7 @@ jobs:
3636
java-version: ${{ matrix.java }}
3737

3838
- name: Cache sbt
39-
uses: actions/cache@v2
39+
uses: actions/cache@v4
4040
with:
4141
path: |
4242
~/.sbt
@@ -45,7 +45,7 @@ jobs:
4545
~/.cache/coursier/v1
4646
~/AppData/Local/Coursier/Cache/v1
4747
~/Library/Caches/Coursier/v1
48-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
48+
key: ${{ runner.os }}-sbt-cache-v4-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
4949

5050
- name: Runs tests
5151
run: sbt ++${{ matrix.scala }} scryptoJVM/test
@@ -64,19 +64,24 @@ jobs:
6464
strategy:
6565
matrix:
6666
os: [ubuntu-latest]
67-
scala: [2.13.11]
67+
scala: [3.3.5, 2.13.13]
6868
6969
node-version: [16.x]
7070
runs-on: ${{ matrix.os }}
7171
steps:
72-
- uses: actions/checkout@v2
72+
- uses: actions/checkout@v4
7373

7474
- name: Setup NPM
75-
uses: pnpm/action-setup@v2
75+
uses: pnpm/action-setup@v4
76+
with:
77+
version: 8.15.9
78+
79+
- name: Setup Node.js
80+
uses: actions/setup-node@v4
7681
with:
77-
version: 7.21.0
7882
node-version: ${{ matrix.node-version }}
79-
cache: "pnpm"
83+
cache: 'pnpm'
84+
8085
- run: pnpm install
8186

8287
- name: Setup Java and Scala
@@ -85,7 +90,7 @@ jobs:
8590
java-version: ${{ matrix.java }}
8691

8792
- name: Cache sbt
88-
uses: actions/cache@v2
93+
uses: actions/cache@v4
8994
with:
9095
path: |
9196
~/.sbt
@@ -94,7 +99,7 @@ jobs:
9499
~/.cache/coursier/v1
95100
~/AppData/Local/Coursier/Cache/v1
96101
~/Library/Caches/Coursier/v1
97-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
102+
key: ${{ runner.os }}-sbt-cache-v4-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
98103

99104
- name: Runs tests
100105
run: sbt ++${{ matrix.scala }} scryptoJS/test

.github/workflows/release.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ jobs:
1212
name: Publish release to Sonatype
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616

1717
- name: Setup NPM
18-
uses: pnpm/action-setup@v2
18+
uses: pnpm/action-setup@v4
19+
with:
20+
version: 8.15.9
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
1924
with:
20-
version: 7.21.0
2125
node-version: ${{ matrix.node-version }}
22-
cache: "pnpm"
26+
cache: 'pnpm'
27+
2328
- run: pnpm install
2429

2530
- name: Setup Java and Scala
@@ -28,7 +33,7 @@ jobs:
2833
java-version: [email protected]
2934

3035
- name: Cache sbt
31-
uses: actions/cache@v2
36+
uses: actions/cache@v4
3237
with:
3338
path: |
3439
~/.sbt
@@ -37,7 +42,7 @@ jobs:
3742
~/.cache/coursier/v1
3843
~/AppData/Local/Coursier/Cache/v1
3944
~/Library/Caches/Coursier/v1
40-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
45+
key: ${{ runner.os }}-sbt-cache-v4-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
4146

4247
- name: Import GPG key
4348
run: ci/import_gpg.sh

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@ scorex-errors.log
1717

1818
# local-only JS-related files and folders
1919
package-lock.json
20-
node_modules/
20+
node_modules/
21+
22+
# Metals
23+
.metals/
24+
**/metals.sbt
25+
26+
# Bloop
27+
**/.bloop

build.sbt

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ name := "scrypto"
44
description := "Cryptographic primitives for Scala"
55
organization := "org.scorexfoundation"
66

7-
lazy val scala213 = "2.13.11"
8-
lazy val scala212 = "2.12.18"
97
lazy val scala211 = "2.11.12"
8+
lazy val scala212 = "2.12.20"
9+
lazy val scala213 = "2.13.13"
10+
lazy val scala3 = "3.3.5"
11+
lazy val scalatestVersion = "3.2.19"
1012

1113
javacOptions ++=
1214
"-source" :: "1.8" ::
@@ -32,15 +34,32 @@ lazy val commonSettings = Seq(
3234
"scm:[email protected]:input-output-hk/scrypto.git"
3335
)
3436
),
35-
libraryDependencies ++= Seq(
36-
"org.rudogma" %%% "supertagged" % "2.0-RC2",
37-
"org.scorexfoundation" %%% "scorex-util" % "0.2.1",
38-
"org.scalatest" %%% "scalatest" % "3.3.0-SNAP3" % Test,
39-
"org.scalatest" %%% "scalatest-propspec" % "3.3.0-SNAP3" % Test,
40-
"org.scalatest" %%% "scalatest-shouldmatchers" % "3.3.0-SNAP3" % Test,
41-
"org.scalatestplus" %%% "scalacheck-1-15" % "3.3.0.0-SNAP3" % Test,
42-
"org.scalacheck" %%% "scalacheck" % "1.15.2" % Test
43-
),
37+
libraryDependencies ++= {
38+
val base = Seq(
39+
("org.scorexfoundation" %%% "scorex-util" % "0.2.1").cross(CrossVersion.for3Use2_13),
40+
"org.scalatest" %%% "scalatest" % scalatestVersion % Test,
41+
"org.scalatest" %%% "scalatest-propspec" % scalatestVersion % Test,
42+
"org.scalatest" %%% "scalatest-shouldmatchers" % scalatestVersion % Test,
43+
)
44+
val supertagged = Seq("org.rudogma" %%% "supertagged" % "2.0-RC2")
45+
val scalacheck211 = Seq(
46+
"org.scalatestplus" %%% "scalacheck-1-15" % "3.2.4.0-M1" % Test,
47+
"org.scalacheck" %%% "scalacheck" % "1.15.2" % Test
48+
)
49+
val scalacheckLatest = Seq(
50+
"org.scalatestplus" %%% "scalacheck-1-18" % "3.2.19.0" % Test,
51+
"org.scalacheck" %%% "scalacheck" % "1.18.1" % Test
52+
)
53+
54+
if (scalaVersion.value == scala211)
55+
base ++ supertagged ++ scalacheck211
56+
else if (scalaVersion.value == scala212 | scalaVersion.value == scala213)
57+
base ++ supertagged ++ scalacheckLatest
58+
else if (scalaVersion.value == scala3)
59+
base ++ scalacheckLatest
60+
else
61+
Seq()
62+
},
4463
javacOptions ++= javacReleaseOption,
4564
publishMavenStyle := true,
4665
publishTo := sonatypePublishToBundle.value
@@ -63,20 +82,20 @@ lazy val scrypto = crossProject(JVMPlatform, JSPlatform)
6382
.settings(commonSettings)
6483
.jvmSettings(
6584
libraryDependencies ++= Seq(
66-
"org.bouncycastle" % "bcprov-jdk15to18" % "1.66"
85+
"org.bouncycastle" % "bcprov-jdk15to18" % "1.80"
6786
),
6887
scalaVersion := scala213,
69-
crossScalaVersions := Seq(scala211, scala212, scala213)
88+
crossScalaVersions := Seq(scala211, scala212, scala213, scala3)
7089
)
7190

7291
lazy val scryptoJS = scrypto.js
7392
.enablePlugins(ScalaJSBundlerPlugin)
7493
.enablePlugins(ScalablyTypedConverterGenSourcePlugin)
7594
.settings(
7695
scalaVersion := scala213,
77-
crossScalaVersions := Seq(scala213),
96+
crossScalaVersions := Seq(scala213, scala3),
7897
libraryDependencies ++= Seq(
79-
"org.scala-js" %%% "scala-js-macrotask-executor" % "1.0.0",
98+
"org.scala-js" %%% "scala-js-macrotask-executor" % "1.1.1",
8099
("org.scala-js" %%% "scalajs-java-securerandom" % "1.0.0").cross(CrossVersion.for3Use2_13)
81100
),
82101
Test / parallelExecution := false,
@@ -93,7 +112,7 @@ lazy val benchmarks = project
93112
.dependsOn(scrypto.jvm)
94113
.settings(
95114
moduleName := "scrypto-benchmarks",
96-
crossScalaVersions := Seq(scala211, scala212, scala213),
115+
crossScalaVersions := Seq(scala211, scala212, scala213, scala3),
97116
scalaVersion := scala213,
98117
)
99118
.enablePlugins(JmhPlugin)

jvm/src/test/scala/scorex/crypto/authds/avltree/batch/AVLBatchStatefulSpecification.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import scala.util.{Random, Try, Success, Failure}
1212
class AVLBatchStatefulSpecification extends AnyPropSpec {
1313

1414
property("BatchAVLProver: prove and verify") {
15-
AVLCommands.property().check
15+
AVLCommands.property().check()
1616
}
1717
}
1818

jvm/src/test/scala/scorex/crypto/hash/Blake2bUnsafeSpecification.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ with Matchers {
1111
val unsafeHash = new Blake2b256Unsafe
1212

1313
property("Unsafe should produce the same result") {
14-
forAll { message: Array[Byte] =>
14+
forAll { (message: Array[Byte]) =>
1515
unsafeHash.hash(message) shouldEqual Blake2b256(message)
1616
}
1717
}

0 commit comments

Comments
 (0)