diff --git a/CHANGELOG b/CHANGELOG index a880586..5f5a697 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,8 +1,11 @@ +1.0.2 +* NEW: libkiwix 13.0.0 and libzim 9.1.0 (@mgautierfr https://github.com/kiwix/java-libkiwix/pull/68) +* NEW: libkiwix and libzim with debug symbols (@mgautierfr https://github.com/kiwix/kiwix-build/pull/664) + 1.0.1 * FIX: Resolved an issue where the library was not saving all books that are read from the library. (https://github.com/kiwix/java-libkiwix/pull/72) * FIX: Fixed a problem where books were not returning the illustration. (https://github.com/kiwix/java-libkiwix/pull/74) - 1.0.0 * NEW: Moved wrapper from libkiwix to java-libkiwix. * NEW: Adapted new build system. diff --git a/lib/build.gradle b/lib/build.gradle index 03d93fe..5804768 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -19,12 +19,12 @@ ext["sonatypeStagingProfileId"] = properties.getProperty("sonatypeStagingProfile ext { set("GROUP_ID", "org.kiwix") set("ARTIFACT_ID", "libkiwix") - set("VERSION", "1.0.1") + set("VERSION", "1.0.2") } // Replace these versions with the latest available versions of libkiwix and libzim -ext.libkiwix_version = "13.0.0" -ext.libzim_version = "9.0.0" +ext.libkiwix_version = "13.0.0-1" +ext.libzim_version = "9.1.0" apply from: 'publish.gradle' android { @@ -146,17 +146,24 @@ task copyLibzimHeaderAndSoFiles(type: Copy) { copy { // copying linux_x86_64 so file - from buildDir.path + "/libzim_linux-x86_64-bionic/lib/x86_64-linux-gnu/libzim.so." + libzim_version + from buildDir.path + "/libzim_linux-x86_64-bionic/lib/x86_64-linux-gnu/libzim.so." + getActualLibraryVersion(libzim_version) into buildDir.path } } task renameLibzimSoFile(type: Copy) { if (libzim_version != null) { + def finalLibzimVersion = getActualLibraryVersion(libzim_version) + + def sourceFile = file(buildDir.path + "/libzim.so." + finalLibzimVersion) + + if (project.gradle.startParameter.taskNames.contains("renameLibzimSoFile") && !sourceFile.exists()) { + throw new RuntimeException("Rename Libzim so file task failed, File not found: ${sourceFile}") + } from(buildDir.path) - include "libzim.so." + libzim_version + include "libzim.so." + finalLibzimVersion destinationDir file(buildDir.path) - rename "libzim.so." + libzim_version, "libzim.so" + rename "libzim.so." + finalLibzimVersion, "libzim.so" } } @@ -240,20 +247,36 @@ task copyLibkiwixHeaderAndSoFiles(type: Copy) { copy { // copying linux_x86_64 so file - from buildDir.path + "/libkiwix_linux-x86_64/lib/x86_64-linux-gnu/libkiwix.so." + libkiwix_version + from buildDir.path + "/libkiwix_linux-x86_64/lib/x86_64-linux-gnu/libkiwix.so." + getActualLibraryVersion(libkiwix_version) into buildDir.path } } task renameLibkiwixSoFile(type: Copy) { if (libkiwix_version != null) { + def finalLibkiwixVersion = getActualLibraryVersion(libkiwix_version) + def sourceFile = file(buildDir.path + "/libkiwix.so." + finalLibkiwixVersion) + + if (project.gradle.startParameter.taskNames.contains("renameLibkiwixSoFile") && !sourceFile.exists()) { + throw new RuntimeException("Rename Libkiwix so file task failed, File not found: ${sourceFile}") + } from(buildDir.path) - include "libkiwix.so." + libkiwix_version + include "libkiwix.so." + finalLibkiwixVersion destinationDir file(buildDir.path) - rename "libkiwix.so." + libkiwix_version, "libkiwix.so" + rename "libkiwix.so." + finalLibkiwixVersion, "libkiwix.so" } } +// Extracting the library version before the "-" +// see https://github.com/kiwix/java-libkiwix/pull/79 for more details +static String getActualLibraryVersion(String libraryVersion) { + // Find the index of the first occurrence of "-" + Integer dashIndex = libraryVersion.indexOf('-') + + // Get the substring before the first "-" + return dashIndex != -1 ? libraryVersion.substring(0, dashIndex) : libraryVersion +} + task testSourceJar(type: Jar) { from android.sourceSets.test.java.srcDirs archiveName = 'test-sources.jar' diff --git a/lib/src/main/cpp/libzim/search_iterator.cpp b/lib/src/main/cpp/libzim/search_iterator.cpp index 60c559e..58e01fd 100644 --- a/lib/src/main/cpp/libzim/search_iterator.cpp +++ b/lib/src/main/cpp/libzim/search_iterator.cpp @@ -50,7 +50,6 @@ GETTER(jint, getScore) GETTER(jstring, getSnippet) GETTER(jint, getWordCount) GETTER(jint, getFileIndex) -GETTER(jint, getSize) METHOD0(jstring, getZimId) { return TO_JNI(std::string(THIS->getZimId())); diff --git a/lib/src/main/java/org/kiwix/libzim/SearchIterator.java b/lib/src/main/java/org/kiwix/libzim/SearchIterator.java index 0a73912..f63db50 100644 --- a/lib/src/main/java/org/kiwix/libzim/SearchIterator.java +++ b/lib/src/main/java/org/kiwix/libzim/SearchIterator.java @@ -30,7 +30,6 @@ public class SearchIterator implements Iterator public native String getSnippet(); public native int getWordCount(); public native int getFileIndex(); - public native int getSize(); public native String getZimId(); public native boolean hasNext(); diff --git a/lib/src/test/org/kiwix/test/libzim/TestSearchIterator.java b/lib/src/test/org/kiwix/test/libzim/TestSearchIterator.java index f942c28..4fcaeeb 100644 --- a/lib/src/test/org/kiwix/test/libzim/TestSearchIterator.java +++ b/lib/src/test/org/kiwix/test/libzim/TestSearchIterator.java @@ -32,7 +32,6 @@ public class TestSearchIterator implements Iterator public String getSnippet() { return inner.getSnippet(); } public int getWordCount() { return inner.getWordCount(); } public int getFileIndex() { return inner.getFileIndex(); } - public int getSize() { return inner.getSize(); } public String getZimId() { return inner.getZimId(); } public boolean hasNext() { return inner.hasNext(); } diff --git a/lib/src/test/test.java b/lib/src/test/test.java index 6c2945d..c5c8705 100644 --- a/lib/src/test/test.java +++ b/lib/src/test/test.java @@ -510,7 +510,6 @@ public class test { assertEquals("Test ZIM file", iterator.getSnippet()); assertEquals(3, iterator.getWordCount()); assertEquals(0, iterator.getFileIndex()); - assertEquals(-1, iterator.getSize()); assertEquals("e34f5109-ed0d-b93e-943d-06f7717c7340", iterator.getZimId()); TestEntry entry = iterator.next(); assertEquals("main.html", entry.getPath());