From 83fd34ea4d0566535c80671dbdc5301fbc90a1ac Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Tue, 24 Sep 2024 13:55:19 +0200 Subject: [PATCH] Add build for scala-native 0.5 --- .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++++--- build.sbt | 2 +- project/plugins.sbt | 1 + 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9d0b928..4326ed20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,12 +30,14 @@ jobs: os: [ubuntu-latest] scala: [2.13, 3] java: [temurin@11, temurin@17] - project: [rootJS, rootJVM] + project: [rootJS, rootJVM, rootNative] exclude: - scala: 3 java: temurin@17 - project: rootJS java: temurin@17 + - project: rootNative + java: temurin@17 runs-on: ${{ matrix.os }} timeout-minutes: 60 steps: @@ -89,6 +91,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 @@ -102,11 +108,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 optics/.jvm/target optics/.js/target project/target + run: mkdir -p optics/.native/target optics/.jvm/target optics/.js/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 optics/.jvm/target optics/.js/target project/target + run: tar cf targets.tar optics/.native/target optics/.jvm/target optics/.js/target project/target - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') @@ -180,6 +186,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (2.13, rootNative) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootNative + + - name: Inflate target directories (2.13, rootNative) + run: | + tar xf targets.tar + rm targets.tar + - name: Download target directories (3, rootJS) uses: actions/download-artifact@v4 with: @@ -200,6 +216,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (3, rootNative) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootNative + + - name: Inflate target directories (3, rootNative) + run: | + tar xf targets.tar + rm targets.tar + - name: Import signing key if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' env: diff --git a/build.sbt b/build.sbt index f133172d..f1b140ab 100644 --- a/build.sbt +++ b/build.sbt @@ -21,7 +21,7 @@ val semVerRegex = """(\d+\.\d+\.)(\d+)(?:-SNAPSHOT)?""".r lazy val root = tlCrossRootProject.aggregate(optics) -lazy val optics = crossProject(JVMPlatform, JSPlatform) +lazy val optics = crossProject(JVMPlatform, JSPlatform, NativePlatform) .withoutSuffixFor(JVMPlatform) .crossType(CrossType.Pure) .in(file("optics")) diff --git a/project/plugins.sbt b/project/plugins.sbt index 5e48a521..d33fa6b3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,3 @@ addSbtPlugin("io.circe" % "sbt-circe-org" % "0.4.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.5")