-
Notifications
You must be signed in to change notification settings - Fork 48
Scala3 support #108
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
Closed
Closed
Scala3 support #108
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ jobs: | |
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest] | ||
| scala: [2.13.8, 2.12.15, 2.11.12] | ||
| scala: [3.3.1, 2.13.12, 2.12.18, 2.11.12] | ||
| java: [[email protected]] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
|
|
@@ -64,7 +64,7 @@ jobs: | |
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest] | ||
| scala: [2.13.8, 2.12.15] | ||
| scala: [3.3.1, 2.13.12] | ||
| java: [[email protected]] | ||
| node-version: [16.x] | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,3 +13,10 @@ target | |
| # logs | ||
| scorex-errors.log | ||
| *.log | ||
|
|
||
| # js | ||
| node_modules | ||
| .bsp | ||
| .DS_Store | ||
| yarn.lock | ||
| package-lock.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,10 @@ name := "scrypto" | |
| description := "Cryptographic primitives for Scala" | ||
| organization := "org.scorexfoundation" | ||
|
|
||
| lazy val scala213 = "2.13.8" | ||
| lazy val scala212 = "2.12.15" | ||
| lazy val scala213 = "2.13.12" | ||
| lazy val scala212 = "2.12.18" | ||
| lazy val scala211 = "2.11.12" | ||
| lazy val scala3 = "3.3.1" | ||
|
|
||
| javacOptions ++= | ||
| "-source" :: "1.8" :: | ||
|
|
@@ -15,32 +16,44 @@ javacOptions ++= | |
|
|
||
| lazy val commonSettings = Seq( | ||
| organization := "org.scorexfoundation", | ||
| resolvers += Resolver.sonatypeRepo("public"), | ||
| resolvers ++= Resolver.sonatypeOssRepos("snapshots"), | ||
| licenses := Seq("CC0" -> url("https://creativecommons.org/publicdomain/zero/1.0/legalcode")), | ||
| homepage := Some(url("https://github.com/input-output-hk/scrypto")), | ||
| pomExtra := | ||
| <developers> | ||
| <developer> | ||
| <id>kushti</id> | ||
| <name>Alexander Chepurnoy</name> | ||
| <url>http://chepurnoy.org/</url> | ||
| </developer> | ||
| </developers>, | ||
| <developers> | ||
| <developer> | ||
| <id>kushti</id> | ||
| <name>Alexander Chepurnoy</name> | ||
| <url>http://chepurnoy.org/</url> | ||
| </developer> | ||
| </developers>, | ||
| scmInfo := Some( | ||
| ScmInfo( | ||
| url("https://github.com/input-output-hk/scrypto"), | ||
| "scm:[email protected]:input-output-hk/scrypto.git" | ||
| ) | ||
| ), | ||
| libraryDependencies ++= Seq( | ||
| "org.rudogma" %%% "supertagged" % "2.0-RC2", | ||
| "org.scorexfoundation" %%% "scorex-util" % "0.2.0", | ||
| "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 | ||
| ScmInfo( | ||
| url("https://github.com/input-output-hk/scrypto"), | ||
| "scm:[email protected]:input-output-hk/scrypto.git" | ||
| ) | ||
| ), | ||
| libraryDependencies ++= { | ||
| if (scalaVersion.value == scala3) | ||
| Seq( | ||
| ("org.scorexfoundation" %%% "scorex-util" % "0.2.1").cross(CrossVersion.for3Use2_13), | ||
| "org.scalatest" %%% "scalatest" % "3.3.0-alpha.1" % Test, | ||
| "org.scalatest" %%% "scalatest-propspec" % "3.3.0-alpha.1" % Test, | ||
| "org.scalatest" %%% "scalatest-shouldmatchers" % "3.3.0-alpha.1" % Test, | ||
| "org.scalacheck" %%% "scalacheck" % "1.15.3" % Test, | ||
| "org.scalatestplus" %%% "scalacheck-1-17" % "3.3.0.0-alpha.1" % Test | ||
| ) | ||
| else // use last versions with Scala 2.11 support | ||
| 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.scalacheck" %%% "scalacheck" % "1.15.2" % Test, | ||
| "org.scalatestplus" %%% "scalacheck-1-15" % "3.3.0.0-SNAP3" % Test | ||
| ) | ||
| }, | ||
| javacOptions ++= javacReleaseOption, | ||
| publishMavenStyle := true, | ||
| publishTo := sonatypePublishToBundle.value | ||
|
|
@@ -66,15 +79,15 @@ lazy val scrypto = crossProject(JVMPlatform, JSPlatform) | |
| "org.bouncycastle" % "bcprov-jdk15to18" % "1.66" | ||
| ), | ||
| scalaVersion := scala213, | ||
| crossScalaVersions := Seq(scala211, scala212, scala213) | ||
| crossScalaVersions := Seq(scala211, scala212, scala213, scala3) | ||
| ) | ||
|
|
||
| lazy val scryptoJS = scrypto.js | ||
| .enablePlugins(ScalaJSBundlerPlugin) | ||
| .enablePlugins(ScalablyTypedConverterExternalNpmPlugin) | ||
| .settings( | ||
| scalaVersion := scala213, | ||
| crossScalaVersions := Seq(scala212, scala213), | ||
| crossScalaVersions := Seq(scala212, scala213, scala3), | ||
| libraryDependencies ++= Seq( | ||
| "org.scala-js" %%% "scala-js-macrotask-executor" % "1.0.0", | ||
| ("org.scala-js" %%% "scalajs-java-securerandom" % "1.0.0").cross(CrossVersion.for3Use2_13) | ||
|
|
@@ -93,7 +106,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) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| sbt.version=1.5.4 | ||
| sbt.version=1.9.1 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package scorex.crypto | ||
|
|
||
| import scorex.crypto.utils.{NewByte, NewArrayByte} | ||
|
|
||
| package object authds: | ||
| object LeafData extends NewArrayByte | ||
| type LeafData = LeafData.Type | ||
|
|
||
| object Side extends NewByte | ||
| type Side = Side.Type | ||
|
|
||
| object ADKey extends NewArrayByte | ||
| type ADKey = ADKey.Type | ||
|
|
||
| object ADValue extends NewArrayByte | ||
| type ADValue = ADValue.Type | ||
|
|
||
| object ADDigest extends NewArrayByte | ||
| type ADDigest = ADDigest.Type | ||
|
|
||
| object SerializedAdProof extends NewArrayByte | ||
| type SerializedAdProof = SerializedAdProof.Type | ||
|
|
||
| object Balance extends NewByte | ||
| type Balance = Balance.Type | ||
|
|
||
| /** Immutable empty array which can be used in many places to avoid allocations. */ | ||
| val EmptyByteArray = Array.empty[Byte] | ||
| end authds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package scorex.crypto | ||
|
|
||
| import scorex.crypto.utils.NewArrayByte | ||
| import scorex.crypto.utils.NewDigest | ||
|
|
||
| package object hash { | ||
|
|
||
| trait BaseDigest extends NewDigest | ||
| type Digest = BaseDigest#Type | ||
| object Digest32 extends BaseDigest | ||
| object Digest64 extends BaseDigest | ||
|
|
||
| type Digest32 = Digest32.Type | ||
| type Digest64 = Digest64.Type | ||
|
|
||
| object NonStandardDigest extends NewDigest | ||
| type NonStandardDigest = NonStandardDigest.Type | ||
|
|
||
| type ExtendedDigest = Platform.Digest | ||
|
|
||
| def createBlake2bDigest(bitSize: Int): ExtendedDigest = Platform.createBlake2bDigest(bitSize) | ||
|
|
||
| def createSha256Digest(): ExtendedDigest = Platform.createSha256Digest() | ||
|
|
||
| def updateDigest(digest: ExtendedDigest, b: Byte) = Platform.updateDigest(digest, b) | ||
|
|
||
| def updateDigest(digest: ExtendedDigest, in: Array[Byte], inOff: Int, inLen: Int) = Platform.updateDigest(digest, in, inOff, inLen) | ||
|
|
||
| def doFinalDigest(digest: ExtendedDigest): Array[Byte] = Platform.doFinalDigest(digest) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package scorex.crypto | ||
|
|
||
| object utils: | ||
|
|
||
| trait NewDigest: | ||
| opaque type Type <: Array[Byte] = Array[Byte] with this.type | ||
| inline def @@(a: Array[Byte]): this.Type = a.asInstanceOf[this.Type] | ||
| inline def @@@[B <: Array[Byte]](b: B): this.Type = b.asInstanceOf[this.Type] | ||
| end NewDigest | ||
|
|
||
| trait NewArrayByte: | ||
| opaque type Type <: Array[Byte] = Array[Byte] | ||
| inline def @@(a: Array[Byte]): this.Type = a | ||
| inline def @@@[B <: Array[Byte]](b: B): this.Type = b | ||
| end NewArrayByte | ||
|
|
||
| trait NewByte: | ||
| opaque type Type <: Byte = Byte | ||
| inline def @@(a: Byte): this.Type = a | ||
| inline def @@@[B <: Byte](b: B): this.Type = b | ||
| end NewByte |
2 changes: 1 addition & 1 deletion
2
shared/src/main/scala/scorex/crypto/authds/avltree/batch/BatchNode.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.