From 8d2af2b998b02f217205bcfec7eb43ff630f735f Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 11 Nov 2022 05:55:41 +0000 Subject: [PATCH] Scala Native --- .github/workflows/ci.yml | 42 +++++++++++++++++++++++++++++++++++++--- build.sbt | 8 +++++--- project/plugins.sbt | 2 ++ 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 592f8b1..6521d90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: os: [ubuntu-latest] scala: [2.12.17, 2.13.10, 3.2.1] java: [temurin@11, temurin@17] - project: [rootJS, rootJVM] + project: [rootJS, rootJVM, rootNative] exclude: - scala: 2.12.17 java: temurin@17 @@ -38,6 +38,8 @@ jobs: java: temurin@17 - project: rootJS java: temurin@17 + - project: rootNative + java: temurin@17 runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -100,6 +102,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 @@ -117,11 +123,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 target .js/target .jvm/target .native/target fs2/.js/target fs2/.jvm/target project/target + run: mkdir -p fs2/.native/target target .js/target .jvm/target .native/target fs2/.js/target fs2/.jvm/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 target .js/target .jvm/target .native/target fs2/.js/target fs2/.jvm/target project/target + run: tar cf targets.tar fs2/.native/target target .js/target .jvm/target .native/target fs2/.js/target fs2/.jvm/target project/target - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') @@ -210,6 +216,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (2.12.17, rootNative) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootNative + + - name: Inflate target directories (2.12.17, rootNative) + run: | + tar xf targets.tar + rm targets.tar + - name: Download target directories (2.13.10, rootJS) uses: actions/download-artifact@v2 with: @@ -230,6 +246,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (2.13.10, rootNative) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootNative + + - name: Inflate target directories (2.13.10, rootNative) + run: | + tar xf targets.tar + rm targets.tar + - name: Download target directories (3.2.1, rootJS) uses: actions/download-artifact@v2 with: @@ -250,6 +276,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (3.2.1, rootNative) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootNative + + - name: Inflate target directories (3.2.1, rootNative) + run: | + tar xf targets.tar + rm targets.tar + - name: Import signing key if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' run: echo $PGP_SECRET | base64 -di | gpg --import diff --git a/build.sbt b/build.sbt index c49d0a7..b75e7f7 100644 --- a/build.sbt +++ b/build.sbt @@ -3,6 +3,8 @@ ThisBuild / circeRootOfCodeCoverage := None ThisBuild / startYear := Some(2017) ThisBuild / scalafixScalaBinaryVersion := "2.12" +ThisBuild / resolvers ++= Resolver.sonatypeOssRepos("snapshots") + val circeVersion = "0.14.3" val fs2Version = "3.3.0" val jawnVersion = "1.4.0" @@ -10,7 +12,7 @@ val previousCirceFs2Version = "0.13.0" val scalaTestVersion = "3.2.14" val scalaTestPlusVersion = "3.2.14.0" -val catsEffectTestingVersion = "1.4.0" +val catsEffectTestingVersion = "1.5-852166f-SNAPSHOT" val scalacheckEffectVersion = "2.0.0-M2" val scala212 = "2.12.17" @@ -21,7 +23,7 @@ ThisBuild / crossScalaVersions := Seq(scala212, scala213, "3.2.1") lazy val root = tlCrossRootProject.aggregate(fs2) -lazy val fs2 = crossProject(JVMPlatform, JSPlatform) +lazy val fs2 = crossProject(JVMPlatform, JSPlatform, NativePlatform) .crossType(CrossType.Pure) .in(file("fs2")) .settings( @@ -38,6 +40,6 @@ lazy val fs2 = crossProject(JVMPlatform, JSPlatform) "org.typelevel" %%% "jawn-parser" % jawnVersion ) ) - .jsSettings( + .platformsSettings(JSPlatform, NativePlatform)( tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "0.14.1").toMap ) diff --git a/project/plugins.sbt b/project/plugins.sbt index a6977ee..06d9987 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,4 @@ addSbtPlugin("io.circe" % "sbt-circe-org" % "0.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")