diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 08a1e926b..78781c9d9 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -7,6 +7,8 @@ updates:
schedule:
interval: weekly
day: monday
+ time: "06:00"
+ timezone: Europe/London
target-branch: main
assignees:
- ascopes
@@ -19,6 +21,8 @@ updates:
schedule:
interval: weekly
day: monday
+ time: "06:00"
+ timezone: Europe/London
target-branch: main
assignees:
- ascopes
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c376e7ac9..3e850e7cf 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -4,9 +4,11 @@ on:
pull_request:
branches:
- main
+ - v*
push:
branches:
- main
+ - v*
workflow_call: {}
workflow_dispatch: {}
@@ -23,19 +25,34 @@ jobs:
- 11 # LTS
- 17 # LTS
- 21 # LTS
+ - GA # General access
+ include:
+ - os-name: windows-latest
+ java-version: GA
+ - os-name: macos-latest
+ java-version: GA
+
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- - name: Initialize JDK
+ - name: Initialize Zulu JDK
+ if: matrix.java-version != 'GA'
uses: actions/setup-java@v4
with:
check-latest: true
distribution: zulu
java-version: ${{ matrix.java-version }}
+ - name: Initialize Oracle JDK
+ if: matrix.java-version == 'GA'
+ uses: oracle-actions/setup-java@v1
+ with:
+ website: jdk.java.net
+ release: ${{ matrix.java-version }}
+
- name: Maven cache
uses: actions/cache@v4
env:
@@ -44,7 +61,7 @@ jobs:
path:
~/.m2
key: build-${{ env.cache-name }}
-
+
- name: Compile and run tests
shell: bash
run: ./mvnw -B -U clean verify
@@ -66,3 +83,22 @@ jobs:
**/failsafe-reports/**
**/build*.log
retention-days: 30
+
+ notify-coverage:
+ name: Notify of coverage
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ needs:
+ - build
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Publish code coverage
+ uses: codecov/codecov-action@v5
+ continue-on-error: true
+ if: always()
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ fail_ci_if_error: true
+ run_command: send-notifications
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index ece119b1c..17ab6bc1a 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -1,4 +1,4 @@
-name: Deploy a branch
+name: Release New Version
on:
workflow_dispatch:
@@ -8,14 +8,19 @@ on:
default: false
type: boolean
+ skip-tests:
+ description: "Skip unit and integration tests"
+ default: false
+ type: boolean
+
version:
description: "Override deployment version"
default: ""
type: string
jobs:
- maven-central:
- name: Deploy to Maven Central
+ release:
+ name: Release
environment:
name: maven-central
url: https://repo1.maven.org/maven2/io/github/ascopes/jct/java-compiler-testing/
@@ -35,26 +40,21 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
- # Must use >= JDK 17 for Javadocs to generate correctly
- java-version: 23
- server-id: ossrh
- server-username: OSSRH_USERNAME
- server-password: OSSRH_TOKEN
+ java-version: 21
+ server-id: central
+ server-username: CENTRAL_USERNAME
+ server-password: CENTRAL_TOKEN
gpg-passphrase: GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- - name: Deploy to staging
- shell: bash
+ - name: Configure Git
run: |-
git config user.name '${{ github.actor }}'
git config user.email '${{ github.actor }}@users.noreply.github.com'
- group_id="$(./mvnw help:evaluate -q -DforceStdout -Dexpression="project.groupId")"
- echo "group_id=${group_id}" >> "${GITHUB_ENV}"
-
- artifact_id="$(./mvnw help:evaluate -q -DforceStdout -Dexpression="project.artifactId")"
- echo "artifact_id=${artifact_id}" >> "${GITHUB_ENV}"
-
+ - name: Create Maven Central Release
+ shell: bash
+ run: |-
if [[ '${{ inputs.version }}' == "" ]]; then
release_version="$(./mvnw -B help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//g')"
else
@@ -65,39 +65,19 @@ jobs:
./mvnw -B -e \
-Preleases \
-DdryRun='${{ inputs.dry-run }}' \
+ -Dinvoker.skip='${{ inputs.skip-tests }}' \
-Dpassword='${{ secrets.GITHUB_TOKEN }}' \
-DreleaseVersion="${release_version}" \
-DsignTag=false \
+ -DskipTests='${{ inputs.skip-tests }}' \
-Dtag="v${release_version}" \
clean verify release:prepare release:perform
-
- echo "Created staging release for ${group_id}/${artifact_id}/${release_version}"
env:
- OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
- OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
+ CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
+ CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- - name: Promote Maven Central Staging Release
- if: ${{ ! inputs.dry-run }}
- shell: bash
- run: |-
- echo "Will now promote ${group_id}/${artifact_id}/${release_version} to Maven Central"
-
- ./scripts/close-nexus-repository.sh \
- -u "${OSSRH_USERNAME}" \
- -p "${OSSRH_TOKEN}" \
- -g "${group_id}" \
- -a "${artifact_id}" \
- -v "${release_version}" \
- -s "https://s01.oss.sonatype.org/"
-
- echo "Promoted staging ${group_id}/${artifact_id}/${release_version} to Maven Central successfully"
- env:
- OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
- OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
- GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
-
- - name: Abort and rollback staging release
+ - name: Revert Maven Central Release
if: ${{ failure() }}
run: |-
./mvnw -B -e \
@@ -105,10 +85,6 @@ jobs:
-DreleaseVersion="${release_version}" \
-Dtag="v${release_version}" \
release:rollback
- env:
- OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
- OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
- GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Create GitHub Release
if: ${{ ! inputs.dry-run }}
diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml
index 365c0097f..2b8493db8 100644
--- a/.github/workflows/security.yml
+++ b/.github/workflows/security.yml
@@ -3,6 +3,7 @@ on:
push:
branches:
- main
+ - v5
jobs:
submit-dependency-snapshot:
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index d58dfb70b..2f94e6169 100644
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -16,4 +16,4 @@
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip
diff --git a/README.md b/README.md
index 1b4213a87..0d1f35699 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
-
+
+
[](https://github.com/ascopes/java-compiler-testing/actions/workflows/build.yml)
[](https://repo1.maven.org/maven2/io/github/ascopes/jct/java-compiler-testing)
[](https://codecov.io/gh/ascopes/java-compiler-testing)
@@ -85,6 +86,12 @@ dependencies {
}
```
+For Java 11 support, you should use the v4.x version of this library. If you
+only need to build on Java 17 or newer, you should use the v5.x version of this
+library. This does not affect the versions of Java you can write tests to cross
+compile against, but affects the versions of various dependencies and the
+bytecode version of this library itself.
+
## JPMS
If your tests make use of JPMS (i.e. they have a `module-info.java` somewhere), then you will want
@@ -229,8 +236,9 @@ support, running the Lombok annotation processor over the input. This assumes th
JAR is already on the classpath for the JUnit test runner (e.g. is a test dependency in your
project).
-You will want to make sure you do not attempt to target anything older than Java 9 in this case, since
-module support was only introduced in Java 9.
+> [!IMPORTANT]
+> You will want to make sure you do not attempt to target anything older than Java 9 in this case, since
+> module support was only introduced in Java 9.
```java
@@ -330,9 +338,7 @@ holding the flags you wish to use.
`-XX:+TieredCompilation -XX:TieredStopAtLevel=1` to set this up. Enabling this in the JCT
builds reduced the overall build time by around 20 seconds.
2. Use the ZGC - the ZGC will reduce lag when performing garbage collection on code that
- has a high churn of objects. On Java 11, the ZGC is an experimental feature, which needs
- to be enabled with `-XX:+UnlockExperimentalOptions -XX:+UseZGC`. On Java 17, you just
- need to pass `-XX:+UseZGC` alone.
+ has a high churn of objects. You just need to pass `-XX:+UseZGC` alone.
## Third-party compiler support
diff --git a/SECURITY.md b/SECURITY.md
index 042e36811..325c23abd 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -7,8 +7,9 @@ significant impact. However, should an issue be identified, I
will strive to fix these issues as soon as possible.
Fixes will be released as a new version, built from the most
-recent `main` branch. Unless expressly requested, no attempt
-to backport changes will be made.
+recent `main` branch for Java 17, and from the v4 branch for
+Java 11 backwards compatibility. Unless expressly requested,
+no attempt to backport changes will be made.
Given this library is designed for use in test packs, the main
design assumption is that the software is being used by a
diff --git a/java-compiler-testing/pom.xml b/java-compiler-testing/pom.xml
index 9188b00c9..dd4a438a3 100644
--- a/java-compiler-testing/pom.xml
+++ b/java-compiler-testing/pom.xml
@@ -22,7 +22,7 @@
io.github.ascopes.jct
java-compiler-testing-parent
- 4.0.3
+ 4.1.2-SNAPSHOT
../pom.xml
diff --git a/java-compiler-testing/src/main/java/io/github/ascopes/jct/junit/AbstractCompilersProvider.java b/java-compiler-testing/src/main/java/io/github/ascopes/jct/junit/AbstractCompilersProvider.java
index b9df70e34..0c25c32e1 100644
--- a/java-compiler-testing/src/main/java/io/github/ascopes/jct/junit/AbstractCompilersProvider.java
+++ b/java-compiler-testing/src/main/java/io/github/ascopes/jct/junit/AbstractCompilersProvider.java
@@ -27,6 +27,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.stream.IntStream;
import java.util.stream.Stream;
+import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.ArgumentsProvider;
@@ -151,6 +152,7 @@ protected AbstractCompilersProvider() {
}
@Override
+ @SuppressWarnings("deprecation")
public Stream extends Arguments> provideArguments(ExtensionContext context) {
return IntStream
.rangeClosed(minVersion, maxVersion)
@@ -159,6 +161,18 @@ public Stream extends Arguments> provideArguments(ExtensionContext context) {
.map(Arguments::of);
}
+ // Do not @Override as this does not exist prior to JUnit 5.13.
+ // Use a generic Object for the ParameterDeclarations argument as that
+ // also does not exist prior to JUnit 5.13, and we do not want to trigger
+ // NoClassDefFoundExceptions on older versions of JUnit.
+ @SuppressWarnings("override")
+ public Stream extends Arguments> provideArguments(
+ @Nullable Object parameters,
+ ExtensionContext context
+ ) {
+ return provideArguments(context);
+ }
+
/**
* Configure this provider with parameters from annotations.
*
diff --git a/pom.xml b/pom.xml
index ac938b9fa..abb7ebffc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
io.github.ascopes.jct
java-compiler-testing-parent
- 4.0.3
+ 4.1.2-SNAPSHOT
pom
Java Compiler Testing parent project
@@ -57,15 +57,10 @@
- ossrh
- Maven Central Releases
- https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
+ central
+ Maven Central
+ https://central.sonatype.com
-
- ossrh
- Maven Central Snapshots
- https://s01.oss.sonatype.org/content/repositories/snapshots
-
@@ -89,41 +84,41 @@
https://github.com/ascopes/java-compiler-testing
scm:git:https://github.com/ascopes/java-compiler-testing
scm:git:https://github.com/ascopes/java-compiler-testing
- v4.0.3
+ vHEAD
- 3.27.2
- 4.2.2
+ 3.27.3
+ 4.3.0
1.4.0
1.0.0
- 5.11.4
+ 5.13.1
2.8.1
- 5.15.2
- 2.0.16
+ 5.18.0
+ 2.0.17
- 0.8.12
- 4.6
+ 0.7.0
+ 0.8.13
+ 5.0.0
3.6.0
- 3.13.0
- 3.1.3
- 3.5.2
+ 3.14.0
+ 3.1.4
+ 3.5.3
3.2.1
- 3.1.3
+ 3.1.4
3.4.2
3.11.2
3.9.0
3.0.0-M7
3.3.1
3.3.1
- 3.5.2
+ 3.5.3
- 10.21.1
+ 10.25.0
1.4.0
-
true
@@ -164,7 +159,7 @@
2025
- 23
+ 24
11.9.0
@@ -412,8 +407,7 @@
https://javadoc.io/doc/org.assertj/assertj-core/${assertj.version}
https://javadoc.io/doc/org.jspecify/jspecify/${jspecify.version}
https://javadoc.io/doc/org.slf4j/slf4j-api/${slf4j.version}
- https://javadoc.io/doc/org.junit.jupiter/junit-jupiter-api/${junit.version}
- https://javadoc.io/doc/org.junit.jupiter/junit-jupiter-params/${junit.version}
+ https://junit.org/junit5/docs/${junit.version}/api
true
${java-release}
@@ -676,6 +670,24 @@
+
+
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+ ${central-publishing-maven-plugin.version}
+ true
+
+ true
+ central
+ published
+
+