Commit 811d614
committed
fix(loader): anchor native-library resource path to fixed package root
LlamaLoader.getNativeResourcePath() derived the classpath location of the
bundled native libraries from the loader's OWN Java package via
LlamaLoader.class.getPackage(). The layered restructure moved LlamaLoader from
net.ladenthin.llama to net.ladenthin.llama.loader, so the lookup became
/net/ladenthin/llama/loader/<os>/<arch>/libjllama.so — one directory too deep.
CMakeLists.txt and the publish workflow emit the libs to the fixed layout
/net/ladenthin/llama/<os>/<arch>/, so getResource(...) returned null and every
native-backed test failed at runtime with "No native library found" (and the
packaged JAR would fail identically for real consumers).
Fix: anchor the resource root to a NATIVE_RESOURCE_BASE constant
("/net/ladenthin/llama") independent of the loader's Java package, matching the
build/CI layout. Adds a regression test pinning the exact prefix and asserting
the path never contains "/loader/" (the pre-existing contains-substring test
stayed green through the bug, which is why it slipped in).
Same class of latent "path derived from something that moved in the restructure"
bug as the spotbugs-exclude / PIT-target / CMake-OSInfo FQN repairs.1 parent 78cfef1 commit 811d614
2 files changed
Lines changed: 30 additions & 8 deletions
File tree
- src
- main/java/net/ladenthin/llama/loader
- test/java/net/ladenthin/llama/loader
Lines changed: 10 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
51 | 60 | | |
52 | 61 | | |
53 | 62 | | |
| |||
267 | 276 | | |
268 | 277 | | |
269 | 278 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 279 | + | |
278 | 280 | | |
279 | 281 | | |
280 | 282 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
190 | 210 | | |
0 commit comments