openapi-processor / openapi-processor-gradle

openapi-processor gradle plugin
https://docs.openapiprocessor.io
Apache License 2.0
3 stars 1 forks source link

Incompatibility with Lombok Gradle plugin #25

Open davidjohnstonverint opened 2 years ago

davidjohnstonverint commented 2 years ago

We started using the Lombok plugin for gradle rather than pulling in the dependencies and setting things up manually:

id 'io.freefair.lombok' version '6.4.2'

The result is the following warning in the gradle output and processSpring ends up being run on every gradle task (presumably because Gradle is unable to determine that it is already up to date.

> Task :processSpring
Execution optimizations have been disabled for task ':processSpring' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\dev\git\foo\build\openapi'. Reason: Task ':generateEffectiveLombokConfig' uses this output of task ':processSpring' 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.4.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

I found the same issue raised against another gradle plugin and the reason was due to the dependencies not being modeled correctly within the plugin (https://github.com/Netflix/dgs-codegen/issues/190). Is this something that can be fixed within this gradle plugin too?

hauner commented 2 years ago

Does this work for you?

It works in my test setup, but it is really simple and I'm not sure if this is enough to prove that it is working. :-)

I just added the lombok plugin to a sample project without any other change. It showed the message and I was able to fix it with this modified setup:

// build.gradle
afterEvaluate {
    def processSpring = tasks.named ('processSpring')
    sourceSets.main.java.srcDir (processSpring)
    compileJava.dependsOn (processSpring)
}
fizlrock commented 3 weeks ago

id 'io.freefair.lombok' version '8.10' id 'org.openapi.generator' version '7.8.0'

compileJava.dependsOn tasks.openApiGenerate

gradle run

Task :app:openApiGenerate FAILED

FAILURE: Build failed with an exception.

hauner commented 3 weeks ago

@fizlrock your error is from a different project:

'org.openapi.generator'

this project is called openapi-processor and the gradle plugin name is:

"io.openapiprocessor.openapi-processor"

Sax388 commented 3 weeks ago

@fizlrock I think what @hauner meant was that you should go to https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin and create an issue there instead of in this github repository.

I've got the same issue after upgrading the plugin version by the way 😄 .

EDIT: It seems this is triggered by the latest lombok plugin release: https://github.com/freefair/gradle-plugins/releases/tag/8.10.

hauner commented 3 weeks ago

@Sax388 Thanks. That's what I was trying to say.. :-)