Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 59b453e

Browse files
committed
Build macOS native lib
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
1 parent 6d070eb commit 59b453e

File tree

3 files changed

+72
-3
lines changed

3 files changed

+72
-3
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: macOS native lib
2+
3+
on: [push]
4+
5+
jobs:
6+
macosNativeLib:
7+
runs-on: macos-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
11+
- uses: actions/setup-go@v4
12+
with:
13+
go-version: stable
14+
15+
- name: Set up JDK 21
16+
uses: actions/setup-java@v3
17+
with:
18+
java-version: 21
19+
distribution: temurin
20+
21+
- name: Build native lib
22+
run: ./gradlew :native:compress:buildJNI
23+
24+
- name: List built files
25+
run: ls -lR native/compress/build
26+
27+
- name: Upload macOS native lib asset
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: libcompress_jni.dylib
31+
path: 'native/compress/build/native/darwin-aarch64/libcompress_jni.dylib'
32+
33+
build:
34+
runs-on: ubuntu-latest
35+
needs: macosNativeLib
36+
steps:
37+
- uses: actions/checkout@v3
38+
- name: Set up JDK 21
39+
uses: actions/setup-java@v3
40+
with:
41+
java-version: 21
42+
distribution: temurin
43+
cache: 'gradle'
44+
45+
- name: Create macOS native lib dir
46+
run: mkdir -p native/compress/build/native/darwin-aarch64
47+
48+
- name: Get the built macOS native lib
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: libcompress_jni.dylib
52+
path: native/compress/build/native/darwin-aarch64
53+
54+
- name: List native resources
55+
run: ls -lR native/compress/build/native
56+
57+
- name: Build without tests
58+
run: ./gradlew build -PreleaseNativeLibs -PreleaseVersion=0.0.0-TEST -x test -x spotlessCheck
59+
60+
- name: List native resources
61+
run: ls -lR native/compress/build/native
62+
63+
- name: Upload jar
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: linea-sequencer-0.0.0-TEST.jar
67+
path: ./sequencer/build/libs/linea-sequencer-0.0.0-TEST.jar

native/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/sh -x
22

33
# Initialize external vars - need this to get around unbound variable errors
44
SKIP_GRADLE="$SKIP_GRADLE"
@@ -25,6 +25,8 @@ elif [ x"$OSTYPE" = x"GNU/Linux" ]; then
2525
ARCH_DIR="linux-$ARCHITECTURE"
2626
elif [ x"$OSTYPE" = x"Darwin" ]; then
2727
LIBRARY_EXTENSION=dylib
28+
ARCHITECTURE="$(uname -m)"
29+
ARCH_DIR="darwin-$ARCHITECTURE"
2830
else
2931
echo "*** Unknown OS: $OSTYPE"
3032
exit 1

native/compress/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ dependencies {
6161

6262

6363
tasks.register('macArmLibCopy', Copy) {
64-
from 'build/native/libcompress_jni.dylib'
64+
from 'build/native/darwin-aarch64/libcompress_jni.dylib'
6565
into 'build/resources/main/darwin-aarch64'
6666
}
6767
processResources.dependsOn macArmLibCopy
6868

6969
tasks.register('macLibCopy', Copy) {
70-
from 'build/native/libcompress_jni.dylib'
70+
from 'build/native/darwin-x86-64/libcompress_jni.dylib'
7171
into 'build/resources/main/darwin-x86-64'
7272
}
7373
processResources.dependsOn macLibCopy

0 commit comments

Comments
 (0)