Skip to content

Commit 7fc2c1a

Browse files
authored
Merge pull request #97 from kiwix/Fix#90
Added support for SDK 34.
2 parents 40f17fd + ad78cf2 commit 7fc2c1a

File tree

6 files changed

+46
-39
lines changed

6 files changed

+46
-39
lines changed

Diff for: .github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
- name: Checkout code
1616
uses: actions/checkout@v4
1717

18-
- name: Set up JDK 11
18+
- name: Set up JDK 17
1919
uses: actions/setup-java@v4
2020
with:
2121
distribution: adopt
22-
java-version: 11
22+
java-version: 17
2323

2424
- name: Install dependencies
2525
run: bash ./install_deps.sh

Diff for: build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ buildscript {
66
maven { url 'https://plugins.gradle.org/m2/' }
77
}
88
dependencies {
9-
classpath "com.android.tools.build:gradle:7.0.1"
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
11-
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
9+
classpath 'com.android.tools.build:gradle:8.1.3'
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
11+
classpath 'io.github.gradle-nexus:publish-plugin:2.0.0'
1212
classpath 'de.undercouch:gradle-download-task:5.3.0'
1313
// NOTE: Do not place your application dependencies here; they belong
1414
// in the individual module build.gradle.kts files
@@ -17,7 +17,7 @@ buildscript {
1717

1818
apply plugin: 'io.github.gradle-nexus.publish-plugin'
1919

20-
task clean(type: Delete) {
20+
tasks.register('clean', Delete) {
2121
delete rootProject.buildDir
2222
}
2323

Diff for: gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Fri Aug 12 19:44:15 IST 2022
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

Diff for: lib/build.gradle

+37-27
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ ext.libzim_version = "9.2.1"
2828

2929
apply from: 'publish.gradle'
3030
android {
31-
compileSdk 32
32-
31+
compileSdk 34
32+
namespace = "kiwix.org.kiwixlib"
3333
defaultConfig {
3434

35-
minSdk 21
36-
targetSdk 32
35+
minSdk 24
36+
targetSdk 34
3737
versionCode 1
3838
versionName "1.0"
3939

@@ -69,6 +69,14 @@ android {
6969
viewBinding true
7070
}
7171
ndkVersion '21.4.7075529'
72+
73+
// Enabled the lint to avoid potential errors.
74+
lintOptions {
75+
abortOnError true
76+
checkAllWarnings = true
77+
warningsAsErrors true
78+
disable("GradleDependency", "UnknownNullness")
79+
}
7280
}
7381

7482
dependencies {
@@ -79,7 +87,7 @@ dependencies {
7987
ext.libkiwix_base_url = 'https://download.kiwix.org/release/libkiwix/'
8088
ext.libzim_base_url = 'https://download.openzim.org/release/libzim/'
8189

82-
task downloadLibzimSoAndHeaderFiles(type: Download) {
90+
tasks.register('downloadLibzimSoAndHeaderFiles', Download) {
8391
src([
8492
libzim_base_url + 'libzim_android-arm-' + libzim_version + '.tar.gz',
8593
libzim_base_url + 'libzim_android-arm64-' + libzim_version + '.tar.gz',
@@ -91,7 +99,8 @@ task downloadLibzimSoAndHeaderFiles(type: Download) {
9199
overwrite true
92100
}
93101

94-
task unzipLibzim(type: Copy) {
102+
tasks.register('unzipLibzim', Copy) {
103+
mustRunAfter downloadLibzimSoAndHeaderFiles
95104
// unzip android arm
96105
from tarTree(buildDir.path + "/libzim_android-arm-" + libzim_version + ".tar.gz")
97106
into buildDir
@@ -109,11 +118,11 @@ task unzipLibzim(type: Copy) {
109118
into buildDir
110119
}
111120

112-
task renameLibzimFolders() {
121+
tasks.register('renameLibzimFolders') {
113122
removeVersionFromFolderName(buildDir.path, "libzim_", libzim_version)
114123
}
115124

116-
task copyLibzimHeaderAndSoFiles(type: Copy) {
125+
tasks.register('copyLibzimHeaderAndSoFiles', Copy) {
117126
copy {
118127
// copying header file
119128
from buildDir.path + "/libzim_android-arm/include/"
@@ -151,7 +160,7 @@ task copyLibzimHeaderAndSoFiles(type: Copy) {
151160
}
152161
}
153162

154-
task renameLibzimSoFile(type: Copy) {
163+
tasks.register('renameLibzimSoFile', Copy) {
155164
if (libzim_version != null) {
156165
def finalLibzimVersion = getActualLibraryVersion(libzim_version)
157166

@@ -167,7 +176,7 @@ task renameLibzimSoFile(type: Copy) {
167176
}
168177
}
169178

170-
task downloadLibkiwixSoAndHeaderFiles(type: Download) {
179+
tasks.register('downloadLibkiwixSoAndHeaderFiles', Download) {
171180
src([
172181
libkiwix_base_url + 'libkiwix_android-arm-' + libkiwix_version + '.tar.gz',
173182
libkiwix_base_url + 'libkiwix_android-arm64-' + libkiwix_version + '.tar.gz',
@@ -179,7 +188,7 @@ task downloadLibkiwixSoAndHeaderFiles(type: Download) {
179188
overwrite true
180189
}
181190

182-
task renameLibkiwixFolders() {
191+
tasks.register('renameLibkiwixFolders') {
183192
removeVersionFromFolderName(buildDir.path, "libkiwix_", libkiwix_version)
184193
}
185194

@@ -196,7 +205,8 @@ static void removeVersionFromFolderName(String path, String startWith, String ve
196205
}
197206
}
198207

199-
task unzipLibkiwix(type: Copy) {
208+
tasks.register('unzipLibkiwix', Copy) {
209+
mustRunAfter downloadLibkiwixSoAndHeaderFiles
200210
// unzip android arm
201211
from tarTree(buildDir.path + "/libkiwix_android-arm-" + libkiwix_version + ".tar.gz")
202212
into buildDir
@@ -214,7 +224,7 @@ task unzipLibkiwix(type: Copy) {
214224
into buildDir
215225
}
216226

217-
task copyLibkiwixHeaderAndSoFiles(type: Copy) {
227+
tasks.register('copyLibkiwixHeaderAndSoFiles', Copy) {
218228
copy {
219229
// copying header file
220230
from buildDir.path + "/libkiwix_android-arm/include/kiwix/"
@@ -252,7 +262,7 @@ task copyLibkiwixHeaderAndSoFiles(type: Copy) {
252262
}
253263
}
254264

255-
task renameLibkiwixSoFile(type: Copy) {
265+
tasks.register('renameLibkiwixSoFile', Copy) {
256266
if (libkiwix_version != null) {
257267
def finalLibkiwixVersion = getActualLibraryVersion(libkiwix_version)
258268
def sourceFile = file(buildDir.path + "/libkiwix.so." + finalLibkiwixVersion)
@@ -277,50 +287,50 @@ static String getActualLibraryVersion(String libraryVersion) {
277287
return dashIndex != -1 ? libraryVersion.substring(0, dashIndex) : libraryVersion
278288
}
279289

280-
task testSourceJar(type: Jar) {
290+
tasks.register('testSourceJar', Jar) {
281291
from android.sourceSets.test.java.srcDirs
282-
archiveName = 'test-sources.jar'
292+
archiveBaseName = 'test-sources'
283293
}
284294

285-
task compileTestFile(type: JavaCompile) {
295+
tasks.register('compileTestFile', JavaCompile) {
286296
dependsOn testSourceJar
287297
source = file('src/test')
288298
destinationDirectory = file("$buildDir")
289-
classpath = files("src/test/junit-4.13.jar" , "src/test/hamcrest-core-1.4.jar", "build/libs/test-sources.jar")
299+
classpath = files("src/test/junit-4.13.jar", "src/test/hamcrest-core-1.4.jar", "build/libs/test-sources-${VERSION}.jar")
290300
}
291301

292-
task runTests(type: JavaExec) {
302+
tasks.register('runTests', JavaExec) {
293303
workingDir("$projectDir/src/test/")
294304
dependsOn compileTestFile
295305
classpath = files("$buildDir", 'src/test/java/', 'src/test/junit-4.13.jar', 'src/test/hamcrest-core-1.3.jar')
296-
main = 'org.junit.runner.JUnitCore'
306+
mainClass = 'org.junit.runner.JUnitCore'
297307
args = ['test']
298308
jvmArgs = [
299309
'-Djava.library.path=' + buildDir.path,
300310
'-javaagent:jacoco-0.8.7/lib/jacocoagent.jar=destfile=../../build/jacoco/jacoco.exec'
301311
]
302312
}
303313

304-
task createCodeCoverageReport(type: JavaExec) {
314+
tasks.register('createCodeCoverageReport', JavaExec) {
305315
workingDir "${projectDir}/src/test/"
306316
dependsOn runTests
307317
classpath = files('src/test/', 'src/test/java/', 'src/test/junit-4.13.jar', 'src/test/hamcrest-core-1.3.jar', 'src/test/jacoco-0.8.7/lib/*')
308-
main = 'org.jacoco.cli.internal.Main'
318+
mainClass = 'org.jacoco.cli.internal.Main'
309319
args = [
310320
'report', '../../build/jacoco/jacoco.exec',
311321
'--classfiles', 'java/org/kiwix', '--classfiles', '../../build/org/kiwix',
312322
'--html', '../../build/coverage-report', '--xml', '../../build/coverage.xml'
313323
]
314324
}
315325

316-
task checkCurrentJavaVersion() {
317-
if (JavaVersion.current() != JavaVersion.VERSION_11) {
318-
throw new RuntimeException("This build must be run with java 11. your current java version is ${JavaVersion.current()}")
326+
tasks.register('checkCurrentJavaVersion') {
327+
if (JavaVersion.current() != JavaVersion.VERSION_17) {
328+
throw new RuntimeException("This build must be run with java 17. your current java version is ${JavaVersion.current()}")
319329
}
320330
}
321331

322332

323-
task buildHeaders(type: Exec) {
333+
tasks.register('buildHeaders', Exec) {
324334
workingDir "${projectDir}/src/main/java/org/kiwix/"
325335
commandLine 'bash', '-c', "javac -h ${buildDir}/include/javah_generated/ -d ${projectDir}/src/test/java/ ${getLibzimFiles()} ${getLibkiwixFiles()}"
326336
}
@@ -358,7 +368,7 @@ String getLibzimFiles() {
358368
"${projectDir}/src/main/java/org/kiwix/libzim/FdInput.java"
359369
}
360370

361-
task buildLinuxBinding(type: Exec) {
371+
tasks.register('buildLinuxBinding', Exec) {
362372
workingDir "${projectDir}/src/main/cpp/"
363373
commandLine 'bash', '-c', "cmake . -B ${buildDir} && make -C ${buildDir}"
364374
}

Diff for: lib/publish.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apply plugin: 'maven-publish'
22
apply plugin: 'signing'
33

4-
task androidSourcesJar(type: Jar) {
4+
tasks.register('androidSourcesJar', Jar) {
55
archiveClassifier.set('sources')
66
if (project.plugins.findPlugin("com.android.library")) {
77
// For Android libraries

Diff for: lib/src/main/AndroidManifest.xml

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
3-
package="kiwix.org.kiwixlib"
4-
>
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
52

63
<application android:allowBackup="true"
74
android:label="@string/app_name"

0 commit comments

Comments
 (0)