jenkinsci / gradle-jpi-plugin

Build Jenkins Plugins with Gradle
79 stars 50 forks source link

GroovyDoc Support #187

Closed steven-terrana closed 3 years ago

steven-terrana commented 3 years ago

Dependencies

Feature Request

Hey! Thanks for maintaining this project :)

I maintain the Jenkins Templating Engine where we utilize the gradle as our build tool. The plugin is written in Groovy and, as such, utilizes groovydoc instead of javadoc.

I tried to "trick" the Jenkins Plugin Site to show our groovy docs by overriding the javadocJar to actually build and bundle the groovy docs:

https://github.com/jenkinsci/templating-engine-plugin/blob/2fc86d6466ac907afa2ffd3f95ba05c992918bb2/build.gradle#L128-L136

Unfortunately, this didn't seem to work. I'm wondering if the publish task is directly invoking the original javadocJar task:

https://github.com/jenkinsci/gradle-jpi-plugin/blob/44b9bed4475069d4bd17c8442b873022345edf93/src/main/groovy/org/jenkinsci/gradle/plugins/jpi/JpiPlugin.groovy#L493-L495

So i guess my question is: Is it currently possible to publish groovydocs over javadocs as part of publish? and if not, any direction on how i could help integrate that into this plugin would be helpful.

Thank you!

sghill commented 3 years ago

Hey, thank you for the report!

First, I think we're talking about the Javadoc link on the plugins.jenkins.io/templating-engine page - but let me know if that's incorrect.

I've looked into this a bit and I'm not quite sure where things are going wrong. Part of my uncertainty is I'm not sure how javadoc.jenkins.io is populated. I read through the developer guide on publishing documentation, but didn't notice anything about javadoc. I think this is probably the next most important question.

From what I can tell, your config is working and the javadoc jar is being published with the groovy docs. Here's why I think that:

If I comment out the javadocJar task definition in your repo and run ./gradlew --quiet tasks --all, I end up with this:

javadocJar - Assembles a jar archive containing the main javadoc.

But if I leave the task as-is and run ./gradlew --quiet tasks --all, I see the description that's in the buildfile:

javadocJar - An archive of the JavaDocs for Maven Central

This is consistent with the [docs on withJavadocJar()](https://docs.gradle.org/6.3/dsl/org.gradle.api.plugins.JavaPluginExtension.html#org.gradle.api.plugins.JavaPluginExtension:withJavadocJar()):

If the project already has a task named javadocJar then no task is created.

Next I took a look at the published artifacts for 2.1 and saw there is a -javadoc.jar. I downloaded this, extracted it, and opened up index.html to find the groovydocs:

jte-docs

sghill commented 3 years ago

Hi @steven-terrana, I filed INFRA-2950 because I suspect the hosted version is out of date.

I found the repo that generates javadoc (jenkins-infra/javadoc) and was able to build a container with this command:

$ docker build -t jenkinsinfra/javadoc-dev --build-arg LTS_RELEASES=2.277 --build-arg PLUGINS="templating-engine" .

And run it with this one:

$ docker run --rm -p 9090:80 jenkinsinfra/javadoc-dev

This resulted in the groovydoc being served: plugin-overview plugin-javadoc

steven-terrana commented 3 years ago

hey @sghill sorry i missed your first comment!

I'll track that ticket and we can close this one.

Thank you. above and beyond support here 🙌 .