Skip to content

Update forced offline mode in AboutLibrariesIdTask#1272

Merged
mikepenz merged 1 commit intodevelopfrom
fix/1270
Dec 19, 2025
Merged

Update forced offline mode in AboutLibrariesIdTask#1272
mikepenz merged 1 commit intodevelopfrom
fix/1270

Conversation

@mikepenz
Copy link
Owner

Update forced offline mode in AboutLibrariesIdTask

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 offlineMode property in BaseAboutLibrariesTask overridable by adding open modifier
  • Changed imports in BaseAboutLibrariesTask from explicit to wildcard for org.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.*
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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

Copilot uses AI. Check for mistakes.
@DRSchlaubi
Copy link
Contributor

Isn't that incompatible with configuration cache

If you choose this approach you should use objectFactory

@mikepenz
Copy link
Owner Author

mikepenz commented Dec 19, 2025

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. project is accessed

Locally with config cache, it wouldn't complain for me 🤔

@mikepenz mikepenz merged commit 556a3f5 into develop Dec 19, 2025
9 checks passed
@mikepenz mikepenz deleted the fix/1270 branch December 19, 2025 10:43
@mikepenz
Copy link
Owner Author

@DRSchlaubi do you observe problems with this approach?

@DRSchlaubi
Copy link
Contributor

I wasn't able to test it yet unfortunately, but I will once I am back at home

@DRSchlaubi
Copy link
Contributor

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. project is accessed

Locally with config cache, it wouldn't complain for me 🤔

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
`||

@mikepenz
Copy link
Owner Author

mikepenz commented Dec 19, 2025

🤔

Either way, related caching behavior it shouldn't change from before. as project was already accessed there as well: https://github.com/mikepenz/AboutLibraries/blob/develop/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesIdTask.kt#L14

@mikepenz
Copy link
Owner Author

I wasn't able to test it yet unfortunately, but I will once I am back at home

Thank you.

@DRSchlaubi
Copy link
Contributor

🤔

Either way, related caching behavior it shouldn't change from before. as project was already accessed there as well: https://github.com/mikepenz/AboutLibraries/blob/develop/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesIdTask.kt#L14

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

@mikepenz
Copy link
Owner Author

🤔
Either way, related caching behavior it shouldn't change from before. as project was already accessed there as well: https://github.com/mikepenz/AboutLibraries/blob/develop/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesIdTask.kt#L14

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatible with Android IntelliJ Plugin

3 participants