From 72a841a66d58dc7782ebdb9b82bfb7b71753e1f7 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 23 Jun 2023 21:58:42 +0200 Subject: [PATCH 1/4] update plugins, sbt, scalablytyped version and then use ScalablyTypedConverterGenSourcePlugin --- build.sbt | 8 ++++---- js/src/main/scala/scorex/crypto/hash/Platform.scala | 8 ++++---- project/build.properties | 2 +- project/plugins.sbt | 8 +++++--- shared/src/test/scala/scorex/ScalaJsSpec.scala | 10 ++++++++++ 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/build.sbt b/build.sbt index ed459f68..6055262a 100644 --- a/build.sbt +++ b/build.sbt @@ -15,7 +15,7 @@ javacOptions ++= lazy val commonSettings = Seq( organization := "org.scorexfoundation", - resolvers += Resolver.sonatypeRepo("public"), + resolvers ++= Resolver.sonatypeOssRepos("public"), licenses := Seq("CC0" -> url("https://creativecommons.org/publicdomain/zero/1.0/legalcode")), homepage := Some(url("https://github.com/input-output-hk/scrypto")), pomExtra := @@ -71,7 +71,7 @@ lazy val scrypto = crossProject(JVMPlatform, JSPlatform) lazy val scryptoJS = scrypto.js .enablePlugins(ScalaJSBundlerPlugin) - .enablePlugins(ScalablyTypedConverterExternalNpmPlugin) + .enablePlugins(ScalablyTypedConverterGenSourcePlugin) .settings( scalaVersion := scala213, crossScalaVersions := Seq(scala212, scala213), @@ -80,8 +80,8 @@ lazy val scryptoJS = scrypto.js ("org.scala-js" %%% "scalajs-java-securerandom" % "1.0.0").cross(CrossVersion.for3Use2_13) ), Test / parallelExecution := false, - // how to setup ScalablyTyped https://youtu.be/hWUAVrNj65c?t=1341 - externalNpm := { file(s"${baseDirectory.value}/..") }, + // how to setup ScalablyTyped https://scalablytyped.org/docs/library-developer + stOutputPackage := "scorex", Compile / npmDependencies ++= Seq( "@noble/hashes" -> "1.1.4" ), diff --git a/js/src/main/scala/scorex/crypto/hash/Platform.scala b/js/src/main/scala/scorex/crypto/hash/Platform.scala index fb22184d..02f71f45 100644 --- a/js/src/main/scala/scorex/crypto/hash/Platform.scala +++ b/js/src/main/scala/scorex/crypto/hash/Platform.scala @@ -1,9 +1,9 @@ package scorex.crypto.hash -import typings.nobleHashes.blake2Mod.BlakeOpts -import typings.nobleHashes.mod.blake2b -import typings.nobleHashes.sha256Mod.sha256 -import typings.nobleHashes.utilsMod +import scorex.nobleHashes.blake2Mod.BlakeOpts +import scorex.nobleHashes.blake2bMod.blake2b +import scorex.nobleHashes.sha256Mod.sha256 +import scorex.nobleHashes.utilsMod import scala.scalajs.js.typedarray.Uint8Array diff --git a/project/build.properties b/project/build.properties index 14095e16..5041518d 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ -sbt.version=1.5.4 +sbt.version=1.8.3 diff --git a/project/plugins.sbt b/project/plugins.sbt index c514d551..b017221c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,9 +3,11 @@ logLevel := Level.Warn addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0") -addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") +// Development of this plugin has been discontinued (use scalafix instead). +// the plugin has old conflicting dependencies with scalablytyped +//addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") -//addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.8") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.3") @@ -18,4 +20,4 @@ addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") -addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta37") \ No newline at end of file +addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta42") \ No newline at end of file diff --git a/shared/src/test/scala/scorex/ScalaJsSpec.scala b/shared/src/test/scala/scorex/ScalaJsSpec.scala index 5d5122ba..88c8b6b2 100644 --- a/shared/src/test/scala/scorex/ScalaJsSpec.scala +++ b/shared/src/test/scala/scorex/ScalaJsSpec.scala @@ -151,4 +151,14 @@ class ScalaJsSpec extends AnyPropSpec with Matchers { val lines = Source.fromString("abc").getLines.toSeq lines.length shouldBe 1 } + + property("System.currentTimeMillis") { + val start = System.currentTimeMillis() + println(s"time: $start ms") + } + + property("System.nanoTime") { + val start = System.nanoTime() + println(s"time: $start ns") + } } From fffbde1cc38f30df5f3fcaa5e6d43097ea2c61a1 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Thu, 29 Jun 2023 14:35:18 +0200 Subject: [PATCH 2/4] removed scala-style sbt plugin --- project/plugins.sbt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index b017221c..1d565a52 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,10 +3,6 @@ logLevel := Level.Warn addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0") -// Development of this plugin has been discontinued (use scalafix instead). -// the plugin has old conflicting dependencies with scalablytyped -//addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") - addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.8") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.3") From 6c1cc2fe46c2fa0d8bf9227e7e1ce9db18f2a273 Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Fri, 30 Jun 2023 17:59:36 +0200 Subject: [PATCH 3/4] scalably-typed: update deps sbt 1.8.3 -> 1.9.1, scala 2.12.15 -> 2.12.18 scala 2.13.8 -> 2.13.11 crossScalaVersions Seq(scala212, scala213) -> Seq(scala213) sbt-scalajs-crossproject 1.2.0 -> 1.3.1, sbt-scalajs 1.10.1 -> 1.13.2 --- .github/workflows/ci.yml | 4 ++-- build.sbt | 8 ++++---- project/build.properties | 2 +- project/plugins.sbt | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf8d0b3b..abe07d57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.8, 2.12.15, 2.11.12] + scala: [2.13.11, 2.12.18, 2.11.12] java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: @@ -64,7 +64,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.8, 2.12.15] + scala: [2.13.11] java: [adopt@1.8] node-version: [16.x] runs-on: ${{ matrix.os }} diff --git a/build.sbt b/build.sbt index 6055262a..f42acd61 100644 --- a/build.sbt +++ b/build.sbt @@ -4,8 +4,8 @@ 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.11" +lazy val scala212 = "2.12.18" lazy val scala211 = "2.11.12" javacOptions ++= @@ -34,7 +34,7 @@ lazy val commonSettings = Seq( ), libraryDependencies ++= Seq( "org.rudogma" %%% "supertagged" % "2.0-RC2", - "org.scorexfoundation" %%% "scorex-util" % "0.2.0", + "org.scorexfoundation" %%% "scorex-util" % "0.2.0-2-d2b192dc-SNAPSHOT", "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, @@ -74,7 +74,7 @@ lazy val scryptoJS = scrypto.js .enablePlugins(ScalablyTypedConverterGenSourcePlugin) .settings( scalaVersion := scala213, - crossScalaVersions := Seq(scala212, scala213), + crossScalaVersions := Seq(scala213), 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) diff --git a/project/build.properties b/project/build.properties index 5041518d..ffd11bcc 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ -sbt.version=1.8.3 +sbt.version=1.9.1 diff --git a/project/plugins.sbt b/project/plugins.sbt index 1d565a52..2b9376c9 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -13,7 +13,7 @@ addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.0") addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") -addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") +addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.21.1") addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta42") \ No newline at end of file From a0bc617618bd9f24b259ffa747ddec4d1fc2f63a Mon Sep 17 00:00:00 2001 From: Alexander Slesarenko Date: Tue, 4 Jul 2023 17:42:28 +0200 Subject: [PATCH 4/4] scalably-typed: updated scorex-util v0.2.1 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index f42acd61..46a0f529 100644 --- a/build.sbt +++ b/build.sbt @@ -34,7 +34,7 @@ lazy val commonSettings = Seq( ), libraryDependencies ++= Seq( "org.rudogma" %%% "supertagged" % "2.0-RC2", - "org.scorexfoundation" %%% "scorex-util" % "0.2.0-2-d2b192dc-SNAPSHOT", + "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,