Compare commits

...

9 commits

10 changed files with 100 additions and 81 deletions

View file

@ -1,29 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: SOP-Java
Upstream-Contact: Paul Schaub <info@pgpainless.org>
Source: https://pgpainless.org
# Sample paragraph, commented out:
#
# Files: src/*
# Copyright: $YEAR $NAME <$CONTACT>
# License: ...
# Gradle build tool
Files: gradle*
Copyright: 2015 the original author or authors.
License: Apache-2.0
# Woodpecker build files
Files: .woodpecker/*
Copyright: 2022 the original author or authors.
License: Apache-2.0
Files: external-sop/src/main/resources/sop/testsuite/external/*
Copyright: 2023 the original author or authors
License: Apache-2.0
# Github Issue Templates
Files: .github/ISSUE_TEMPLATE/*
Copyright: 2024 the original author or authors
License: Apache-2.0

View file

@ -6,9 +6,12 @@ SPDX-License-Identifier: Apache-2.0
# Changelog # Changelog
## 10.1.1-SNAPSHOT ## 10.1.1
- Prepare jar files for use in native images, e.g. using GraalVM by generating and including - Prepare jar files for use in native images, e.g. using GraalVM by generating and including
configuration files for reflection, resources and dynamic proxies. configuration files for reflection, resources and dynamic proxies.
- gradle: Make use of jvmToolchain functionality
- gradle: Improve reproducibility
- gradle: Bump animalsniffer to `2.0.0`
## 10.1.0 ## 10.1.0
- `sop-java`: - `sop-java`:

32
REUSE.toml Normal file
View file

@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
#
# SPDX-License-Identifier: Apache-2.0
version = 1
SPDX-PackageName = "SOP-Java"
SPDX-PackageSupplier = "Paul Schaub <info@pgpainless.org>"
SPDX-PackageDownloadLocation = "https://pgpainless.org"
[[annotations]]
path = "gradle**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2015 the original author or authors."
SPDX-License-Identifier = "Apache-2.0"
[[annotations]]
path = ".woodpecker/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2022 the original author or authors."
SPDX-License-Identifier = "Apache-2.0"
[[annotations]]
path = "external-sop/src/main/resources/sop/testsuite/external/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2023 the original author or authors"
SPDX-License-Identifier = "Apache-2.0"
[[annotations]]
path = ".github/ISSUE_TEMPLATE/**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2024 the original author or authors"
SPDX-License-Identifier = "Apache-2.0"

View file

@ -18,7 +18,7 @@ buildscript {
} }
plugins { plugins {
id 'ru.vyarus.animalsniffer' version '1.5.3' id 'ru.vyarus.animalsniffer' version '2.0.0'
id 'org.jetbrains.kotlin.jvm' version "1.9.21" id 'org.jetbrains.kotlin.jvm' version "1.9.21"
id 'com.diffplug.spotless' version '6.22.0' apply false id 'com.diffplug.spotless' version '6.22.0' apply false
} }
@ -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()
} }
@ -78,6 +76,13 @@ allprojects {
tasks.withType(AbstractArchiveTask) { tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false preserveFileTimestamps = false
reproducibleFileOrder = true reproducibleFileOrder = true
dirMode = 0755
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.
@ -112,7 +117,7 @@ allprojects {
} }
jacoco { jacoco {
toolVersion = "0.8.7" toolVersion = "0.8.8"
} }
jacocoTestReport { jacocoTestReport {
@ -120,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
} }
} }
@ -138,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
} }
@ -243,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
@ -254,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

@ -0,0 +1,18 @@
// SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.testsuite;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface AbortOnUnsupportedOption {
}

View file

@ -0,0 +1,26 @@
// SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.testsuite;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler;
import sop.exception.SOPGPException;
import java.lang.annotation.Annotation;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class AbortOnUnsupportedOptionExtension implements TestExecutionExceptionHandler {
@Override
public void handleTestExecutionException(ExtensionContext extensionContext, Throwable throwable) throws Throwable {
Class<?> testClass = extensionContext.getRequiredTestClass();
Annotation annotation = testClass.getAnnotation(AbortOnUnsupportedOption.class);
if (annotation != null && throwable instanceof SOPGPException.UnsupportedOption) {
assumeTrue(false, "Test aborted due to: " + throwable.getMessage());
}
throw throwable;
}
}

View file

@ -1,12 +0,0 @@
// SPDX-FileCopyrightText: 2024 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.testsuite
import java.lang.annotation.Inherited
@Target(AnnotationTarget.TYPE)
@Retention(AnnotationRetention.RUNTIME)
@Inherited
annotation class AbortOnUnsupportedOption

View file

@ -1,21 +0,0 @@
// SPDX-FileCopyrightText: 2024 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop.testsuite
import org.junit.jupiter.api.Assumptions
import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler
import sop.exception.SOPGPException
class AbortOnUnsupportedOptionExtension : TestExecutionExceptionHandler {
override fun handleTestExecutionException(context: ExtensionContext, throwable: Throwable) {
val testClass = context.requiredTestClass
val annotation = testClass.getAnnotation(AbortOnUnsupportedOption::class.java)
if (annotation != null && SOPGPException.UnsupportedOption::class.isInstance(throwable)) {
Assumptions.assumeTrue(false, "Test aborted due to: " + throwable.message)
}
throw throwable
}
}

View file

@ -9,9 +9,10 @@ package sop
* *
* @param micAlg string identifying the digest mechanism used to create the signed message. This is * @param micAlg string identifying the digest mechanism used to create the signed message. This is
* useful for setting the `micalg=` parameter for the multipart/signed content-type of a PGP/MIME * useful for setting the `micalg=` parameter for the multipart/signed content-type of a PGP/MIME
* object as described in section 5 of [RFC3156](https://www.rfc-editor.org/rfc/rfc3156#section-5). * object as described in section 5 of
* If more than one signature was generated and different digest mechanisms were used, the value * [RFC3156](https://www.rfc-editor.org/rfc/rfc3156#section-5). If more than one signature was
* of the micalg object is an empty string. * generated and different digest mechanisms were used, the value of the micalg object is an empty
* string.
*/ */
data class SigningResult(val micAlg: MicAlg) { data class SigningResult(val micAlg: MicAlg) {

View file

@ -4,10 +4,10 @@
allprojects { allprojects {
ext { ext {
shortVersion = '10.1.1' shortVersion = '10.1.2'
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'