Conversation
There was a problem hiding this comment.
Pull request overview
This pull request fixes issue #1270 by updating how the AboutLibrariesIdTask enforces offline mode. Instead of setting offlineMode in the plugin configuration, it now overrides the property directly in the task class.
Key changes:
- Moved offline mode enforcement from plugin configuration to task property override
- Made
offlineModeproperty inBaseAboutLibrariesTaskoverridable by addingopenmodifier - Changed imports in
BaseAboutLibrariesTaskfrom explicit to wildcard fororg.gradle.api.tasks
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| BaseAboutLibrariesTask.kt | Made offlineMode property open to allow overriding, and changed to wildcard import for tasks package |
| AboutLibrariesPlugin.kt | Removed the forced offline mode setting from plugin configuration for findLibraries task |
| AboutLibrariesIdTask.kt | Added override of offlineMode property to force offline mode directly in the task class |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import org.gradle.api.tasks.Optional | ||
| import org.gradle.api.tasks.PathSensitive | ||
| import org.gradle.api.tasks.PathSensitivity | ||
| import org.gradle.api.tasks.* |
There was a problem hiding this comment.
Wildcard imports are generally discouraged in Kotlin as they can make it unclear where specific classes come from and may lead to naming conflicts. Consider using explicit imports for the specific classes needed from org.gradle.api.tasks (Input, InputDirectory, Internal, Optional, PathSensitive, PathSensitivity).
| import org.gradle.api.tasks.* | |
| import org.gradle.api.tasks.Input | |
| import org.gradle.api.tasks.InputDirectory | |
| import org.gradle.api.tasks.Internal | |
| import org.gradle.api.tasks.Optional | |
| import org.gradle.api.tasks.PathSensitive | |
| import org.gradle.api.tasks.PathSensitivity |
plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesIdTask.kt
Show resolved
Hide resolved
|
Isn't that incompatible with configuration cache If you choose this approach you should use objectFactory |
I would think that it's the same. as in both cases. Locally with config cache, it wouldn't complain for me 🤔 |
|
@DRSchlaubi do you observe problems with this approach? |
|
I wasn't able to test it yet unfortunately, but I will once I am back at home |
Config cache doesn't always complain directly, you need to get it to cache it first But this is for sure incompatible, as project must not be accessed, object factory wouldn't You can either use this example or put the set part in an init Block @get:Inject
val objects: ObjectFactory
`|| |
|
🤔 Either way, related caching behavior it shouldn't change from before. as |
Thank you. |
Well then those should be migrated as well, I can't enable config cache specifically because plugins often don't support it It would be great if they could provide a compatibility test kit to find anything which could caus issues |
Last time I tested these, those were fine for configuration cache. as they are not accessed after the initial construction . but I'd be curious to see if it actually fails for you with config cache enabled. |
Update forced offline mode in
AboutLibrariesIdTask