Hello.
So I have a setup somewhat similar to https://docs.gradle.org/current/samples/zips/sample_sharing_convention_plugins_with_build_logic-kotlin-dsl.zip
I defined a task in the project build-conventions like this
@CacheableTask
abstract class MyTask :DefaultTask() {
@get:InputDirectory
@get:PathSensitive(PathSensitivity.NONE)
abstract val inputDir: DirectoryProperty
@get:OutputDirectories
abstract val outputDir: DirectoryProperty
@TaskAction
fun go() {
//ignored for simplicity
}
}
And then use it somewhere in the project…
tasks.register("hi",MyTask::class){
inputDir=project.layout.projectDirectory.dir("src")
outputDir=project.layout.projectDirectory.dir("build")
}
Now my observation is that any and all changes to the “buildSrc” project will always cause my task to be out of date.
Task ':list:hi' is not up-to-date because:
Class path of task ':list:hi' has changed from ea27f7d10c6a0af4b523813675cd1d1a to 9a2670e1f656a1bcec84ba710b5aaa9c.
This is fairly odd, because the default tasks of gradle like javacompile,javaexec… are not
affected by this-> these tasks seems to not track their class path/classloader and stay up to date after I change somthing.
My current theory is that gradle treats its own core task somewhat differently and I really need to avoid using a buildSrc to not trigger unwanted rebuilds or is there something that i am missing?
So could be something like telling gradle: my tasks really doesn’t do aditional classloader black magic or just put my task on a different classloader if you dont believe me…
Best regards ,
Thorsten