This message was deleted.
# community-support
s
This message was deleted.
e
that's more likely an issue for whatever plugin you're using to set up the ktlint tasks
d
yeah, I just wondered if there was some stabdard gradle cache mechanism that might be used
because the task compiles one module to use in running that task in another
but it should be working…
d
what does
Input
do?
e
marks a task input, which makes it part of the computed cache key
d
and the thing that confuses me is that I don’t know where my custom rule jar file is that this uses. I can find the jar file in the build directory but that is not what is used it seems, so it must be something in the gradle cache somewhere
e
but
@Classpath
is supposed to be
@InputFiles
implicitly, so perhaps something else is not being set up properly
if it's in the same project, then it's in the build directory (unless it's transformed, in which case it'll be in the transforms cache). if it's an external dependency, it'll be in the gradle modules cache
d
it’s a multi-module project and the custom rule is one module and the task is run on another module
where is the gradle modules cache?
e
https://docs.gradle.org/current/userguide/directory_layout.html#dir:gradle_user_home "3️⃣ Shared caches (e.g. for artifacts of dependencies)"
but a module within the same build won't go there
d
oh, where would it go?
I seem to have this issue after running gradle clean and the using --no-build-cache
e
it'll be used directly from the build directory of that module
d
oh wow it’s working again. I’m not sure what I did TBH
ok thanks anyway
this is so weird, sometimes it will use the changed code and sometimes not, I try to stop the daemons, remove the build directories and change the code and sometimes that’s enough but other times it uses some cache somewhere
e
./gradlew --build-cache -Dorg.gradle.caching.debug=true
should print information about what is part of the cache keys
d
doing
./gradlew --stop
then removing the custom rules build dir and then running the task works, but I need to do the
--stop
every time, why would that be?
e
it sounds like something isn't getting included in the hash key that should be. you may be able to find by comparing cache debugging outputs or build scans (
./gradlew --scan
).
c
Have seen similar bugs where plug-in code loads something into a class-scoped (static) variable/cache, requiring a restart of the daemon to recover.
e
oh, that's a possibility… if the plugin is trying to be clever and runs ktlint in a cached classloader instead of using a new
JavaExec
each time or something, I can see that being a problem
c
Exactly. Pretty sure that's what I saw a few years back, some plug-in with odd classloader stuff. Old code that predated Gradle daemon, assuming a clean start every time.
d
thanks, I’ll point the plugin author towards this
e
that code actually seems to have this exact bug: if a jar's contents change but not its path, the classloader gets reused inappropriately