Make use of toolchain functionality and raise min Java API level to 11

This commit is contained in:
Paul Schaub 2025-04-14 11:01:45 +02:00
parent 2c26ab2da5
commit 8394f2e5a8
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 11 additions and 13 deletions

View file

@ -68,8 +68,6 @@ allprojects {
description = "Stateless OpenPGP Protocol API for Java" description = "Stateless OpenPGP Protocol API for Java"
version = shortVersion version = shortVersion
sourceCompatibility = javaSourceCompatibility
repositories { repositories {
mavenCentral() mavenCentral()
} }
@ -83,6 +81,10 @@ allprojects {
fileMode = 0644 fileMode = 0644
} }
kotlin {
jvmToolchain(javaSourceCompatibility)
}
// Compatibility of default implementations in kotlin interfaces with Java implementations. // Compatibility of default implementations in kotlin interfaces with Java implementations.
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions { kotlinOptions {
@ -115,7 +117,7 @@ allprojects {
} }
jacoco { jacoco {
toolVersion = "0.8.7" toolVersion = "0.8.8"
} }
jacocoTestReport { jacocoTestReport {
@ -123,7 +125,7 @@ allprojects {
sourceDirectories.setFrom(project.files(sourceSets.main.allSource.srcDirs)) sourceDirectories.setFrom(project.files(sourceSets.main.allSource.srcDirs))
classDirectories.setFrom(project.files(sourceSets.main.output)) classDirectories.setFrom(project.files(sourceSets.main.output))
reports { reports {
xml.enabled true xml.required = true
} }
} }
@ -141,15 +143,15 @@ subprojects {
apply plugin: 'signing' apply plugin: 'signing'
task sourcesJar(type: Jar, dependsOn: classes) { task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources' archiveClassifier = 'sources'
from sourceSets.main.allSource from sourceSets.main.allSource
} }
task javadocJar(type: Jar, dependsOn: javadoc) { task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc' archiveClassifier = 'javadoc'
from javadoc.destinationDir from javadoc.destinationDir
} }
task testsJar(type: Jar, dependsOn: testClasses) { task testsJar(type: Jar, dependsOn: testClasses) {
classifier = 'tests' archiveClassifier = 'tests'
from sourceSets.test.output from sourceSets.test.output
} }
@ -246,7 +248,7 @@ task jacocoRootReport(type: JacocoReport) {
classDirectories.setFrom(files(subprojects.sourceSets.main.output)) classDirectories.setFrom(files(subprojects.sourceSets.main.output))
executionData.setFrom(files(subprojects.jacocoTestReport.executionData)) executionData.setFrom(files(subprojects.jacocoTestReport.executionData))
reports { reports {
xml.enabled true xml.required = true
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml") xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
} }
// We could remove the following setOnlyIf line, but then // We could remove the following setOnlyIf line, but then
@ -257,10 +259,6 @@ task jacocoRootReport(type: JacocoReport) {
} }
task javadocAll(type: Javadoc) { task javadocAll(type: Javadoc) {
def currentJavaVersion = JavaVersion.current()
if (currentJavaVersion.compareTo(JavaVersion.VERSION_1_9) >= 0) {
options.addStringOption("-release", "8");
}
source subprojects.collect {project -> source subprojects.collect {project ->
project.sourceSets.main.allJava } project.sourceSets.main.allJava }
destinationDir = new File(buildDir, 'javadoc') destinationDir = new File(buildDir, 'javadoc')

View file

@ -7,7 +7,7 @@ allprojects {
shortVersion = '10.1.1' shortVersion = '10.1.1'
isSnapshot = true isSnapshot = true
minAndroidSdk = 10 minAndroidSdk = 10
javaSourceCompatibility = 1.8 javaSourceCompatibility = 11
gsonVersion = '2.10.1' gsonVersion = '2.10.1'
jsrVersion = '3.0.2' jsrVersion = '3.0.2'
junitVersion = '5.8.2' junitVersion = '5.8.2'