-
-
Notifications
You must be signed in to change notification settings - Fork 766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 #3822
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: detekt/detekt-gradle-plugin/src/test/kotlin/io/gitlab/arturbosch/detekt/ConfigurationCacheTest.kt Line 8 in 4a89a25
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 😃 |
detekt-gradle-plugin/src/main/kotlin/io/gitlab/arturbosch/detekt/invoke/DetektInvoker.kt
Outdated
Show resolved
Hide resolved
…LClassLoader'` error by not keeping classloader as a task field
…k.properties obviously
…default `DetektInvoker` implementation
@@ -2,8 +2,10 @@ package io.gitlab.arturbosch.detekt.invoke | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use org.gradle.api.Project.hasProperty
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-run
flag which calls simplerDryRunInvoker
, but even after adding a test case with theDefaultCliInvoker
the 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 🤷