Skip to content
Closed
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
16 changes: 8 additions & 8 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: [3.3.1, 2.13.12, 2.12.18, 2.11.12]
scala: [3.3.5, 2.13.16, 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 }} coreJVM/test
Expand All @@ -64,12 +64,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.3.1, 2.13.12]
scala: [3.3.5, 2.13.16]
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 @@ -79,7 +79,7 @@ jobs:
java-version: ${{ matrix.java }}

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.sbt
Expand All @@ -88,7 +88,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 }} coreJS/test
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
name: Publish release to Sonatype
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.8

- name: Cache sbt
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.sbt
Expand All @@ -29,7 +29,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
26 changes: 12 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ lazy val scalac3: Seq[String] = Seq(
"-source:3.0-migration" // makes the compiler forgiving on most of the dropped features, printing warnings in place of errors
)

lazy val scala213 = "2.13.12"
lazy val scala212 = "2.12.18"
lazy val scala213 = "2.13.16"
lazy val scala212 = "2.12.20"
lazy val scala211 = "2.11.12"
lazy val scala3 = "3.3.1"
lazy val scala3 = "3.3.5"
lazy val scalatestVersion = "3.2.19"

crossScalaVersions := Seq(scala211, scala212, scala213, scala3)
scalaVersion := scala213
Expand All @@ -125,30 +126,27 @@ lazy val utilSettings = Seq(

resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
libraryDependencies ++= Seq(
("org.rudogma" %%% "supertagged" % "2.0-RC2").cross(CrossVersion.for3Use2_13),
"org.scalatest" %%% "scalatest" % scalatestVersion % Test,
"org.scalatest" %%% "scalatest-propspec" % scalatestVersion % Test,
"org.scalatest" %%% "scalatest-shouldmatchers" % scalatestVersion % Test
) ++ {
if (scalaVersion.value == scala3)
Seq(
"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
"org.scalacheck" %%% "scalacheck" % "1.18.1" % Test,
"org.scalatestplus" %%% "scalacheck-1-18" % "3.2.19.0" % Test
)
else // use last versions with Scala 2.11 support
Seq(
"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.rudogma" %%% "supertagged" % "2.0-RC2",
"org.scalacheck" %%% "scalacheck" % "1.15.2" % Test,
"org.scalatestplus" %%% "scalacheck-1-15" % "3.3.0.0-SNAP3" % Test
)
},
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n == 13 =>
case Some((2, 13)) =>
scalac ++ scalac213
case Some((2, n)) if n == 12 =>
case Some((2, 12)) =>
scalac ++ scalac212
case Some((2, 11)) =>
scalac ++ scalac211
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.1
sbt.version=1.10.7
16 changes: 8 additions & 8 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2")
addDependencyTreePlugin
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.0")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.15")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.2")
21 changes: 21 additions & 0 deletions shared/src/main/scala-3/scorex/util/Utils.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package scorex.util

import scorex.util.encode.Base16

opaque type ModifierId <: String = String

object ModifierId {
def apply(s: String): ModifierId = s
}

def bytesToId(bytes: Array[Byte]): ModifierId = ModifierId(Base16.encode(bytes))

def idToBytes(id: ModifierId): Array[Byte] = Base16.decode(id).get

extension (m: ModifierId) {
@inline def toBytes: Array[Byte] = idToBytes(m)
}

extension (bytes: Array[Byte]) {
@inline def toModifierId: ModifierId = bytesToId(bytes)
}