icerockdev / moko-network

Network components with codegeneration of rest api for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev
Apache License 2.0
152 stars 28 forks source link

Generator plugin does not support incremental compilation #161

Open dalewking opened 2 years ago

dalewking commented 2 years ago

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:

dalewking commented 2 years ago

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 commented 1 month ago

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