From 24164f655ab213a24493af680fc558cb0564dd53 Mon Sep 17 00:00:00 2001 From: Emmanuel Engelhart Date: Sat, 16 Dec 2023 13:12:34 +0100 Subject: [PATCH 1/7] Bump-up version to 1.0.2 --- lib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/build.gradle b/lib/build.gradle index 03d93fe..448a9f2 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -19,7 +19,7 @@ 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 From 2e1f47d47c1de2dcfc0a9715ff542f74d962ef1a Mon Sep 17 00:00:00 2001 From: Emmanuel Engelhart Date: Sat, 16 Dec 2023 13:13:29 +0100 Subject: [PATCH 2/7] Use latest libkiwix/libzim (with debug symbols) --- lib/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/build.gradle b/lib/build.gradle index 448a9f2..9e04db4 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -23,8 +23,8 @@ ext { } // 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 { From 5d7e1a3b5a30cec47105726d3190af7b169f37f5 Mon Sep 17 00:00:00 2001 From: Emmanuel Engelhart Date: Sat, 16 Dec 2023 13:16:30 +0100 Subject: [PATCH 3/7] Changelog for 1.0.2 --- CHANGELOG | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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. From 435cf3a302b0df076d349aab2d78c13b3b2faa51 Mon Sep 17 00:00:00 2001 From: Emmanuel Engelhart Date: Sat, 16 Dec 2023 14:33:35 +0100 Subject: [PATCH 4/7] searchiterator.getSize() is deprecated --- lib/src/main/cpp/libzim/search_iterator.cpp | 1 - lib/src/main/java/org/kiwix/libzim/SearchIterator.java | 1 - lib/src/test/org/kiwix/test/libzim/TestSearchIterator.java | 1 - lib/src/test/test.java | 1 - 4 files changed, 4 deletions(-) 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()); From c7aad36143a3cdac71103a752cdeffc6733bdf6d Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Thu, 18 Jan 2024 18:49:24 +0530 Subject: [PATCH 5/7] Displaying an error in the `Install Dependencies` task when no file is available for renaming. * We have incorporated an additional validation check to verify the existence of the file during the copy/rename process. By default, the copy operation does not raise an error if the source file is unavailable. --- lib/build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/build.gradle b/lib/build.gradle index 9e04db4..129860d 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -153,6 +153,11 @@ task copyLibzimHeaderAndSoFiles(type: Copy) { task renameLibzimSoFile(type: Copy) { if (libzim_version != null) { + def sourceFile = file(buildDir.path + "/libzim.so." + libzim_version) + + 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 destinationDir file(buildDir.path) @@ -247,6 +252,11 @@ task copyLibkiwixHeaderAndSoFiles(type: Copy) { task renameLibkiwixSoFile(type: Copy) { if (libkiwix_version != null) { + def sourceFile = file(buildDir.path + "/libkiwix.so." + libkiwix_version) + + 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 destinationDir file(buildDir.path) From c94b385cebb621e66522c9f0118626fd20ba7ba8 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Thu, 18 Jan 2024 19:00:34 +0530 Subject: [PATCH 6/7] Changing the `libkiwix` version according to the official release available on the libkiwix repo. --- lib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/build.gradle b/lib/build.gradle index 129860d..def967f 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -23,7 +23,7 @@ ext { } // Replace these versions with the latest available versions of libkiwix and libzim -ext.libkiwix_version = "13.0.0-1" +ext.libkiwix_version = "13.0.0" ext.libzim_version = "9.1.0" apply from: 'publish.gradle' From 27142113ff06595d1ec1b0b02f88d2a8eaaa0697 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Thu, 18 Jan 2024 20:48:06 +0530 Subject: [PATCH 7/7] Upgraded the libkiwix to latest version. * Improved the code to extract the actual version if the archive is from the second build. --- lib/build.gradle | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/build.gradle b/lib/build.gradle index def967f..5804768 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -23,7 +23,7 @@ ext { } // Replace these versions with the latest available versions of libkiwix and libzim -ext.libkiwix_version = "13.0.0" +ext.libkiwix_version = "13.0.0-1" ext.libzim_version = "9.1.0" apply from: 'publish.gradle' @@ -146,22 +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 sourceFile = file(buildDir.path + "/libzim.so." + libzim_version) + 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" } } @@ -245,25 +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 sourceFile = file(buildDir.path + "/libkiwix.so." + libkiwix_version) + 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'