Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Apply cache-fix plugin from convention plugins #1262

Merged
merged 1 commit into from
May 16, 2023

Conversation

erikghonyan
Copy link
Contributor

No description provided.

Copy link
Owner

@chrisbanes chrisbanes left a comment

Choose a reason for hiding this comment

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

Ha, I just did the same thing locally. Thanks!

@chrisbanes chrisbanes enabled auto-merge (rebase) May 16, 2023 19:36
@@ -28,7 +29,7 @@ android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
android-lint = { id = "com.android.lint", version.ref = "agp" }
android-test = { id = "com.android.test", version.ref = "agp" }
cacheFixPlugin = { id = "org.gradle.android.cache-fix", version = "2.7.1" }
cacheFixPlugin = { id = "org.gradle.android.cache-fix", version.ref = "cache-fix-plugin" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a bit of duplication here, the convention plugins use this same ID. I can also use the version catalog in the convention plugins to read its ID, but I think eventually we should be able to remove these plugins from here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, or maybe I'm wrong. Let me clean this up a bit, I actually don't need that compileOnly dependency on this plugin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I removed the dependency on the plugin. I still have the plugin id duplication, I think it's fine for now, we do it for the android application, library and multiplatform plugins as well. I want to play around with it a bit more to find a more elegant way, but otherwise I'll send a separate PR to use the version catalog. Will look something like this

        with(target) {
            val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")

            with(pluginManager) {
                apply(libs.findPlugin("android-application").get().get().pluginId)
                apply(libs.findPlugin("cacheFixPlugin").get().get().pluginId)
            }
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I think I found a way to avoid the plugin ID duplication 🙂 But we can go ahead and merge this PR, I'm waiting for some answers on that solution, I'll follow up with another PR

@erikghonyan
Copy link
Contributor Author

Heh, sorry that I couldn't send this earlier 🙂

auto-merge was automatically disabled May 16, 2023 19:53

Head branch was pushed to by a user without write access

@chrisbanes chrisbanes merged commit 174e4fe into chrisbanes:main May 16, 2023
@erikghonyan erikghonyan deleted the cache-fix-plugin branch May 16, 2023 21:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants