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

ignore failOnDynamicVersions() to fetch latest versions #593

Merged
merged 2 commits into from
Mar 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ import org.gradle.api.artifacts.result.ComponentArtifactsResult
import org.gradle.api.artifacts.result.ResolvedArtifactResult
import org.gradle.api.attributes.HasConfigurableAttributes
import org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier
import org.gradle.api.internal.artifacts.configurations.DefaultConfiguration
import org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal
import org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultResolutionStrategy
Copy link
Owner

Choose a reason for hiding this comment

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

looks like you don't need these anymore?

import org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier
import org.gradle.maven.MavenModule
import org.gradle.maven.MavenPomArtifact
Expand Down Expand Up @@ -131,6 +134,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
Original file line number Diff line number Diff line change
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