Skip to content

Commit

Permalink
ignore failOnDynamicVersions() to fetch latest versions (#593)
Browse files Browse the repository at this point in the history
* ignore failOnDynamicVersions() when fetching latest versions
  • Loading branch information
keykey7 committed Mar 26, 2022
1 parent fba9231 commit 028df6f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Expand Up @@ -131,6 +131,12 @@ class Resolver {
copy.setCanBeResolved(true)
}

// https://github.com/ben-manes/gradle-versions-plugin/issues/592
// allow resolution of dynamic latest versions regardless of the original strategy
if(copy.resolutionStrategy.metaClass.hasProperty(copy.resolutionStrategy, "failOnDynamicVersions")) {
copy.resolutionStrategy.metaClass.setProperty(copy.resolutionStrategy, "failOnDynamicVersions", false)
}

// Resolve using the latest version of explicitly declared dependencies and retains Kotlin's
// inherited stdlib dependencies from the super configurations. This is required for variant
// resolution, but the full set can break consumer capability matching.
Expand Down
Expand Up @@ -136,6 +136,30 @@ final class DependencyUpdatesSpec extends Specification {
checkUndeclaredVersions(reporter)
}
@Issue("https://github.com/ben-manes/gradle-versions-plugin/issues/592")
def 'Project configurations failOnDynamicVersions'() {
given:
def project = singleProject()
addRepositoryTo(project)
addDependenciesTo(project)
project.configurations.all {
resolutionStrategy {
failOnDynamicVersions()
}
}
when:
def reporter = evaluate(project)
reporter.write()
then:
checkUnresolvedVersions(reporter)
checkUpgradeVersions(reporter)
checkUpToDateVersions(reporter)
checkDowngradeVersions(reporter)
checkUndeclaredVersions(reporter)
}
@Unroll
def 'Single project (#revision, #outputFormat)'() {
given:
Expand Down

0 comments on commit 028df6f

Please sign in to comment.