Skip to content

Commit 71424d5

Browse files
committed
Make: Match C lib names in JARs
1 parent d4f9e4d commit 71424d5

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -647,24 +647,27 @@ jobs:
647647

648648
- name: Extract native libraries for all platforms
649649
run: |
650-
# Extract Linux libraries (from .so files and .deb packages)
651-
find temp-natives -name "*.so" -exec cp {} build/libs/usearch/shared/ \;
652-
find temp-natives -name "*.deb" -exec dpkg-deb -x {} temp-extract \;
653-
find temp-extract -name "*.so" -exec cp {} build/libs/usearch/shared/ \; 2>/dev/null || true
650+
mkdir -p temp-extract
654651
655-
# Extract Windows libraries (from .tar and .dll files)
656-
find temp-natives -name "*.dll" -exec cp {} build/libs/usearch/shared/ \;
652+
echo "=== Extracting Linux libraries ==="
653+
find temp-natives -name "*linux*libusearch_c*.so" -exec cp {} build/libs/usearch/shared/ \; 2>/dev/null || true
654+
find temp-natives -name "*.deb" -exec dpkg-deb -x {} temp-extract \; 2>/dev/null || true
655+
find temp-extract -name "libusearch_c.so" -exec cp {} build/libs/usearch/shared/ \; 2>/dev/null || true
656+
657+
echo "=== Extracting Windows libraries ==="
657658
find temp-natives -name "*windows*.tar" -exec tar -xf {} -C temp-extract \; 2>/dev/null || true
658-
find temp-extract -name "*.dll" -exec cp {} build/libs/usearch/shared/ \; 2>/dev/null || true
659+
find temp-extract -name "libusearch_c.dll" -exec cp {} build/libs/usearch/shared/ \; 2>/dev/null || true
660+
find temp-natives -name "*libusearch_c*.dll" -exec cp {} build/libs/usearch/shared/ \; 2>/dev/null || true
659661
660-
# Extract macOS libraries (from .dylib files and .zip files)
661-
find temp-natives -name "*.dylib" -exec cp {} build/libs/usearch/shared/ \;
662+
echo "=== Extracting macOS libraries ==="
662663
find temp-natives -name "*macos*.zip" -exec unzip -j {} -d temp-extract \; 2>/dev/null || true
663-
find temp-extract -name "*.dylib" -exec cp {} build/libs/usearch/shared/ \; 2>/dev/null || true
664+
find temp-extract -name "libusearch_c.dylib" -exec cp {} build/libs/usearch/shared/ \; 2>/dev/null || true
665+
find temp-natives -name "*libusearch_c*.dylib" -exec cp {} build/libs/usearch/shared/ \; 2>/dev/null || true
664666
665-
# Show what we collected
666-
echo "Collected native libraries:"
667-
ls -la build/libs/usearch/shared/
667+
echo "=== Collected libraries ==="
668+
ls -la build/libs/usearch/shared/ || echo "No libraries found"
669+
echo "=== Temp natives directory contents ==="
670+
find temp-natives -name "*libusearch*" -type f | head -20
668671
669672
- name: Set up Java
670673
uses: actions/[email protected]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ bin
1616
/build_relwithdebinfo
1717
/build_profile
1818
/build_artifacts
19+
/build*
1920
_deps
2021
CMakeCache.txt
2122
CMakeFiles

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
],
232232
"autoDocstring.docstringFormat": "sphinx",
233233
"dotnet.defaultSolution": "csharp/Cloud.Unum.USearch.sln",
234-
"java.configuration.updateBuildConfiguration": "interactive",
234+
"java.configuration.updateBuildConfiguration": "automatic",
235235
"editor.insertSpaces": true,
236236
"editor.tabSize": 4,
237237
"prettier.singleQuote": true,

build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ model {
6363

6464
components {
6565
usearch(NativeLibrarySpec) {
66+
baseName = "usearch_c" // Matches the naming convention in CMake builds for convenience
6667
sources {
6768
cpp {
6869
source {
@@ -144,7 +145,7 @@ jar {
144145

145146
// Include all native libraries, organized by platform if possible
146147
from("$buildDir/libs/usearch/shared") {
147-
include "libusearch.so", "libusearch.dylib", "libusearch.dll"
148+
include "libusearch_c.so", "libusearch_c.dylib", "libusearch_c.dll"
148149
into "usearch-native"
149150

150151
// Organize by platform if we can detect it
@@ -154,11 +155,11 @@ jar {
154155
String archName = osArch.contains("64") ? "x86_64" :
155156
osArch.contains("aarch") || osArch.contains("arm") ? "arm64" : osArch
156157

157-
if (details.name.endsWith(".so")) {
158+
if (details.name.endsWith("_c.so")) {
158159
details.path = "usearch-native/linux-${archName}/${details.name}"
159-
} else if (details.name.endsWith(".dylib")) {
160+
} else if (details.name.endsWith("_c.dylib")) {
160161
details.path = "usearch-native/darwin-${archName}/${details.name}"
161-
} else if (details.name.endsWith(".dll")) {
162+
} else if (details.name.endsWith("_c.dll")) {
162163
details.path = "usearch-native/windows-${archName}/${details.name}"
163164
}
164165
}

java/cloud/unum/usearch/Index.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,11 @@ private static void loadLibraryFromJar() throws IOException {
475475

476476
String libName;
477477
if (osName.contains("mac") || osName.contains("darwin")) {
478-
libName = "libusearch.dylib";
478+
libName = "libusearch_c.dylib";
479479
} else if (osName.contains("windows")) {
480-
libName = "libusearch.dll";
480+
libName = "libusearch_c.dll";
481481
} else {
482-
libName = "libusearch.so";
482+
libName = "libusearch_c.so";
483483
}
484484

485485
// Try architecture-specific first, then fall back to generic

0 commit comments

Comments
 (0)