Skip to content

Add testTargetJavaVersion build parameter - #1332

Open
b-pm wants to merge 1 commit into
sigstore:mainfrom
b-pm:fix/1276-test-target-java-version
Open

b-pm wants to merge 1 commit into
sigstore:mainfrom
b-pm:fix/1276-test-target-java-version

Conversation

@b-pm

@b-pm b-pm commented Oct 28, 2026

Copy link
Copy Markdown

Fixes #1276

Summary

Adds a testTargetJavaVersion build-parameters property (default 17) so test bytecode --release is configurable the same way targetJavaVersion is for main sources.

  • build-logic/build-parameters: new testTargetJavaVersion (default 17, mandatory)
  • build-logic.java.gradle.kts: compileTestJava uses buildParameters.testTargetJavaVersion instead of a hardcoded 17
  • ToolchainProperties.kt: Gradle check that testTargetJavaVersion >= 17 and that the resolved test JDK is at least that value
  • DEVELOPMENT.md: example -PtestTargetJavaVersion=21

Verify

./gradlew parameters   # lists testTargetJavaVersion
./gradlew compileTestJava
./gradlew compileTestJava -PtestTargetJavaVersion=21
# expected failure (below floor):
./gradlew help -PtestTargetJavaVersion=11

AI disclosure

This PR was prepared with AI assistance (coding agent). I reviewed the change and can explain it. I will answer any maintainer questions myself.

DCO

I will add my Signed-off-by via git commit --amend -s / git commit -s after opening; this commit intentionally has no agent-added DCO trailer per Sigstore AI_POLICY.md.

@loosebazooka

Copy link
Copy Markdown
Member

I would need some reasoning behind why this is required. What does this unlock for you?

Replace the hardcoded --release 17 on compileTestJava with a
build-parameters property (default 17), mirroring targetJavaVersion
for main sources. Validate that the resolved test JDK is at least
testTargetJavaVersion.

Fixes sigstore#1276

Signed-off-by: B. Pagels-Minor <b@thewealthsalons.com>
@b-pm
b-pm force-pushed the fix/1276-test-target-java-version branch from 8a1dc24 to 0e1499e Compare October 30, 2026 18:45
@b-pm

b-pm commented Oct 30, 2026

Copy link
Copy Markdown
Author

I picked it partially because it was an open issue and I realized that this would be very helpful in supporting newer JDKs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

It might make sense to create a property for testTargetJdk like we have for the main code

2 participants