moko-network icon indicating copy to clipboard operation
moko-network copied to clipboard

Generator plugin does not support incremental compilation

Open dalewking opened this issue 4 years ago • 2 comments

Using the latest gradle, I see this warning in the build:

Execution optimizations have been disabled for task ':wfmShared:xxxxxxxxXxxxxApiOpenApiGenerate' to ensure correctness due to the following reasons:

  • Additional action of task ':project:xxxxxxxxXxxxxApiOpenApiGenerate' was implemented by the Java lambda 'dev.icerock.moko.network.tasks.GenerateTask$$Lambda$1380/0x00000008013e3040'. Reason: Using Java lambdas is not supported as task inputs. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implementation_unknown for more details about this problem.

dalewking avatar Sep 03 '21 05:09 dalewking

This is an easy thing to fix. Just don't use a Java lambda. My current workaround is to not use the normal configuration mechanism and define my on generate task in build.gradle.kts:

val generateTask: GenerateTask = tasks.create(
    "generate",
    GenerateTask::class.java
) {
...
    // The standard generate task adds a doFirst block implemented with a Java lambda
    // which does not work well with gradle because it disables execution optimizations
    // forcing the task to run every time and output a big warning to that effect.
    // See: https://docs.gradle.org/7.2/userguide/validation_problems.html#implementation_unknown
    // The effect of these two lines is to replace the Java lambda block with a Kotlin one
    actions.removeAt(0)
    doFirst { file(outputDir.get()).deleteRecursively() }
}

dalewking avatar May 23 '22 15:05 dalewking

The error message did go away so this is not really an issue.

dalewking avatar May 13 '24 01:05 dalewking