-
Notifications
You must be signed in to change notification settings - Fork 200
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
WIP: rejectVersionIf { } #337
Conversation
One test is not working anymore: > Could not find method componentSelection() for arguments [build_6aatid6bxisq96bm8bf31j5zh$_run_closure3$_closure5@243ebea0] on root project 'junit8907024250739898265' of type org.gradle.api.Project. https://scans.gradle.com/s/unwddfvrt5xak ``` dependencyUpdates.resolutionStrategy = componentSelection { all(new Rule()) } } ```
If you use I think Gradle changed the version of Groovy which is backwards incompatible, so we stayed on an old version which is forward compatible. So there could be some weird interaction there. If you drop all your Gradle changes and use |
@@ -91,6 +98,18 @@ class DependencyUpdatesTask extends DefaultTask { | |||
this.resolutionStrategy = null | |||
} | |||
|
|||
void rejectVersionIf(final Transformer<Boolean, ComponentSelectionWithCurrent> filter) { | |||
resolutionStrategy { ResolutionStrategyWithCurrent strategy -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like you can now drop the these now that the delegation is fixed. Does it work like this?
resolutionStrategy {
strategy.componentSelection {
all {
if (filter.transform(current)) {
current.reject("Rejected")
}
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, maybe not without losing the typesafe checking
Object outputFormatter = 'plain' | ||
|
||
@Input @Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is causing the fail in the test, because the closure is executed without correct arguments and delegates during validation. Something similar seems to have happened in 3cce551, where they removed the annotation from the outputFormatter
field.
Map<Project, Set<Configuration>> projectConfigs = project.allprojects.collectEntries { proj -> | ||
[proj, proj.configurations.plus(proj.buildscript.configurations) as Set] | ||
Map<Project, ConfigurationContainer> projectConfigs = project.allprojects.collectEntries { proj -> | ||
proj.configurations.addAll(proj.buildscript.configurations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be the cause of Cannot change dependencies of configuration ':classpath' after it has been resolved.
Try:
def configurations = []
configurations.addAll(proj.configurations)
configurations.addAll(proj.buildscript.configurations)
[proj, configurations as Set]
I had a first try at implementing #325
It would be better if we can change the syntax to this but I don't know how to do it:
isNonStable
being defined as this:Since my Groovy skills are closed to zero, I tried to upgrade Gradle so that at least that part is familiar for me.
Because of the Gradle update, one test is not working anymore https://scans.gradle.com/s/unwddfvrt5xak
I have also run
./gradlew publish
and then use the artifact in my own pluginhttps://github.com/jmfayard/buildSrcVersions/pull/62/files
One part of this is also wrong:
Cannot change dependencies of configuration ':classpath' after it has been resolved.
https://gist.github.com/jmfayard/f8455c2cdc658035e8d542ecf0f841ac