refreshVersions icon indicating copy to clipboard operation
refreshVersions copied to clipboard

Allow user-supplied plugin resolution rewriting rules

Open grodin opened this issue 5 years ago • 0 comments

This isn't quite a bug report but could be a feature request.

I have a settings.gradle.kts looking like this:


pluginManagement {
    resolutionStrategy {
        val pluginIdToCoordinates = mapOf(
            "com.google.gms.google-services" to "com.google.gms:google-services"
        )
        eachPlugin {
            pluginIdToCoordinates[requested.id.id]?.also { useModule(it) }
        }
    }
    repositories {
        gradlePluginPortal()
        google()
    }
}
buildscript {
    repositories {
        gradlePluginPortal()
    }
    dependencies {
        classpath("de.fayard.refreshVersions:refreshVersions:0.9.7")
    }
}

bootstrapRefreshVersions()

which enables applying the Google services Gradle plugin from a plugins block, e.g.:


plugins {
         id("com.google.gms.google-services").apply(false).version("4.3.3")
}

to workaround the fact that Google refuses to correctly publish their Gradle plugins.

Unfortunately, this requires me to request a version, negating the use of refreshVersions for only the Google services plugin.

Digging into the bootstrapRefreshVersionsCore() function and then into setupRefreshVersions() I can see some special casing for the Android plugins which achieves the same thing as what I've done in pluginManagement above.

I'd like to request some mechanism whereby a similar thing to the Android special casing could be done when calling bootstrapRefreshVersions, or else some suggestion to solve the problem I'm having. I know I can workaround it by just declaring a buildscript dependency, and that's what I will probably do, but it's slightly annoying that I can't get this one plugin to work with refreshVersions!

The root problem is, as I said, Google seems to not be interested in publishing plugin marker artifacts, even on their own repository, and it's quite stupid that we all have to work around it, but I suppose that's what Google does!

Thanks for the work on this plugin, BTW. It's the best solution for managing versions I've seen yet, and is really useful.

grodin avatar Nov 20 '20 13:11 grodin