diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49c11eeca..f952d15c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: os: [ubuntu-latest] scala: [2.13.8, 3.1.2] java: [temurin@8, temurin@11, temurin@17] - project: [rootJS, rootJVM] + project: [rootJS, rootJVM, rootNative] exclude: - scala: 2.13.8 java: temurin@11 @@ -40,6 +40,10 @@ jobs: java: temurin@11 - project: rootJS java: temurin@17 + - project: rootNative + java: temurin@11 + - project: rootNative + java: temurin@17 runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -118,6 +122,10 @@ jobs: if: matrix.project == 'rootJS' run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult + - name: nativeLink + if: matrix.project == 'rootNative' + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/nativeLink + - name: Test run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test @@ -131,11 +139,11 @@ jobs: - name: Make target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: mkdir -p data/.jvm/target legacy/.jvm/target extras/.js/target examples/target target platform/js/target macros/.jvm/target .js/target site/target core/.js/target macros/.js/target laws/.js/target legacy/.js/target core/.jvm/target tests/js/target .jvm/target .native/target platform/jvm/target util/.js/target data/.js/target util/.jvm/target laws/.jvm/target tests/jvm/target extras/.jvm/target benchmark/target project/target + run: mkdir -p data/.jvm/target legacy/.jvm/target extras/.js/target examples/target util/.native/target extras/.native/target target platform/js/target macros/.jvm/target legacy/.native/target .js/target core/.native/target site/target macros/.native/target laws/.native/target core/.js/target macros/.js/target laws/.js/target legacy/.js/target core/.jvm/target tests/js/target .jvm/target .native/target platform/jvm/target util/.js/target platform/native/target data/.js/target util/.jvm/target laws/.jvm/target tests/jvm/target extras/.jvm/target data/.native/target benchmark/target tests/native/target project/target - name: Compress target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: tar cf targets.tar data/.jvm/target legacy/.jvm/target extras/.js/target examples/target target platform/js/target macros/.jvm/target .js/target site/target core/.js/target macros/.js/target laws/.js/target legacy/.js/target core/.jvm/target tests/js/target .jvm/target .native/target platform/jvm/target util/.js/target data/.js/target util/.jvm/target laws/.jvm/target tests/jvm/target extras/.jvm/target benchmark/target project/target + run: tar cf targets.tar data/.jvm/target legacy/.jvm/target extras/.js/target examples/target util/.native/target extras/.native/target target platform/js/target macros/.jvm/target legacy/.native/target .js/target core/.native/target site/target macros/.native/target laws/.native/target core/.js/target macros/.js/target laws/.js/target legacy/.js/target core/.jvm/target tests/js/target .jvm/target .native/target platform/jvm/target util/.js/target platform/native/target data/.js/target util/.jvm/target laws/.jvm/target tests/jvm/target extras/.jvm/target data/.native/target benchmark/target tests/native/target project/target - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') @@ -240,6 +248,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (2.13.8, rootNative) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootNative + + - name: Inflate target directories (2.13.8, rootNative) + run: | + tar xf targets.tar + rm targets.tar + - name: Download target directories (3.1.2, rootJS) uses: actions/download-artifact@v2 with: @@ -260,6 +278,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (3.1.2, rootNative) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootNative + + - name: Inflate target directories (3.1.2, rootNative) + run: | + tar xf targets.tar + rm targets.tar + - name: Download target directories (3.1.2, rootJVM) uses: actions/download-artifact@v2 with: diff --git a/build.sbt b/build.sbt index ec53efe62..efa43ce9e 100644 --- a/build.sbt +++ b/build.sbt @@ -16,10 +16,10 @@ import scala.language.existentials lazy val scalaCheckVersion = "1.16.0" -lazy val munit = "0.7.29" -lazy val munitDiscipline = "1.0.9" +lazy val munit = "1.0.0-M5" +lazy val munitDiscipline = "2.0.0-M2" -lazy val algebraVersion = "2.7.0" +lazy val algebraVersion = "2.8.0" lazy val apfloatVersion = "1.10.1" lazy val jscienceVersion = "4.3.1" @@ -62,14 +62,14 @@ lazy val root = tlCrossRootProject .settings(unidocSettings) .enablePlugins(ScalaUnidocPlugin) -lazy val platform = crossProject(JSPlatform, JVMPlatform) +lazy val platform = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings(moduleName := "spire-platform") .settings(spireSettings: _*) .jvmSettings(commonJvmSettings: _*) .jsSettings(commonJsSettings: _*) .dependsOn(macros, util) -lazy val macros = crossProject(JSPlatform, JVMPlatform) +lazy val macros = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Pure) .settings(moduleName := "spire-macros") .settings(spireSettings: _*) @@ -78,21 +78,21 @@ lazy val macros = crossProject(JSPlatform, JVMPlatform) .jvmSettings(commonJvmSettings: _*) .jsSettings(commonJsSettings: _*) -lazy val data = crossProject(JSPlatform, JVMPlatform) +lazy val data = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Pure) .settings(moduleName := "spire-data") .settings(spireSettings: _*) .jvmSettings(commonJvmSettings: _*) .jsSettings(commonJsSettings: _*) -lazy val legacy = crossProject(JSPlatform, JVMPlatform) +lazy val legacy = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Pure) .settings(moduleName := "spire-legacy") .settings(spireSettings: _*) .jvmSettings(commonJvmSettings: _*) .jsSettings(commonJsSettings: _*) -lazy val util = crossProject(JSPlatform, JVMPlatform) +lazy val util = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Pure) .settings(moduleName := "spire-util") .settings(spireSettings: _*) @@ -100,7 +100,7 @@ lazy val util = crossProject(JSPlatform, JVMPlatform) .jsSettings(commonJsSettings: _*) .dependsOn(macros) -lazy val core = crossProject(JSPlatform, JVMPlatform) +lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Pure) .settings(moduleName := "spire") .settings(spireSettings: _*) @@ -109,7 +109,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) .jsSettings(commonJsSettings: _*) .dependsOn(macros, platform, util) -lazy val extras = crossProject(JSPlatform, JVMPlatform) +lazy val extras = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Pure) .settings(moduleName := "spire-extras") .settings(spireSettings: _*) @@ -140,7 +140,7 @@ lazy val examples = project .settings(commonJvmSettings) .dependsOn(core.jvm, extras.jvm) -lazy val laws = crossProject(JSPlatform, JVMPlatform) +lazy val laws = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Pure) .settings(moduleName := "spire-laws") .settings(spireSettings: _*) @@ -154,7 +154,7 @@ lazy val laws = crossProject(JSPlatform, JVMPlatform) .jsSettings(commonJsSettings: _*) .dependsOn(core, extras) -lazy val tests = crossProject(JSPlatform, JVMPlatform) +lazy val tests = crossProject(JSPlatform, JVMPlatform, NativePlatform) .crossType(CrossType.Full) .settings(moduleName := "spire-tests") .settings(spireSettings: _*) @@ -196,7 +196,6 @@ lazy val commonDeps = Seq( ) lazy val commonSettings = Seq( - resolvers += Resolver.sonatypeRepo("snapshots"), headerLicense := Some(HeaderLicense.Custom(header)) ) ++ scalaMacroDependencies diff --git a/core/src/main/scala/spire/math/poly/Term.scala b/core/src/main/scala/spire/math/poly/Term.scala index 35926fa4a..476045cc8 100644 --- a/core/src/main/scala/spire/math/poly/Term.scala +++ b/core/src/main/scala/spire/math/poly/Term.scala @@ -117,10 +117,7 @@ object Term { // call Regex constructor directly to get rid of compiler warning // replace with "".r once SI-6723 is fixed - private val superscriptRegex = - new scala.util.matching.Regex( - "[\\u2070\\u2071\\u2072\\u2073\\u2074\\u2075\\u2076\\u2077\\u2078\\u2079\\u207B\\u00B9\\u00B2\\u00B3]+" - ) + private val superscriptRegex = "[⁰¹²³⁴⁵⁶⁷⁸⁹⁻ⁱ]+".r private[spire] def removeSuperscript(text: String): String = superscriptRegex.replaceAllIn(text, "^" + _.group(0).map(removeSuperscript)) diff --git a/platform/js/src/main/scala/spire/Platform.scala b/platform/js-native/src/main/scala/spire/Platform.scala similarity index 100% rename from platform/js/src/main/scala/spire/Platform.scala rename to platform/js-native/src/main/scala/spire/Platform.scala diff --git a/project/plugins.sbt b/project/plugins.sbt index fe5134aba..ff957c1ec 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,6 +4,9 @@ val sbtTypelevelVersion = "0.4.12" addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion) addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion) +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4") + addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") diff --git a/tests/shared/src/test/scala/spire/math/SafeLongScalaCheckSuite.scala b/tests/shared/src/test/scala/spire/math/SafeLongScalaCheckSuite.scala index 89eca5970..fd5b9060a 100644 --- a/tests/shared/src/test/scala/spire/math/SafeLongScalaCheckSuite.scala +++ b/tests/shared/src/test/scala/spire/math/SafeLongScalaCheckSuite.scala @@ -155,12 +155,13 @@ class SafeLongScalaCheckSuite extends munit.ScalaCheckSuite { } } - property("x >> k") { - forAll { (x: BigInt, k: Byte) => - intercept[RuntimeException] { SafeLong(x) >> Int.MinValue } - invariant(SafeLong(x) >> k) == SafeLong(x >> k) + if (!sys.props.get("java.vm.name").contains("Scala Native")) + property("x >> k") { + forAll { (x: BigInt, k: Byte) => + intercept[RuntimeException] { SafeLong(x) >> Int.MinValue } + invariant(SafeLong(x) >> k) == SafeLong(x >> k) + } } - } property("long safelongs") { forAll { (x: Long) =>