mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 05:22:06 +01:00
1e5d34eacf
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
73 lines
2.2 KiB
Groovy
73 lines
2.2 KiB
Groovy
plugins {
|
|
id 'org.igniterealtime.smack.java-common-conventions'
|
|
id 'org.igniterealtime.smack.android-conventions'
|
|
}
|
|
|
|
description = """\
|
|
Smack core components."""
|
|
|
|
ext {
|
|
xmlUnitVersion = '2.6.2'
|
|
}
|
|
|
|
dependencies {
|
|
api project(':smack-xmlparser')
|
|
api "org.jxmpp:jxmpp-core:$jxmppVersion"
|
|
api "org.jxmpp:jxmpp-jid:$jxmppVersion"
|
|
api "org.minidns:minidns-core:$miniDnsVersion"
|
|
|
|
// TODO: Migrate Junit4 tests to Junit5.
|
|
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
|
|
|
testFixturesImplementation project(':smack-xmlparser-stax')
|
|
testFixturesImplementation project(':smack-xmlparser-xpp3')
|
|
|
|
// Bouncy Castle is setup by SmackTestSuite. We deliberately use
|
|
// 'implementation' here since there is no need to shadow it
|
|
// outside of the fixtures compilation classpath. That is, no test
|
|
// should ever setup Bouncy Castle as security provider explicitly.
|
|
testFixturesImplementation "org.bouncycastle:bcprov-jdk18on:${bouncyCastleVersion}"
|
|
testFixturesImplementation 'org.apache.commons:commons-lang3:3.10'
|
|
|
|
testFixturesApi "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
|
|
testFixturesApi "org.xmlunit:xmlunit-core:$xmlUnitVersion"
|
|
// Explicitly add assertj-core which is a dependency of
|
|
// xmlunit-assertj, but gradle fails to resolves it with:
|
|
// Execution failed for task ':smack-core:compileTestJava'.
|
|
// > Could not resolve all files for configuration ':smack-core:testCompileClasspath'.
|
|
// > Could not find org.assertj:assertj-core:.
|
|
// Required by:
|
|
// project :smack-core > org.xmlunit:xmlunit-assertj:2.6.2
|
|
testFixturesApi "org.assertj:assertj-core:3.11.1"
|
|
testFixturesApi "org.xmlunit:xmlunit-assertj:$xmlUnitVersion"
|
|
testFixturesApi 'org.hamcrest:hamcrest-library:2.2'
|
|
testFixturesApi "com.google.guava:guava:${guavaVersion}"
|
|
}
|
|
|
|
class CreateFileTask extends DefaultTask {
|
|
@Input
|
|
String fileContent
|
|
|
|
@OutputFile
|
|
File outputFile
|
|
|
|
@TaskAction
|
|
def createFile() {
|
|
outputFile.text = fileContent
|
|
}
|
|
}
|
|
|
|
task createVersionResource(type: CreateFileTask) {
|
|
fileContent = version + ' (' + gitCommit + ' ' + builtDate + ')'
|
|
outputFile = new File(projectDir, 'src/main/resources/org.jivesoftware.smack/version')
|
|
}
|
|
|
|
processResources.dependsOn(createVersionResource)
|
|
|
|
jar {
|
|
bundle {
|
|
bnd(
|
|
'DynamicImport-Package': '*',
|
|
)
|
|
}
|
|
}
|