-
Notifications
You must be signed in to change notification settings - Fork 91
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
Gradle plugin: Fix circular task dependency with Quarkus plugin #1344
Gradle plugin: Fix circular task dependency with Quarkus plugin #1344
Conversation
The Smallrye Gradle plugin adds the generated OpenAPI schema files (YAML + JSON) to the generated jar file. This was achieved using via the `processResources` task, which unfortunately is not "compatible" with the Quarkus plugin (see below output). The fix is to add the generated schema files directly to the `jar` task. Tests have been added to verify interopability with the Quarkus plugin, also reproducers for smallrye#1335 (without the production code changes of course): ``` Circular dependency between the following tasks: :compileJava +--- :quarkusGenerateCode | \--- :processResources | \--- :generateOpenApiSpec | +--- :compileJava (*) | +--- :quarkusGenerateCode (*) | \--- :quarkusGenerateCodeDev | \--- :processResources (*) \--- :quarkusGenerateCodeDev (*) ``` Fixes smallrye#1335
@@ -46,4 +46,8 @@ tasks.named<Test>("test") { | |||
useJUnitPlatform() | |||
} | |||
|
|||
tasks.named("pluginUnderTestMetadata") { | |||
dependsOn("processJandexIndex") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really related to this PR, fixes this build warning:
> Task :pluginUnderTestMetadata
Execution optimizations have been disabled for task ':pluginUnderTestMetadata' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: '/home/snazy/devel/misc/smallrye-open-api/tools/gradle-plugin/build/resources/main'. Reason: Task ':pluginUnderTestMetadata' uses this output of task ':processJandexIndex' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.6/userguide/validation_problems.html#implicit_dependency for more details about this problem.
t.dependsOn(genTaskName); | ||
t.from(project.getTasks().getByName(genTaskName).getOutputs().getFiles()); | ||
}); | ||
project.getTasks().named(sourceSet.getJarTaskName(), Jar.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is the actual fix
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for looking at and fixing this @snazy
The Smallrye Gradle plugin adds the generated OpenAPI schema files (YAML + JSON) to the generated jar file. This was achieved using via the
processResources
task, which unfortunately is not "compatible" with the Quarkus plugin (see below output). The fix is to add the generated schema files directly to thejar
task.Tests have been added to verify interopability with the Quarkus plugin, also reproducers for #1335 (without the production code changes of course):
Fixes #1335