KAFKA-14198: Define separate swagger configuration in Gradle build#12616
Conversation
9091739 to
09f1f0b
Compare
| @@ -2564,7 +2568,9 @@ project(':connect:runtime') { | |||
| implementation libs.mavenArtifact | |||
| implementation libs.swaggerAnnotations | |||
There was a problem hiding this comment.
Do we need this to be implementation or can it be swagger too?
There was a problem hiding this comment.
I gave this a try but it wasn't successful. We still need the annotations at compile time since they're used to decorate our REST resource classes, like here:
|
|
||
| task genConnectOpenAPIDocs(type: io.swagger.v3.plugins.gradle.tasks.ResolveTask, dependsOn: setVersionInOpenAPISpec) { | ||
| classpath = sourceSets.main.compileClasspath + sourceSets.main.runtimeClasspath | ||
| classpath = sourceSets.main.runtimeClasspath |
There was a problem hiding this comment.
Do we need this assignment at all or can we just inline it?
There was a problem hiding this comment.
The plugin requires the classpath field to be set.
I also tried this:
classpath = sourceSets.main.runtimeClasspath + configurations.swagger.asCollection()
buildClasspath = classpath
which led to a lot of these warnings:
Gradle detected a problem with the following location... Reason: Task ':connect:runtime:genConnectOpenAPIDocs' uses this output of task ':connect:runtime:processResources' without declaring an explicit or implicit dependency.
Based on discussion in the PR that introduced OpenAPI docs generation for Connect, it appears that setting classpath to sourceSets.main.runtimeClasspath creates some implicit dependencies for the genConnectOpenAPIDocs task that fix these warnings.
|
Thanks @C0urante. Did you verify that the documentation is still generated correctly and the release tarball still doesn't have swagger and snakyaml in the dependencies? |
|
Thanks @ijuma. Yes, I verified both, and updated the PR description with the steps I took to do so. |
|
Thanks Ismael. Kicked off another Jenkins build since the previous one failed with a disk space error; will merge if everything looks alright. |
|
Failures appear unrelated, merging. |
Follow-up from #12609. Non-urgent, just tidies up the build file a bit.
Tested and verified locally by:
./gradlew releaseTarGzand then examining the resulting release artifact withtar tf tar tf core/build/distributions/kafka_2.13-3.4.0-SNAPSHOT.tgzto ensure that it did not contain theswaggerJaxrs2jar or its dependencies./gradlew siteDocsTarand then examining the resulting docs withcat docs/generated/connect_rest.yamlto ensure that all Connect REST endpoints were included.Committer Checklist (excluded from commit message)