Skip to content

Commit

Permalink
Merge pull request #79 from kiwix/release-1.0.2
Browse files Browse the repository at this point in the history
Release 1.0.2
  • Loading branch information
mgautierfr authored Jan 18, 2024
2 parents 38373f9 + 2714211 commit 4a8e966
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
41 changes: 32 additions & 9 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"
}
}

Expand Down Expand Up @@ -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'
Expand Down
1 change: 0 additions & 1 deletion lib/src/main/cpp/libzim/search_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
1 change: 0 additions & 1 deletion lib/src/main/java/org/kiwix/libzim/SearchIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class SearchIterator implements Iterator<Entry>
public native String getSnippet();
public native int getWordCount();
public native int getFileIndex();
public native int getSize();
public native String getZimId();

public native boolean hasNext();
Expand Down
1 change: 0 additions & 1 deletion lib/src/test/org/kiwix/test/libzim/TestSearchIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class TestSearchIterator implements Iterator<TestEntry>
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(); }
Expand Down
1 change: 0 additions & 1 deletion lib/src/test/test.java
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@ public void testSearcher() throws Exception, ZimFileFormatException, JNIKiwixExc
assertEquals("<b>Test</b> 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());
Expand Down

0 comments on commit 4a8e966

Please sign in to comment.