mirror of
https://github.com/kiwix/java-libkiwix.git
synced 2025-08-03 11:06:15 -04:00
Adapt build system
- Build everything in buildDir instead of copy/generate things in src.
This commit is contained in:
parent
3b4ca8a3d2
commit
f7f6d5628d
7
build.sh
Normal file → Executable file
7
build.sh
Normal file → Executable file
@ -1,10 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
Green='\e[32m'
|
Green='\e[32m'
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
cd android-libkiwixbuild/
|
|
||||||
|
|
||||||
printf "${Green}Check Current Java version${NC}\n"
|
printf "${Green}Check Current Java version${NC}\n"
|
||||||
./gradlew checkCurrentJavaVersion
|
./gradlew checkCurrentJavaVersion
|
||||||
printf "\n${Green}Done! ${NC}\n"
|
printf "\n${Green}Done! ${NC}\n"
|
||||||
@ -33,4 +34,4 @@ printf "${Green}Generating header files from java wrapper files ${NC}\n"
|
|||||||
./gradlew generateHeaderFilesFromJavaWrapper
|
./gradlew generateHeaderFilesFromJavaWrapper
|
||||||
printf "\n${Green}Done! ${NC}\n"
|
printf "\n${Green}Done! ${NC}\n"
|
||||||
|
|
||||||
hash -r
|
hash -r
|
||||||
|
@ -39,7 +39,7 @@ android {
|
|||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
cppFlags ''
|
cppFlags ''
|
||||||
arguments "-DANDROID_STL=c++_shared"
|
arguments "-DANDROID_STL=c++_shared", "-DBUILD_DIR=${buildDir}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ android {
|
|||||||
}
|
}
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
path file('src/main/cpp/CMakeLists.txt')
|
path file('src/cpp/CMakeLists.txt')
|
||||||
version '3.18.1'
|
version '3.18.1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,31 +121,31 @@ task unzipLibzim(type: Copy) {
|
|||||||
task copyLibzimHeaderFiles(type: Copy) {
|
task copyLibzimHeaderFiles(type: Copy) {
|
||||||
// copying header file
|
// copying header file
|
||||||
from buildDir.path + "/libzim_android-arm-" + nightly_date_for_libzim + '/include/'
|
from buildDir.path + "/libzim_android-arm-" + nightly_date_for_libzim + '/include/'
|
||||||
into projectDir.path + "/src/main/cpp/include/libzim/"
|
into buildDir.path + "/include/libzim/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibzimAndroidArm(type: Copy) {
|
task copyLibzimAndroidArm(type: Copy) {
|
||||||
// copying android_arm so file
|
// copying android_arm so file
|
||||||
from buildDir.path + "/libzim_android-arm-" + nightly_date_for_libzim + '/lib/arm-linux-androideabi/'
|
from buildDir.path + "/libzim_android-arm-" + nightly_date_for_libzim + '/lib/arm-linux-androideabi/'
|
||||||
into projectDir.path + "/src/main/jniLibs/armeabi-v7a/libzim/"
|
into buildDir.path + "/jniLibs/armeabi-v7a/libzim/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibzimAndroidArm64(type: Copy) {
|
task copyLibzimAndroidArm64(type: Copy) {
|
||||||
// copying android_arm64 so file
|
// copying android_arm64 so file
|
||||||
from buildDir.path + "/libzim_android-arm64-" + nightly_date_for_libzim + '/lib/aarch64-linux-android/'
|
from buildDir.path + "/libzim_android-arm64-" + nightly_date_for_libzim + '/lib/aarch64-linux-android/'
|
||||||
into projectDir.path + "/src/main/jniLibs/arm64-v8a/libzim/"
|
into buildDir.path + "/jniLibs/arm64-v8a/libzim/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibzimAndroidx86(type: Copy) {
|
task copyLibzimAndroidx86(type: Copy) {
|
||||||
// copying android_x86 so file
|
// copying android_x86 so file
|
||||||
from buildDir.path + "/libzim_android-x86-" + nightly_date_for_libzim + '/lib/i686-linux-android/'
|
from buildDir.path + "/libzim_android-x86-" + nightly_date_for_libzim + '/lib/i686-linux-android/'
|
||||||
into projectDir.path + "/src/main/jniLibs/x86/libzim/"
|
into buildDir.path + "/jniLibs/x86/libzim/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibzimAndroidx86_64(type: Copy) {
|
task copyLibzimAndroidx86_64(type: Copy) {
|
||||||
// copying android_x86_64 so file
|
// copying android_x86_64 so file
|
||||||
from buildDir.path + "/libzim_android-x86_64-" + nightly_date_for_libzim + '/lib/x86_64-linux-android/'
|
from buildDir.path + "/libzim_android-x86_64-" + nightly_date_for_libzim + '/lib/x86_64-linux-android/'
|
||||||
into projectDir.path + "/src/main/jniLibs/x86_64/libzim/"
|
into buildDir.path + "/jniLibs/x86_64/libzim/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibzimLinux_x86_64(type: Copy) {
|
task copyLibzimLinux_x86_64(type: Copy) {
|
||||||
@ -212,31 +212,31 @@ task unzipLibkiwix(type: Copy) {
|
|||||||
task copyLibkiwixHeaderFiles(type: Copy) {
|
task copyLibkiwixHeaderFiles(type: Copy) {
|
||||||
// copying header file
|
// copying header file
|
||||||
from buildDir.path + "/libkiwix_android-arm-" + nightly_date_for_libkiwix + '/include/kiwix/'
|
from buildDir.path + "/libkiwix_android-arm-" + nightly_date_for_libkiwix + '/include/kiwix/'
|
||||||
into projectDir.path + "/src/main/cpp/include/libkiwix/"
|
into buildDir.path + "/include/libkiwix/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibkiwixAndroidArm(type: Copy) {
|
task copyLibkiwixAndroidArm(type: Copy) {
|
||||||
// copying android_arm so file
|
// copying android_arm so file
|
||||||
from buildDir.path + "/libkiwix_android-arm-" + nightly_date_for_libkiwix + '/lib/arm-linux-androideabi/'
|
from buildDir.path + "/libkiwix_android-arm-" + nightly_date_for_libkiwix + '/lib/arm-linux-androideabi/'
|
||||||
into projectDir.path + "/src/main/jniLibs/armeabi-v7a/libkiwix/"
|
into buildDir.path + "/jniLibs/armeabi-v7a/libkiwix/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibkiwixAndroidArm64(type: Copy) {
|
task copyLibkiwixAndroidArm64(type: Copy) {
|
||||||
// copying android_arm64 so file
|
// copying android_arm64 so file
|
||||||
from buildDir.path + "/libkiwix_android-arm64-" + nightly_date_for_libkiwix + '/lib/aarch64-linux-android/'
|
from buildDir.path + "/libkiwix_android-arm64-" + nightly_date_for_libkiwix + '/lib/aarch64-linux-android/'
|
||||||
into projectDir.path + "/src/main/jniLibs/arm64-v8a/libkiwix/"
|
into buildDir.path + "/jniLibs/arm64-v8a/libkiwix/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibkiwixAndroidx86(type: Copy) {
|
task copyLibkiwixAndroidx86(type: Copy) {
|
||||||
// copying android_x86 so file
|
// copying android_x86 so file
|
||||||
from buildDir.path + "/libkiwix_android-x86-" + nightly_date_for_libkiwix + '/lib/i686-linux-android/'
|
from buildDir.path + "/libkiwix_android-x86-" + nightly_date_for_libkiwix + '/lib/i686-linux-android/'
|
||||||
into projectDir.path + "/src/main/jniLibs/x86/libkiwix/"
|
into buildDir.path + "/jniLibs/x86/libkiwix/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibkiwixAndroidx86_64(type: Copy) {
|
task copyLibkiwixAndroidx86_64(type: Copy) {
|
||||||
// copying android_x86_64 so file
|
// copying android_x86_64 so file
|
||||||
from buildDir.path + "/libkiwix_android-x86_64-" + nightly_date_for_libkiwix + '/lib/x86_64-linux-android/'
|
from buildDir.path + "/libkiwix_android-x86_64-" + nightly_date_for_libkiwix + '/lib/x86_64-linux-android/'
|
||||||
into projectDir.path + "/src/main/jniLibs/x86_64/libkiwix/"
|
into buildDir.path + "/jniLibs/x86_64/libkiwix/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyLibkiwixLinux_x86_64(type: Copy) {
|
task copyLibkiwixLinux_x86_64(type: Copy) {
|
||||||
@ -285,5 +285,5 @@ task checkCurrentJavaVersion() {
|
|||||||
|
|
||||||
task generateHeaderFilesFromJavaWrapper(type: Exec) {
|
task generateHeaderFilesFromJavaWrapper(type: Exec) {
|
||||||
workingDir "${projectDir}/src/main/java/org/kiwix/"
|
workingDir "${projectDir}/src/main/java/org/kiwix/"
|
||||||
commandLine 'bash', '-c', "javac -h ${projectDir}/src/main/cpp/include/javah_generated/ -d ${projectDir}/src/androidTests/java/org/kiwix/kiwixlib/ kiwixlib/Book.java kiwixlib/DirectAccessInfo.java kiwixlib/Filter.java kiwixlib/JNIICU.java kiwixlib/JNIKiwixBool.java kiwixlib/JNIKiwixException.java kiwixlib/JNIKiwixInt.java kiwixlib/JNIKiwixReader.java kiwixlib/JNIKiwixSearcher.java kiwixlib/JNIKiwixServer.java kiwixlib/JNIKiwixString.java kiwixlib/Library.java kiwixlib/Manager.java"
|
commandLine 'bash', '-c', "javac -h ${buildDir}/include/javah_generated/ -d ${buildDir}/kiwixlib/ kiwixlib/Book.java kiwixlib/DirectAccessInfo.java kiwixlib/Filter.java kiwixlib/JNIICU.java kiwixlib/JNIKiwixBool.java kiwixlib/JNIKiwixException.java kiwixlib/JNIKiwixInt.java kiwixlib/JNIKiwixReader.java kiwixlib/JNIKiwixSearcher.java kiwixlib/JNIKiwixServer.java kiwixlib/JNIKiwixString.java kiwixlib/Library.java kiwixlib/Manager.java"
|
||||||
}
|
}
|
@ -6,4 +6,4 @@ dependencyResolutionManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootProject.name = "java-libkiwix"
|
rootProject.name = "java-libkiwix"
|
||||||
include ':src'
|
include 'lib'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user