@@ -10,32 +10,67 @@ permissions:
1010
1111jobs :
1212 build-natives :
13- name : Build natives for ${{ matrix.platform }}- ${{ matrix.arch }}
13+ name : Natives ${{ matrix.platform-id }} ( ${{ matrix.variant }})
1414 strategy :
15+ fail-fast : false
1516 matrix :
1617 include :
1718 - os : ubuntu-latest
18- platform : linux
19- arch : x64
19+ platform-id : linux-x64
2020 lib : libflecs.so
21+ variant : release
22+
23+ - os : ubuntu-24.04-arm
24+ platform-id : linux-aarch64
25+ lib : libflecs.so
26+ variant : release
27+
2128 - os : windows-latest
22- platform : windows
23- arch : x64
29+ platform-id : windows-x64
2430 lib : flecs.dll
25- - os : macos-15
26- platform : macos
27- arch : x64
31+ variant : release
32+
33+ - os : macos-latest
34+ platform-id : macos-x64
2835 lib : libflecs.dylib
36+ variant : release
37+ compiler_target : x86_64-apple-macos10.15
38+
2939 - os : macos-latest
30- platform : macos
31- arch : aarch64
40+ platform-id : macos-aarch64
3241 lib : libflecs.dylib
42+ variant : release
43+
44+ - os : ubuntu-latest
45+ platform-id : linux-x64
46+ lib : libflecs.so
47+ variant : debug
48+
49+ - os : ubuntu-24.04-arm
50+ platform-id : linux-aarch64
51+ lib : libflecs.so
52+ variant : debug
53+
54+ - os : windows-latest
55+ platform-id : windows-x64
56+ lib : flecs.dll
57+ variant : debug
58+
59+ - os : macos-latest
60+ platform-id : macos-x64
61+ lib : libflecs.dylib
62+ variant : debug
63+ compiler_target : x86_64-apple-macos10.15
64+
65+ - os : macos-latest
66+ platform-id : macos-aarch64
67+ lib : libflecs.dylib
68+ variant : debug
3369
3470 runs-on : ${{ matrix.os }}
3571
3672 steps :
37- - name : Checkout code
38- uses : actions/checkout@v4
73+ - uses : actions/checkout@v4
3974
4075 - name : Set up JDK 25
4176 uses : actions/setup-java@v4
@@ -51,45 +86,48 @@ jobs:
5186
5287 - name : Install GCC (Windows)
5388 if : runner.os == 'Windows'
54- run : choco install mingw -y
89+ uses : msys2/setup-msys2@v2
90+ with :
91+ msystem : MINGW64
92+ install : mingw-w64-x86_64-gcc
5593
5694 - name : Grant execute permission for gradlew
5795 if : runner.os != 'Windows'
5896 run : chmod +x gradlew
5997
60- - name : Build natives
61- run : ./gradlew compileFlecsNative -PNATIVE_ARCH=${{ matrix.platform }}-${{ matrix.arch }}
98+ - name : Compile native (${{ matrix.variant }})
6299 shell : bash
63-
64- - name : Verify native library was built
65100 run : |
66- FILE_PATH="build/resources/main/natives/${{ matrix.platform }}-${{ matrix.arch }}/${{ matrix.lib }}"
67- echo "Checking for native library at $FILE_PATH..."
68-
69- if [ ! -f "$FILE_PATH" ]; then
70- echo "Error: Native library not found!"
71- exit 1
72- fi
73-
74- FILE_SIZE=$(wc -c < "$FILE_PATH")
75- MIN_SIZE=102400
76-
77- echo "File size: $FILE_SIZE bytes"
78-
79- if [ "$FILE_SIZE" -lt "$MIN_SIZE" ]; then
80- echo "Error: File size is too small ($FILE_SIZE bytes). Expected at least $MIN_SIZE bytes."
81- exit 1
101+ EXTRA_ARGS=""
102+ if [ -n "${{ matrix.compiler_target }}" ]; then
103+ EXTRA_ARGS="-PCOMPILER_TARGET=${{ matrix.compiler_target }}"
82104 fi
105+ ./gradlew \
106+ :compileFlecsNative-${{ matrix.platform-id }}-${{ matrix.variant }} \
107+ -PNATIVE_ARCH=${{ matrix.platform-id }} \
108+ $EXTRA_ARGS
83109
84- echo "✓ File exists and size is valid."
85- ls -la "$FILE_PATH"
110+ - name : Verify native library
86111 shell : bash
112+ run : |
113+ FILE="build/natives/${{ matrix.platform-id }}/${{ matrix.variant }}/${{ matrix.lib }}"
114+ echo "Checking $FILE ..."
115+ if [ ! -f "$FILE" ]; then
116+ echo "❌ Not found: $FILE"; exit 1
117+ fi
118+ SIZE=$(wc -c < "$FILE")
119+ echo "Size: $SIZE bytes"
120+ if [ "$SIZE" -lt 102400 ]; then
121+ echo "❌ Too small ($SIZE bytes, expected ≥ 102400)"; exit 1
122+ fi
123+ echo "✅ OK"
124+ ls -lh "$FILE"
87125
88- - name : Upload natives artifact
126+ - name : Upload native artifact
89127 uses : actions/upload-artifact@v4
90128 with :
91- name : natives -${{ matrix.platform }}-${{ matrix.arch }}
92- path : build/resources/main/ natives/${{ matrix.platform }}- ${{ matrix.arch }}/${{ matrix.lib }}
129+ name : native -${{ matrix.platform-id }}-${{ matrix.variant }}
130+ path : build/natives/${{ matrix.platform-id }}/ ${{ matrix.variant }}/${{ matrix.lib }}
93131 retention-days : 1
94132
95133 publish :
@@ -98,63 +136,126 @@ jobs:
98136 runs-on : ubuntu-latest
99137
100138 steps :
101- - name : Checkout code
102- uses : actions/checkout@v4
139+ - uses : actions/checkout@v4
103140
104141 - name : Set up JDK 25
105142 uses : actions/setup-java@v4
106143 with :
107144 java-version : ' 25'
108145 distribution : ' temurin'
109146
110- - name : Download all natives
147+ - name : Download all native artifacts
111148 uses : actions/download-artifact@v4
112149 with :
150+ pattern : native-*
113151 path : downloaded-natives
152+ merge-multiple : false
114153
115- - name : Debug downloaded artifacts
154+ - name : Place natives in build/natives/
155+ shell : bash
116156 run : |
117- echo "Downloaded artifacts structure: "
118- find downloaded-natives -type f
157+ echo "=== Downloaded artifacts === "
158+ find downloaded-natives -type f | sort
119159
120- - name : Organize natives
121- run : |
122- mkdir -p src/main/resources/natives
160+ for artifact_dir in downloaded-natives/native-*/; do
161+ basename=$(basename "$artifact_dir")
162+ rest=${basename#native-}
163+ variant=${rest##*-}
164+ platform=${rest%-$variant}
123165
124- for artifact_dir in downloaded-natives/natives-*/; do
125- platform_arch=$(basename "$artifact_dir" | sed 's/^natives-//')
126- echo "Processing $platform_arch..."
127- mkdir -p "src/main/resources/natives/$platform_arch"
128- cp "$artifact_dir"/* "src/main/resources/natives/$platform_arch/"
166+ dest="build/natives/$platform/$variant"
167+ mkdir -p "$dest"
168+ cp "$artifact_dir"/* "$dest/"
169+ echo "✅ $platform/$variant → $dest"
129170 done
130171
131- echo "Final native libraries structure:"
132- find src/main/resources/natives -type f
172+ echo ""
173+ echo "=== Final tree ==="
174+ find build/natives -type f | sort
133175
134176 - name : Grant execute permission for gradlew
135177 run : chmod +x gradlew
136178
137- - name : Build final JAR with all natives
138- run : ./gradlew jar -x compileFlecsNative
179+ - name : Build JAR (API + processor, sans natifs embarqués)
180+ run : >
181+ ./gradlew :jar :sourcesJar :javadocJar
182+ -x :compileFlecsNative
183+ -x :extractFlecs
184+ -x :downloadFlecs
185+
186+ - name : Build all native JARs
187+ run : >
188+ ./gradlew
189+ :jarNatives-linux-x64-release
190+ :jarNatives-linux-aarch64-release
191+ :jarNatives-windows-x64-release
192+ :jarNatives-macos-x64-release
193+ :jarNatives-macos-aarch64-release
194+ :jarNatives-linux-x64-debug
195+ :jarNatives-linux-aarch64-debug
196+ :jarNatives-windows-x64-debug
197+ :jarNatives-macos-x64-debug
198+ :jarNatives-macos-aarch64-debug
199+ -x :compileFlecsNative-linux-x64-release
200+ -x :compileFlecsNative-linux-aarch64-release
201+ -x :compileFlecsNative-windows-x64-release
202+ -x :compileFlecsNative-macos-x64-release
203+ -x :compileFlecsNative-macos-aarch64-release
204+ -x :compileFlecsNative-linux-x64-debug
205+ -x :compileFlecsNative-linux-aarch64-debug
206+ -x :compileFlecsNative-windows-x64-debug
207+ -x :compileFlecsNative-macos-x64-debug
208+ -x :compileFlecsNative-macos-aarch64-debug
209+ -x :extractFlecs
210+ -x :downloadFlecs
139211
140212 - name : Verify JAR contents
213+ shell : bash
141214 run : |
142215 VERSION=${GITHUB_REF_NAME#v}
143- echo "Verifying JAR for version $VERSION..."
144- echo ""
145- echo "All natives in JAR:"
146- jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/" | sort
216+ JAR="build/libs/flecs-java-$VERSION.jar"
217+
218+ echo "=== Main JAR: $JAR ==="
219+ jar tf "$JAR" | grep "natives/" | sort || echo "Aucun natif embarqué dans le jar principal"
220+
147221 echo ""
222+ echo "=== Native JARs ==="
223+ for f in build/libs/flecs-java-$VERSION-natives-*.jar; do
224+ [ -f "$f" ] || { echo "Aucun jar natif trouvé"; break; }
225+ echo "--- $(basename $f) ---"
226+ jar tf "$f" | grep "natives/"
227+ done
148228
149- jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/linux-x64/libflecs.so" && echo "✓ Linux x64" || echo "✗ Linux x64 MISSING"
150- jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/windows-x64/flecs.dll" && echo "✓ Windows x64" || echo "✗ Windows x64 MISSING"
151- jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/macos-x64/libflecs.dylib" && echo "✓ macOS x64" || echo "✗ macOS x64 MISSING"
152- jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/macos-aarch64/libflecs.dylib" && echo "✓ macOS ARM64" || echo "✗ macOS ARM64 MISSING"
229+ echo ""
230+ echo "Verifying all expected classifiers..."
231+ EXPECTED=(
232+ "natives-linux-x64"
233+ "natives-linux-aarch64"
234+ "natives-windows-x64"
235+ "natives-macos-x64"
236+ "natives-macos-aarch64"
237+ "natives-linux-x64-debug"
238+ "natives-linux-aarch64-debug"
239+ "natives-windows-x64-debug"
240+ "natives-macos-x64-debug"
241+ "natives-macos-aarch64-debug"
242+ )
243+ ALL_OK=true
244+ for classifier in "${EXPECTED[@]}"; do
245+ f="build/libs/flecs-java-$VERSION-$classifier.jar"
246+ if [ -f "$f" ]; then
247+ echo "✅ $classifier"
248+ else
249+ echo "❌ $classifier — MISSING"
250+ ALL_OK=false
251+ fi
252+ done
253+ $ALL_OK || exit 1
153254
154255 - name : Publish to Maven Central
155256 env :
156257 OSSRH_USERNAME : ${{ secrets.OSSRH_USERNAME }}
157258 OSSRH_PASSWORD : ${{ secrets.OSSRH_PASSWORD }}
158259 SIGNING_KEY : ${{ secrets.SIGNING_KEY }}
159260 SIGNING_PASSWORD : ${{ secrets.SIGNING_PASSWORD }}
160- run : ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
261+ run : ./gradlew : publishToSonatype : closeAndReleaseSonatypeStagingRepository
0 commit comments