Skip to content

Publish native runtime, fix JSDOM CI setup... #471

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 5 commits into from
Jun 11, 2022
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
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ jobs:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Install JSDOM
run: npm install

- name: run tests
run: sbt ++${{ matrix.scala.version }} plugin/test

Expand All @@ -51,7 +48,7 @@ jobs:
matrix:
os: [ 'ubuntu-latest', 'windows-latest' ]
java: ['8', '17' ]
module: ['runtime', 'runtimeJS', 'reporter', 'domain', 'serializer']
module: ['runtime', 'runtimeJS', 'runtimeJSDOMTest', 'runtimeNative', 'reporter', 'domain', 'serializer']
steps:
- name: checkout the repo
uses: actions/checkout@v3
Expand All @@ -64,6 +61,10 @@ jobs:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Install JSDOM
run: npm install
if: matrix.module == 'runtimeJSDOMTest'

- name: run tests
run: sbt +${{ matrix.module }}/test

Expand Down
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ lazy val root = Project("scalac-scoverage", file("."))
plugin,
runtime.jvm,
runtime.js,
runtime.native,
runtimeJSDOMTest,
reporter,
domain,
Expand All @@ -109,7 +110,7 @@ lazy val root = Project("scalac-scoverage", file("."))
lazy val runtime = CrossProject(
"runtime",
file("runtime")
)(JVMPlatform, JSPlatform)
)(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Full)
.withoutSuffixFor(JVMPlatform)
.settings(
Expand Down
6 changes: 5 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
Expand Down
31 changes: 31 additions & 0 deletions runtime/native/src/main/scala/scoverage/Platform.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package scoverage

import java.io.{File => SupportFile}
import java.io.{FileFilter => SupportFileFilter}
import java.io.{FileWriter => SupportFileWriter}

import scala.collection.mutable.HashMap
import scala.io.{Source => SupportSource}

object Platform {
type ThreadSafeMap[A, B] = HashMap[A, B]
lazy val ThreadSafeMap = HashMap

type File = SupportFile
type FileWriter = SupportFileWriter
type FileFilter = SupportFileFilter

lazy val Source = SupportSource

def insecureRandomUUID() = {
import scala.util.Random
var msb = Random.nextLong()
var lsb = Random.nextLong()
msb &= 0xffffffffffff0fffL // clear version
msb |= 0x0000000000004000L // set to version 4
lsb &= 0x3fffffffffffffffL // clear variant
lsb |= 0x8000000000000000L // set to IETF variant
new java.util.UUID(msb, lsb)
}

}