Skip to content

Commit

Permalink
Allow openrewrite to run on outdated plugins running only on Java 8
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesbusy committed Jan 1, 2025
1 parent fa6969a commit abd9373
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ private void process(Plugin plugin) {
}

// Run OpenRewrite
if (plugin.getMetadata().getJdks().stream().allMatch(jdk -> jdk.equals(JDK.JAVA_8))) {
LOG.info("Plugin support only Java 8. Need a first compile to general classes");
plugin.verifyWithoutTests(mavenInvoker, JDK.JAVA_8);
} else {
plugin.withJDK(JDK.min(plugin.getMetadata().getJdks()));
}
plugin.runOpenRewrite(mavenInvoker);
if (plugin.hasErrors()) {
LOG.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ public void collectMetadata(MavenInvoker maven) {
* @param maven The maven invoker instance
*/
public void runOpenRewrite(MavenInvoker maven) {
withJDK(JDK.JAVA_17);
if (config.isFetchMetadataOnly()) {
LOG.info("Skipping OpenRewrite recipe application for plugin {} as only metadata is required", name);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ recipeList:
- io.jenkins.tools.pluginmodernizer.RemoveExtraMavenProperties
- io.jenkins.tools.pluginmodernizer.UpgradeBomVersion
- io.jenkins.tools.pluginmodernizer.MigrateToJenkinsBaseLineProperty
- org.openrewrite.java.RemoveUnusedImports
---
type: specs.openrewrite.org/v1beta/recipe
name: io.jenkins.tools.pluginmodernizer.SetupDependabot
Expand Down

0 comments on commit abd9373

Please sign in to comment.