Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically apply Add-Opens directives from MANIFEST.MF #322

Merged
merged 6 commits into from
Mar 31, 2022

Conversation

basil
Copy link
Member

@basil basil commented Mar 30, 2022

Currently, people testing with Java 17 must add an awkward -DargLine= directive with the Add-Opens modules from the core version they are testing. This PR applies a trick to dynamically set this based on the values in MANIFEST.MF.

With this in place, anyone with a sufficiently recent core (2.341+), test harness (1721.v385389722736+), and maven-hpi-plugin (this PR) should be able to effortlessly do Java 17 testing and indeed enable Java 17 in their Jenkinsfile. Once this is merged, I will try to do a release and wrap this and the test harness change into a new plugin POM release so that the requirement just becomes "core 2.341+ and plugin POM 4.40+".

Tested with workflow-job and Java 17:

$ mvn clean verify -Dtest=org.jenkinsci.plugins.workflow.job.WorkflowJobTest,org.jenkinsci.plugins.workflow.job.WorkflowRunTest -Djenkins.version=2.341 -Djenkins-test-harness.version=1723.vcd938b_e66072 -Dhpi-plugin.version=3.27-SNAPSHOT -Denforcer.skip
[…]
[INFO] --- maven-hpi-plugin:3.27-SNAPSHOT:initialize (default-initialize) @ workflow-job ---
[INFO] Setting argLine to -Xms768M -Xmx768M -XX:+HeapDumpOnOutOfMemoryError -XX:+TieredCompilation -XX:TieredStopAtLevel=1 --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED
[…]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:14 min
[INFO] Finished at: 2022-03-30T11:21:40-07:00
[INFO] ------------------------------------------------------------------------
$

@basil basil requested review from jglick and timja March 30, 2022 18:24
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. BTW how does this sort of thing get integration-tested? Does running existing plugin-pom ITs using Java 17 suffice?

@basil
Copy link
Member Author

basil commented Mar 31, 2022

Nice. BTW how does this sort of thing get integration-tested? Does running existing plugin-pom ITs using Java 17 suffice?

I will write some tests once all these changes are merged and dependencies are updated. Right now there are too many dependencies on unmerged/unreleased PRs to be able to write tests easily.

@basil basil merged commit f4e6886 into jenkinsci:master Mar 31, 2022
@basil basil deleted the add-opens branch March 31, 2022 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants