Skip to content
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

Use alias instead of id when specifying plugins #959

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

McGalanes
Copy link

No description provided.

@dturner
Copy link
Collaborator

dturner commented Oct 3, 2023

What's the benefit of doing this please? It seems to add a lot of noise for no benefit but maybe I'm missing something.

@mmoczkowski
Copy link
Contributor

What's the benefit of doing this please? It seems to add a lot of noise for no benefit but maybe I'm missing something.

@dturner Personally, I see the value in it for type safety. One might question why introduce any plugin to TOML in the first place.

Copy link
Collaborator

@dturner dturner left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation @mmoczkowski, makes sense.

gradle/libs.versions.toml Show resolved Hide resolved
@dturner
Copy link
Collaborator

dturner commented Oct 4, 2023

Thanks for doing this @McGalanes. The benefit is clear now.

@dturner dturner changed the title Add convention plugins to version catalogs Use alias instead of id when specifying plugins Oct 4, 2023
@dturner dturner merged commit 301661c into android:main Oct 4, 2023
3 checks passed
@McGalanes McGalanes deleted the convention-plugins-toml branch October 4, 2023 09:55
@dawidhyzy
Copy link

dawidhyzy commented Jan 10, 2024

@McGalanes
I'm trying to do the same but I get Error resolving plugin [id: 'myapp.android.application', version: 'unspecified'] The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked. Did you face the same issue?

@McGalanes
Copy link
Author

McGalanes commented Jan 10, 2024

@McGalanes I'm trying to do the same but I get Error resolving plugin [id: 'myapp.android.application', version: 'unspecified'] The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked. Did you face the same issue?

@dawidhyzy Yes, try disabling your plugins in your project gradle file:
https://github.com/McGalanes/groomr/blob/0340a04fcd97f50eeccd209f04685c0d0396a88a/build.gradle.kts#L29C1-L38C2

@dawidhyzy
Copy link

dawidhyzy commented Jan 12, 2024

So that you know did that already. It's not a problem here because it complains about convention plugins defined by my project.
Basically, I was using id and wanted to migrate to alias.

@McGalanes
Copy link
Author

if you already tried what I said and it still doesn't work I don't understand. Sorry mate

@jsoberg
Copy link

jsoberg commented May 24, 2024

@dawidhyzy did you ever happen to find a workaround for your issue? I'm experiencing the same problem while trying to add internal convention plugins in this manner and apply them.

@dawidhyzy
Copy link

@dawidhyzy did you ever happen to find a workaround for your issue? I'm experiencing the same problem while trying to add internal convention plugins in this manner and apply them.

Yes, I think I registered them in the main grade with apply false. I will double check that on Monday.

@jsoberg
Copy link

jsoberg commented May 28, 2024

I tried that as well (applying all the local plugins with false) but it was giving the same issue. I have a root project-level plugin that's applied so it might be a race condition with that?

@ZhaohuaZeng-at
Copy link

I think there might be some confusions on what to add in the root project level plugins in previous conversations.

I got the same error but was able to resolve after adding my defined plugins to the plugins list in the root project level.

plugins {

    alias(libs.plugins.ksp).apply(false)
    // some other plugins... 

    // Add my defined plugins here
    alias(libs.plugins.my.android.application).apply(false)
    alias(libs.plugins.my.android.hilt).apply(false)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants