mirror of
https://github.com/kiwix/java-libkiwix.git
synced 2025-09-15 01:59:01 -04:00
Upgraded the libkiwix to latest version.
* Improved the code to extract the actual version if the archive is from the second build.
This commit is contained in:
parent
c94b385ceb
commit
27142113ff
@ -23,7 +23,7 @@ ext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace these versions with the latest available versions of libkiwix and libzim
|
// 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"
|
ext.libzim_version = "9.1.0"
|
||||||
|
|
||||||
apply from: 'publish.gradle'
|
apply from: 'publish.gradle'
|
||||||
@ -146,22 +146,24 @@ task copyLibzimHeaderAndSoFiles(type: Copy) {
|
|||||||
|
|
||||||
copy {
|
copy {
|
||||||
// copying linux_x86_64 so file
|
// 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
|
into buildDir.path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task renameLibzimSoFile(type: Copy) {
|
task renameLibzimSoFile(type: Copy) {
|
||||||
if (libzim_version != null) {
|
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()) {
|
if (project.gradle.startParameter.taskNames.contains("renameLibzimSoFile") && !sourceFile.exists()) {
|
||||||
throw new RuntimeException("Rename Libzim so file task failed, File not found: ${sourceFile}")
|
throw new RuntimeException("Rename Libzim so file task failed, File not found: ${sourceFile}")
|
||||||
}
|
}
|
||||||
from(buildDir.path)
|
from(buildDir.path)
|
||||||
include "libzim.so." + libzim_version
|
include "libzim.so." + finalLibzimVersion
|
||||||
destinationDir file(buildDir.path)
|
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 {
|
copy {
|
||||||
// copying linux_x86_64 so file
|
// 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
|
into buildDir.path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task renameLibkiwixSoFile(type: Copy) {
|
task renameLibkiwixSoFile(type: Copy) {
|
||||||
if (libkiwix_version != null) {
|
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()) {
|
if (project.gradle.startParameter.taskNames.contains("renameLibkiwixSoFile") && !sourceFile.exists()) {
|
||||||
throw new RuntimeException("Rename Libkiwix so file task failed, File not found: ${sourceFile}")
|
throw new RuntimeException("Rename Libkiwix so file task failed, File not found: ${sourceFile}")
|
||||||
}
|
}
|
||||||
from(buildDir.path)
|
from(buildDir.path)
|
||||||
include "libkiwix.so." + libkiwix_version
|
include "libkiwix.so." + finalLibkiwixVersion
|
||||||
destinationDir file(buildDir.path)
|
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) {
|
task testSourceJar(type: Jar) {
|
||||||
from android.sourceSets.test.java.srcDirs
|
from android.sourceSets.test.java.srcDirs
|
||||||
archiveName = 'test-sources.jar'
|
archiveName = 'test-sources.jar'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user