This message was deleted.
# caching
s
This message was deleted.
e
the
--rerun
flag that was added to all tasks in 7.6 should bypass cache, I think
r
this is the same as --rerun-tasks ? its still not ideal to have a dev go in and change their run configuration in IDE if that's how they are triggering tests each or have them pass a extra flag each time
e
it's different from
--rerun-tasks
in that it applies to individual tasks instead of everything
I suppose you could do something like
Copy code
tasks.withType<Test>().configureEach {
    outputs.upToDateWhen { System.getProperty("idea.version") == null }
}
to ensure that test runs launched via Gradle from the IDE don't reuse results
but I thought that IDEA defaulted to running tests itself, so whatever is in Gradle cache doesn't matter
v
No, it defaults to run build and test through Gradle. Which also makes sense, as Gradle often knows better, having special needed configuration or whatever. But at the same time, IntelliJ usually also cares for the test always being rerun using an init script if you "run tests" even if they are delegated to Gradle, because IntelliJ has the opinion, if a user asks to run the tests, they should run and not be skipped. If you just run an arbitrary Gradle task and debug its execution it is different, then the cache could kick in. I personally would not recommend disabling the cache for such a reason even if they were up-to-date or cached weven when run through IntelliJ properly. Even if one wonders why no breakpoints are hit an the test finished immediately, that should only happen once with confusion and then it should be clear what happened and why the next time. But if those people really insist, there are multiple possibilities: • disable caching for test tasks • disable caching for test tasks when run through IntelliJ • disable caching for test tasks if some Gradle property is set so that the ones insisting can have the behaviour they want with the flick of a switch • enable caching and tell people that insist to either disable the caching completely by setting in their Gradle user home, then it is also for all projects they work on, not only a specific one • or enable caching and tell people to use an init script in their Gradle user home to do whatever they want, like for example disabling caching on test tasks. • ...
r
Thanks for the reply @Vampire and @ephemient, that is helpful, we will push to keep it active
👌 1
m
We've been doing this for quite some time, with no negative impact on debugging tests. Which cannot be said for test task timeouts, but we quickly learned to only apply those in CI.
n
From my experience, most teams have the remote cache enabled for tests. Just out of curiousity, how did you disable only the remote cache for test tasks? Did you simply disable all caching for them?