Skip to content

Commit a595fcf

Browse files
committed
Cross-build for Native
1 parent eb768c0 commit a595fcf

File tree

3 files changed

+56
-11
lines changed

3 files changed

+56
-11
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ jobs:
3030
os: [ubuntu-latest]
3131
scala: [2.13.8, 2.12.16, 3.1.3]
3232
java: [temurin@8, temurin@11]
33-
project: [rootJS, rootJVM]
33+
project: [rootJS, rootJVM, rootNative]
3434
exclude:
3535
- scala: 2.12.16
3636
java: temurin@11
3737
- scala: 3.1.3
3838
java: temurin@11
3939
- project: rootJS
4040
java: temurin@11
41+
- project: rootNative
42+
java: temurin@11
4143
runs-on: ${{ matrix.os }}
4244
steps:
4345
- name: Checkout current branch (full)
@@ -100,6 +102,10 @@ jobs:
100102
if: matrix.project == 'rootJS'
101103
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult
102104

105+
- name: nativeLink
106+
if: matrix.project == 'rootNative'
107+
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/nativeLink
108+
103109
- name: Test
104110
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test
105111

@@ -113,11 +119,11 @@ jobs:
113119

114120
- name: Make target directories
115121
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
116-
run: mkdir -p testing/jvm/target noop/jvm/target target .js/target site/target core/js/target testing/js/target noop/js/target core/jvm/target .jvm/target .native/target slf4j/target project/target
122+
run: mkdir -p testing/jvm/target noop/jvm/target target .js/target core/native/target site/target testing/native/target noop/native/target core/js/target testing/js/target noop/js/target core/jvm/target .jvm/target .native/target slf4j/target project/target
117123

118124
- name: Compress target directories
119125
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
120-
run: tar cf targets.tar testing/jvm/target noop/jvm/target target .js/target site/target core/js/target testing/js/target noop/js/target core/jvm/target .jvm/target .native/target slf4j/target project/target
126+
run: tar cf targets.tar testing/jvm/target noop/jvm/target target .js/target core/native/target site/target testing/native/target noop/native/target core/js/target testing/js/target noop/js/target core/jvm/target .jvm/target .native/target slf4j/target project/target
121127

122128
- name: Upload target directories
123129
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
@@ -206,6 +212,16 @@ jobs:
206212
tar xf targets.tar
207213
rm targets.tar
208214
215+
- name: Download target directories (2.13.8, rootNative)
216+
uses: actions/download-artifact@v2
217+
with:
218+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootNative
219+
220+
- name: Inflate target directories (2.13.8, rootNative)
221+
run: |
222+
tar xf targets.tar
223+
rm targets.tar
224+
209225
- name: Download target directories (2.12.16, rootJS)
210226
uses: actions/download-artifact@v2
211227
with:
@@ -226,6 +242,16 @@ jobs:
226242
tar xf targets.tar
227243
rm targets.tar
228244
245+
- name: Download target directories (2.12.16, rootNative)
246+
uses: actions/download-artifact@v2
247+
with:
248+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootNative
249+
250+
- name: Inflate target directories (2.12.16, rootNative)
251+
run: |
252+
tar xf targets.tar
253+
rm targets.tar
254+
229255
- name: Download target directories (3.1.3, rootJS)
230256
uses: actions/download-artifact@v2
231257
with:
@@ -246,6 +272,16 @@ jobs:
246272
tar xf targets.tar
247273
rm targets.tar
248274
275+
- name: Download target directories (3.1.3, rootNative)
276+
uses: actions/download-artifact@v2
277+
with:
278+
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootNative
279+
280+
- name: Inflate target directories (3.1.3, rootNative)
281+
run: |
282+
tar xf targets.tar
283+
rm targets.tar
284+
249285
- name: Import signing key
250286
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
251287
run: echo $PGP_SECRET | base64 -di | gpg --import

build.sbt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8"), JavaSpec.te
2727
ThisBuild / tlVersionIntroduced := Map("3" -> "2.1.1")
2828

2929
val catsV = "2.8.0"
30-
val catsEffectV = "3.3.14"
30+
val catsEffectV = "3.3.14-1-5d11fe9"
3131
val slf4jV = "1.7.36"
32-
val munitCatsEffectV = "1.0.7"
32+
val munitCatsEffectV = "2.0-5e03bfc"
3333
val logbackClassicV = "1.2.11"
3434

3535
Global / onChangedBuildSource := ReloadOnSourceChanges
@@ -41,7 +41,7 @@ lazy val docs = project
4141
.enablePlugins(TypelevelSitePlugin)
4242
.dependsOn(slf4j)
4343

44-
lazy val core = crossProject(JSPlatform, JVMPlatform)
44+
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
4545
.settings(commonSettings)
4646
.settings(
4747
name := "log4cats-core",
@@ -54,8 +54,9 @@ lazy val core = crossProject(JSPlatform, JVMPlatform)
5454
else Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided)
5555
}
5656
)
57+
.nativeSettings(commonNativeSettings)
5758

58-
lazy val testing = crossProject(JSPlatform, JVMPlatform)
59+
lazy val testing = crossProject(JSPlatform, JVMPlatform, NativePlatform)
5960
.settings(commonSettings)
6061
.dependsOn(core)
6162
.settings(
@@ -65,13 +66,15 @@ lazy val testing = crossProject(JSPlatform, JVMPlatform)
6566
"ch.qos.logback" % "logback-classic" % logbackClassicV % Test
6667
)
6768
)
69+
.nativeSettings(commonNativeSettings)
6870

69-
lazy val noop = crossProject(JSPlatform, JVMPlatform)
71+
lazy val noop = crossProject(JSPlatform, JVMPlatform, NativePlatform)
7072
.settings(commonSettings)
7173
.dependsOn(core)
7274
.settings(
7375
name := "log4cats-noop"
7476
)
77+
.nativeSettings(commonNativeSettings)
7578

7679
lazy val slf4j = project
7780
.settings(commonSettings)
@@ -91,6 +94,10 @@ lazy val slf4j = project
9194

9295
lazy val commonSettings = Seq(
9396
libraryDependencies ++= Seq(
94-
"org.typelevel" %%% "munit-cats-effect-3" % munitCatsEffectV % Test
97+
"org.typelevel" %%% "munit-cats-effect" % munitCatsEffectV % Test
9598
)
9699
)
100+
101+
lazy val commonNativeSettings = Seq(
102+
tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "2.4.1").toMap
103+
)

project/plugins.sbt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
2-
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
1+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
2+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
3+
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
4+
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
35
val sbtTypelevelVersion = "0.4.13"
46
addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion)
57
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion)

0 commit comments

Comments
 (0)