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
rejectVersionIf
of different builds influence each other due to static state
#667
Comments
Hm, it calls the wrong one actually. Now if I call |
|
I've thrown together a reproducer as it is not exactly trivial: showcase.zip Actually in my production project it is showing |
I think the problem is, There was a similar problem in the past with the Spotbugs Gradle Plugin. In the context of Gradle plugins (at least, if not almost anywhere) any static state should be avoided as hell. |
rejectVersionIf
not working at allrejectVersionIf
of different builds influence each other due to static state
Here a small hacky work-around. inline fun Settings.onRefreshVersionsRequested(configure: Settings.() -> Unit) {
val rootBuild = gradle.parent == null
val startTaskNames = gradle.rootBuild.startParameter.taskNames
if (
(rootBuild && startTaskNames.contains(":refreshVersions"))
|| (!rootBuild && startTaskNames.contains(":${settings.rootProject.name}:refreshVersions"))
) {
configure()
}
}
inline fun Settings.conditionalRefreshVersions(configure: RefreshVersionsExtension.() -> Unit) {
onRefreshVersionsRequested {
refreshVersions(configure)
}
}
val Gradle.rootBuild: Gradle
get() = if (gradle.parent == null) gradle else gradle.parent!!.rootBuild The other a precompiled script plugin (or whatever) doing
and in the settings scripts instead of This way only if you execute one of the |
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
This is a work-around for Splitties/refreshVersions#667.
Just to test, I configured
But it does not reject any version and also does not print any
FOO
. :-/The text was updated successfully, but these errors were encountered: