Plugin: Fix Gradle configuration cache by not keeping classloader as a nested task field#3822
Plugin: Fix Gradle configuration cache by not keeping classloader as a nested task field#3822picklebento merged 4 commits intodetekt:mainfrom mateuszkwiecinski:fix_configuration_cache
Conversation
|
We would need to use The change looks good to me though. |
Codecov Report
@@ Coverage Diff @@
## main #3822 +/- ##
=========================================
Coverage 83.57% 83.58%
Complexity 3110 3110
=========================================
Files 456 456
Lines 8933 8931 -2
Branches 1749 1748 -1
=========================================
- Hits 7466 7465 -1
Misses 551 551
+ Partials 916 915 -1
Continue to review full report at Codecov.
|
|
The test you mentioned is already there: I expected that removing the |
|
When inspecting the task output in the aforementioned test, I can even observe On second thought, we could use a real detekt task instead of dry run to verify the configuration cache behavior. We could create another issue for that. |
|
Wouldn't the
be a log for regular Gradle Build Cache? For some reason detekt tests use build cache.
That's right, the real detekt task, aka I expected it to fail without the fix I applied, but it doesn't - and that's my challenge here :/ I'll make this PR ready for review as it passed the build and the feature seems to be covered with tests, but if anyone feels up to extending them - feel free to use the work I;ve done here 😃 |
…LClassLoader'` error by not keeping classloader as a task field
…k.properties obviously
…default `DetektInvoker` implementation
|
|
||
| import io.gitlab.arturbosch.detekt.internal.ClassLoaderCache | ||
| import io.gitlab.arturbosch.detekt.internal.GlobalClassLoaderCache | ||
| import org.codehaus.groovy.runtime.DefaultGroovyMethods.hasProperty |
There was a problem hiding this comment.
You should use org.gradle.api.Project.hasProperty instead.

Fixes #3563
I tried to reproduce the issue in tests, however I'm unable to trigger the
cannot serialize object of type 'java.net.URLClassLoader', a subtype of 'java.lang.ClassLoader'error there :/ I noticed tests are passing thedry-runflag which calls simplerDryRunInvoker, but even after adding a test case with theDefaultCliInvokerthe test still doesn't fail.I'd love to hear some ideas how to cover the linked scenario in tests 👀
I verified manually on a failing project changes I'm suggesting work 🤷