Skip to content
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

Setup ScalablyTyped #103

Merged
merged 4 commits into from
Sep 22, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
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: [2.13.11, 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: [2.13.11]
java: [[email protected]]
node-version: [16.x]
runs-on: ${{ matrix.os }}
16 changes: 8 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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 ++=
@@ -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 :=
@@ -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.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,
@@ -71,17 +71,17 @@ lazy val scrypto = crossProject(JVMPlatform, JSPlatform)

lazy val scryptoJS = scrypto.js
.enablePlugins(ScalaJSBundlerPlugin)
.enablePlugins(ScalablyTypedConverterExternalNpmPlugin)
.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)
),
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"
),
8 changes: 4 additions & 4 deletions js/src/main/scala/scorex/crypto/hash/Platform.scala
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sbt.version=1.5.4
sbt.version=1.9.1

12 changes: 5 additions & 7 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -3,9 +3,7 @@ logLevel := Level.Warn

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Development of this plugin has been discontinued.
The plugin has old conflicting dependencies with scalablytyped.


//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")

@@ -15,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.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta37")
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")
10 changes: 10 additions & 0 deletions shared/src/test/scala/scorex/ScalaJsSpec.scala
Original file line number Diff line number Diff line change
@@ -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")
}
}