From b49435da995bd8d6338542928ca9f6a1250df027 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sat, 27 Sep 2025 12:38:59 +0200 Subject: [PATCH] Upgrade build system --- .woodpecker/.build.yml | 12 +++-- .woodpecker/.reuse.yml | 4 +- build.gradle | 57 ++++++++++++++---------- gradle/wrapper/gradle-wrapper.properties | 2 +- version.gradle | 6 +-- 5 files changed, 48 insertions(+), 33 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index f504b44..b58cfaa 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -1,6 +1,8 @@ -pipeline: - run: - image: gradle:7.5-jdk8 +steps: + build: + when: + branch: main + image: gradle:8.8-jdk11 commands: - git checkout $CI_COMMIT_BRANCH # Code works @@ -9,4 +11,6 @@ pipeline: - gradle check javadocAll # Code has coverage - gradle jacocoRootReport coveralls - secrets: [COVERALLS_REPO_TOKEN] + environment: + COVERALLS_REPO_TOKEN: + from_secret: COVERALLS_REPO_TOKEN diff --git a/.woodpecker/.reuse.yml b/.woodpecker/.reuse.yml index 58f17e6..7eb6ab9 100644 --- a/.woodpecker/.reuse.yml +++ b/.woodpecker/.reuse.yml @@ -1,7 +1,9 @@ # Code is licensed properly # See https://reuse.software/ -pipeline: +steps: reuse: + when: + branch: main image: fsfe/reuse:latest commands: - reuse lint \ No newline at end of file diff --git a/build.gradle b/build.gradle index 7f14422..bca2ae4 100644 --- a/build.gradle +++ b/build.gradle @@ -12,12 +12,15 @@ buildscript { mavenLocal() mavenCentral() } + + dependencies { + classpath "gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.0" + } } plugins { - id("com.github.nbaztec.coveralls-jacoco") version "1.2.16" - id 'org.jetbrains.kotlin.jvm' version "1.8.10" - id 'jacoco-report-aggregation' + id 'org.jetbrains.kotlin.jvm' version "1.9.21" + id 'com.diffplug.spotless' version '6.22.0' apply false } apply from: 'version.gradle' @@ -27,8 +30,8 @@ allprojects { apply plugin: 'idea' apply plugin: 'eclipse' apply plugin: 'jacoco' - apply plugin: 'checkstyle' apply plugin: 'kotlin' + apply plugin: 'com.diffplug.spotless' // Only generate jar for submodules // https://stackoverflow.com/a/25445035 @@ -36,17 +39,16 @@ allprojects { onlyIf { !sourceSets.main.allSource.files.isEmpty() } } - // checkstyle - checkstyle { - toolVersion = '10.12.1' + spotless { + kotlin { + ktfmt().dropboxStyle() + } } group 'org.pgpainless' description = "Client-Side Implementation of the OpenPGP HTTP Keyserver Protocol for Java" version = shortVersion - sourceCompatibility = javaSourceCompatibility - repositories { mavenCentral() } @@ -60,6 +62,17 @@ allprojects { fileMode = 0644 } + kotlin { + jvmToolchain(javaSourceCompatibility) + } + + // Compatibility of default implementations in kotlin interfaces with Java implementations. + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + kotlinOptions { + freeCompilerArgs += ["-Xjvm-default=all-compatibility"] + } + } + project.ext { rootConfigDir = new File(rootDir, 'config') gitCommit = getGitCommit() @@ -67,8 +80,7 @@ allprojects { isReleaseVersion = !isSnapshot signingRequired = !(isSnapshot || isContinuousIntegrationEnvironment) sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword') - sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots' - sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2' + sonatypeStagingUrl = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/' } if (isSnapshot) { @@ -85,7 +97,7 @@ allprojects { } jacoco { - toolVersion = "0.8.8" + toolVersion = "0.8.13" } jacocoTestReport { @@ -93,7 +105,7 @@ allprojects { sourceDirectories.setFrom(project.files(sourceSets.main.allSource.srcDirs)) classDirectories.setFrom(project.files(sourceSets.main.output)) reports { - xml.enabled true + xml.required = true } } @@ -111,15 +123,15 @@ subprojects { apply plugin: 'signing' task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from javadoc.destinationDir } task testsJar(type: Jar, dependsOn: testClasses) { - classifier = 'tests' + archiveClassifier = 'tests' from sourceSets.test.output } @@ -163,7 +175,7 @@ subprojects { repositories { if (sonatypeCredentialsAvailable) { maven { - url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl + url sonatypeStagingUrl credentials { username = sonatypeUsername password = sonatypePassword @@ -205,8 +217,9 @@ def getGitCommit() { gitCommit } -coverallsJacoco { - reportPath = "build/reports/jacoco/test/jacocoTestReport.xml" +apply plugin: "com.github.kt3k.coveralls" +coveralls { + sourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs).files.absolutePath } task jacocoRootReport(type: JacocoReport) { @@ -215,7 +228,7 @@ task jacocoRootReport(type: JacocoReport) { classDirectories.setFrom(files(subprojects.sourceSets.main.output)) executionData.setFrom(files(subprojects.jacocoTestReport.executionData)) reports { - xml.enabled true + xml.required = true xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml") } // We could remove the following setOnlyIf line, but then @@ -226,10 +239,6 @@ task jacocoRootReport(type: JacocoReport) { } task javadocAll(type: Javadoc) { - def currentJavaVersion = JavaVersion.current() - if (currentJavaVersion.compareTo(JavaVersion.VERSION_1_9) >= 0) { - options.addStringOption("-release", "8"); - } source subprojects.collect {project -> project.sourceSets.main.allJava } destinationDir = new File(buildDir, 'javadoc') diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661..0d18421 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/version.gradle b/version.gradle index 9564ed1..ef6412f 100644 --- a/version.gradle +++ b/version.gradle @@ -6,12 +6,12 @@ allprojects { ext { shortVersion = '0.0.1' isSnapshot = true - javaSourceCompatibility = 1.8 - bouncycastleVersion = '1.77' + javaSourceCompatibility = 11 + bouncycastleVersion = '1.82' junitVersion = '5.8.2' jsrVersion = '3.0.2' slf4jVersion = '1.7.36' - logbackVersion = '1.2.13' + logbackVersion = '1.5.13' picocliVersion = '4.6.3' jacksonDataBindVersion = '2.15.2' }