I made a plugin but it seems to re-run often, how ...
# kotlin-toolchain
f
I made a plugin but it seems to re-run often, how can I debug task invalidation issues like that?
j
I'm AFK so this is off the top of my head, sorry I can't be more precise right now. There are mainly 2 places you can look: 1. The OpenTelemetry traces, to see the timings, whether something ran or not, whether you had a cache hit or miss, etc. for a particular run 2. The incremental cache's state files. There you can see the recorded input/outputs of your task. If it changes when you run, you'll see what changes. To open the telemetry traces, use
kotlin tool jaeger
and navigate to the local server in your browser. If you ran it from your project, you might be able to search traces directly from that UI, or just choose the upload tab, and select your traces file. For any given run of the CLI, the OTel traces are in
build/logs/dir of your exec/telemetry/cli-something.json
. The incremental state files are under
build/incremental.state/...
. Sorry I don't recall the exact naming convention but you should see something that has your plugin name in it, and maybe the task name as well. The file is a JSON which should be human readable.
f
Well actually I guess my main problem is the documentation says that tasks are re-run when • the action execution classpath changes (if the action code is recompiled, tasks using the action need to be rerun) • effective values of the action arguments that are non‑paths, including property values of configurable interfaces, recursively • the state of all gathered file-tree inputs and file-tree outputs declared via `@Input`/`@Output` My task is basically
Copy code
@TaskAction
fun generateIcons(
    configuration: GenerateIconsConfiguration,
    @Output generatedSourceDir: Path,
) {
    generatedSourceDir.deleteRecursively()
    
    // download content from the internet, process it, then write to generatedSourceDir
}
and I’m not modifying the task in any way, it just seems to re-run randomly as if the incremental cache times out
j
Is it possible by any chance that you're using the same generated output dir for another task too? Adding files to it might invalidate the outputs
f
I don’t think so, I set it up in basically the same way as the example plugin
j
@Fedor Ihnatkevich do you have any ideas off the top of your head here? Or should we investigate traces in details?
@fishy we could help you debug this if you shared the zipped build folder before and after the re-run of your task that you think shouldn’t have re-run.