forked from igniterealtime/Smack
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump to Gradle 8.10.2, require Java 11
Bump Gradle from 6.8.3 to 8.10.2 and increase the minimum required Java version from 8 to 11 (SMACK-953). The switch from Java 8 to 11 caused some Bytecode portability issues regarding NIO Buffers. Java changed with version 9 the return type of some subclasses of Buffer to return the specific Buffer type instead of the Buffer superclass [JDK-4774077]. For example, ByteBuffer.filp() previously returned Buffer, while it does return ByteBuffer now. This sensible change was not reflected by the Android API [1], which means that AnimalSniffer rightfully started to complain that there is no method "ByteBuffer ByteBuffer.flip()" in Android, there is only "Buffer ByteBuffer.flip()", and those are incompatible methods on Java's Bytecode layer. As workaround, this changes return charBuffer.flip().toString(); to ((java.nio.Buffer) charBuffer).flip(); return charBuffer.toString(); to restore the Bytecode portability between Android and Java. Errorprone also got new checks, of which JavaUtilDate and JdkObsolete are wroth mentioning. JavaUtilData basically strongly recommends to use Java's newer time API over java.util.Date. But since Smack was Java 8 until now, j.u.Date is widely used. Similar JdkObsolete mentions obsolete JDK APIs, like data structures like Vector and Stack. But mostly LinkedList, which should usually be replaced by ArrayList. And this is what this commit largely does. JDK-4774077: https://bugs.openjdk.org/browse/JDK-4774077 1: https://issuetracker.google.com/issues/369219141
- Loading branch information
Showing
136 changed files
with
1,142 additions
and
1,212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
GRADLE ?= ./gradlew | ||
|
||
.PHONY: all | ||
all: check jacocoRootReport javadocAll sinttest | ||
|
||
.PHONY: codecov | ||
codecov: | ||
$(GRADLE) smack-java8-full:testCodeCoverageReport | ||
echo "Report available at smack-java8-full/build/reports/jacoco/testCodeCoverageReport/html/index.html" | ||
|
||
.PHONY: check | ||
check: | ||
$(GRADLE) $@ | ||
|
||
.PHONY: eclipse | ||
eclipse: | ||
$(GRADLE) $@ | ||
|
||
.PHONY: sinttest | ||
sinttest: | ||
$(GRADLE) $@ | ||
|
||
.PHONY: jacocoRootReport | ||
jacocoRootReport: | ||
$(GRADLE) $@ | ||
|
||
.PHONY: javadocAll | ||
javadocAll: | ||
$(GRADLE) $@ | ||
echo "Smack javadoc available at build/javadoc/index.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
plugins { | ||
id 'groovy-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation "biz.aQute.bnd:biz.aQute.bnd.gradle:7.0.0" | ||
implementation "io.freefair.gradle:maven-plugin:8.10" // for io.freefair.agregate-javadoc | ||
implementation "me.champeau.jmh:jmh-gradle-plugin:0.7.2" | ||
implementation "net.ltgt.gradle:gradle-errorprone-plugin:4.0.1" | ||
implementation "gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.2" | ||
implementation "ru.vyarus:gradle-animalsniffer-plugin:1.7.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'smack-build-logic' |
6 changes: 6 additions & 0 deletions
6
...-logic/src/main/groovy/org.igniterealtime.smack.android-boot-classpath-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
compileJava { | ||
options.bootstrapClasspath = files(androidBootClasspath) | ||
} | ||
javadoc { | ||
classpath += files(androidBootClasspath) | ||
} |
10 changes: 10 additions & 0 deletions
10
build-logic/src/main/groovy/org.igniterealtime.smack.android-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
plugins { | ||
id 'ru.vyarus.animalsniffer' | ||
id 'org.igniterealtime.smack.global-conventions' | ||
} | ||
dependencies { | ||
signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:5.0.1_r2@signature" | ||
} | ||
animalsniffer { | ||
sourceSets = [sourceSets.main] | ||
} |
12 changes: 12 additions & 0 deletions
12
build-logic/src/main/groovy/org.igniterealtime.smack.application-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
plugins { | ||
id 'application' | ||
} | ||
|
||
application { | ||
applicationDefaultJvmArgs = ["-enableassertions"] | ||
} | ||
|
||
run { | ||
// Pass all system properties down to the "application" run | ||
systemProperties System.getProperties() | ||
} |
37 changes: 37 additions & 0 deletions
37
build-logic/src/main/groovy/org.igniterealtime.smack.global-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
ext { | ||
javaVersion = JavaVersion.VERSION_11 | ||
javaMajor = javaVersion.getMajorVersion() | ||
smackMinAndroidSdk = 21 | ||
|
||
androidBootClasspath = { getAndroidRuntimeJar() } | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
def getAndroidRuntimeJar() { | ||
def androidApiLevel = ext.smackMinAndroidSdk | ||
def androidHome = getAndroidHome() | ||
def androidJar = new File("$androidHome/platforms/android-${androidApiLevel}/android.jar") | ||
if (androidJar.isFile()) { | ||
return androidJar | ||
} else { | ||
throw new Exception("Can't find android.jar for API level ${androidApiLevel}. Please install corresponding SDK platform package") | ||
} | ||
} | ||
def getAndroidJavadocOffline() { | ||
def androidHome = getAndroidHome() | ||
return androidHome.toString() + "/docs/reference" | ||
} | ||
|
||
def getAndroidHome() { | ||
def androidHomeEnv = System.getenv("ANDROID_HOME") | ||
if (androidHomeEnv == null) { | ||
throw new Exception("ANDROID_HOME environment variable is not set") | ||
} | ||
def androidHome = new File(androidHomeEnv) | ||
if (!androidHome.isDirectory()) throw new Exception("Environment variable ANDROID_HOME is not pointing to a directory") | ||
return androidHome | ||
} |
Oops, something went wrong.