Skip to content

Cross compile to scala 3, update dependencies and plugins. #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11, 2.12.18, 2.11.12]
scala: [3.3.5, 2.13.13, 2.12.20, 2.11.12]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -36,7 +36,7 @@ jobs:
java-version: ${{ matrix.java }}

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.sbt
Expand All @@ -45,7 +45,7 @@ jobs:
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
key: ${{ runner.os }}-sbt-cache-v4-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Runs tests
run: sbt ++${{ matrix.scala }} scryptoJVM/test
Expand All @@ -64,19 +64,24 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11]
scala: [3.3.5, 2.13.13]
java: [adopt@1.8]
node-version: [16.x]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup NPM
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 8.15.9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
version: 7.21.0
node-version: ${{ matrix.node-version }}
cache: "pnpm"
cache: 'pnpm'

- run: pnpm install

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

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.sbt
Expand All @@ -94,7 +99,7 @@ jobs:
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
key: ${{ runner.os }}-sbt-cache-v4-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Runs tests
run: sbt ++${{ matrix.scala }} scryptoJS/test
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ jobs:
name: Publish release to Sonatype
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup NPM
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 8.15.9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
version: 7.21.0
node-version: ${{ matrix.node-version }}
cache: "pnpm"
cache: 'pnpm'

- run: pnpm install

- name: Setup Java and Scala
Expand All @@ -28,7 +33,7 @@ jobs:
java-version: adopt@1.8

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.sbt
Expand All @@ -37,7 +42,7 @@ jobs:
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
key: ${{ runner.os }}-sbt-cache-v4-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Import GPG key
run: ci/import_gpg.sh
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ scorex-errors.log

# local-only JS-related files and folders
package-lock.json
node_modules/
node_modules/

# Metals
.metals/
**/metals.sbt

# Bloop
**/.bloop
51 changes: 35 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ name := "scrypto"
description := "Cryptographic primitives for Scala"
organization := "org.scorexfoundation"

lazy val scala213 = "2.13.11"
lazy val scala212 = "2.12.18"
lazy val scala211 = "2.11.12"
lazy val scala212 = "2.12.20"
lazy val scala213 = "2.13.13"
lazy val scala3 = "3.3.5"
lazy val scalatestVersion = "3.2.19"

javacOptions ++=
"-source" :: "1.8" ::
Expand All @@ -32,15 +34,32 @@ lazy val commonSettings = Seq(
"scm:git@github.com:input-output-hk/scrypto.git"
)
),
libraryDependencies ++= Seq(
"org.rudogma" %%% "supertagged" % "2.0-RC2",
"org.scorexfoundation" %%% "scorex-util" % "0.2.1",
"org.scalatest" %%% "scalatest" % "3.3.0-SNAP3" % Test,
"org.scalatest" %%% "scalatest-propspec" % "3.3.0-SNAP3" % Test,
"org.scalatest" %%% "scalatest-shouldmatchers" % "3.3.0-SNAP3" % Test,
"org.scalatestplus" %%% "scalacheck-1-15" % "3.3.0.0-SNAP3" % Test,
"org.scalacheck" %%% "scalacheck" % "1.15.2" % Test
),
libraryDependencies ++= {
val base = Seq(
("org.scorexfoundation" %%% "scorex-util" % "0.2.1").cross(CrossVersion.for3Use2_13),
"org.scalatest" %%% "scalatest" % scalatestVersion % Test,
"org.scalatest" %%% "scalatest-propspec" % scalatestVersion % Test,
"org.scalatest" %%% "scalatest-shouldmatchers" % scalatestVersion % Test,
)
val supertagged = Seq("org.rudogma" %%% "supertagged" % "2.0-RC2")
val scalacheck211 = Seq(
"org.scalatestplus" %%% "scalacheck-1-15" % "3.2.4.0-M1" % Test,
"org.scalacheck" %%% "scalacheck" % "1.15.2" % Test
)
val scalacheckLatest = Seq(
"org.scalatestplus" %%% "scalacheck-1-18" % "3.2.19.0" % Test,
"org.scalacheck" %%% "scalacheck" % "1.18.1" % Test
)

if (scalaVersion.value == scala211)
base ++ supertagged ++ scalacheck211
else if (scalaVersion.value == scala212 | scalaVersion.value == scala213)
base ++ supertagged ++ scalacheckLatest
else if (scalaVersion.value == scala3)
base ++ scalacheckLatest
else
Seq()
},
javacOptions ++= javacReleaseOption,
publishMavenStyle := true,
publishTo := sonatypePublishToBundle.value
Expand All @@ -63,20 +82,20 @@ lazy val scrypto = crossProject(JVMPlatform, JSPlatform)
.settings(commonSettings)
.jvmSettings(
libraryDependencies ++= Seq(
"org.bouncycastle" % "bcprov-jdk15to18" % "1.66"
"org.bouncycastle" % "bcprov-jdk15to18" % "1.80"
),
scalaVersion := scala213,
crossScalaVersions := Seq(scala211, scala212, scala213)
crossScalaVersions := Seq(scala211, scala212, scala213, scala3)
)

lazy val scryptoJS = scrypto.js
.enablePlugins(ScalaJSBundlerPlugin)
.enablePlugins(ScalablyTypedConverterGenSourcePlugin)
.settings(
scalaVersion := scala213,
crossScalaVersions := Seq(scala213),
crossScalaVersions := Seq(scala213, scala3),
libraryDependencies ++= Seq(
"org.scala-js" %%% "scala-js-macrotask-executor" % "1.0.0",
"org.scala-js" %%% "scala-js-macrotask-executor" % "1.1.1",
("org.scala-js" %%% "scalajs-java-securerandom" % "1.0.0").cross(CrossVersion.for3Use2_13)
),
Test / parallelExecution := false,
Expand All @@ -93,7 +112,7 @@ lazy val benchmarks = project
.dependsOn(scrypto.jvm)
.settings(
moduleName := "scrypto-benchmarks",
crossScalaVersions := Seq(scala211, scala212, scala213),
crossScalaVersions := Seq(scala211, scala212, scala213, scala3),
scalaVersion := scala213,
)
.enablePlugins(JmhPlugin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.util.{Random, Try, Success, Failure}
class AVLBatchStatefulSpecification extends AnyPropSpec {

property("BatchAVLProver: prove and verify") {
AVLCommands.property().check
AVLCommands.property().check()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ with Matchers {
val unsafeHash = new Blake2b256Unsafe

property("Unsafe should produce the same result") {
forAll { message: Array[Byte] =>
forAll { (message: Array[Byte]) =>
unsafeHash.hash(message) shouldEqual Blake2b256(message)
}
}
Expand Down
Loading
Loading