jenkinsci / gradle-jpi-plugin

Build Jenkins Plugins with Gradle
79 stars 50 forks source link

Fix a number of initialization order issues with 0.43.0 #194

Closed mglazer closed 2 years ago

mglazer commented 2 years ago

I had a number issues applying this upgrade from 0.38.0 because I needed to build against Gradle 7.3.1

Specifically the main error I received was:

* What went wrong:
A problem occurred evaluating project ':jenkins-skylab-plugin'.
> Failed to apply plugin class 'org.jenkinsci.gradle.plugins.manifest.JenkinsManifestPlugin'.
   > Could not create task ':jenkins-skylab-plugin:generateJenkinsManifest'.
      > Extension of type 'JpiExtensionBridge' does not exist. Currently registered extension types: [ExtraPropertiesExtension, EclipseModel, IdeaModel, ProcessorsExtension, BlacklistExtension, BasePluginExtension, DefaultArtifactPublicationSet, SourceSetContainer, ReportingExtension, JavaPluginExtension, JavaToolchainService, TestingExtension, BaselineJavaVersionExtension, GroovyRuntime]

Which made sense because the extension was being accessed before it was actually constructed. I'm unsure if Gradle changed initialization order in some versions of Gradle, but in any case, moving a few of these initialization blocks around managed to fix my issue.

sghill commented 2 years ago

Thanks @mglazer!

I don't recall why the dependencyAnalysis field was being accessed through project.plugins.getPlugin(JpiPlugin), but I see that all the tests are passing. This may change slightly if a problem arises after merging, but I'm going to go ahead and merge this.

For release timelines, I'm hoping to get a couple more things in place before the next release - building on Gradle 7.x (requires spock upgrade) and improved task dependency declarations.