pl.allegro.tech.build.axion.release.domain.SnapshotDependenciesChecker.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of axion-release-plugin Show documentation
Show all versions of axion-release-plugin Show documentation
Gradle release and version management plugin
package pl.allegro.tech.build.axion.release.domain
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.DependencyConstraint
class SnapshotDependenciesChecker {
Collection snapshotVersions(Project project) {
Collection projectVersions = project.allprojects.collect {toFullVersion(it)}
Collection allDependenciesVersions = project.allprojects.collect {
it.configurations.collect { config ->
config.allDependencies.findAll {isSnapshot(it)}.collect {toFullVersion(it)}+
config.allDependencyConstraints.findAll {isSnapshot(it)}.collect {toFullVersion(it)}
}
}.flatten().unique()
allDependenciesVersions.removeAll(projectVersions)
return allDependenciesVersions
}
boolean isSnapshot(Dependency dependency) {
dependency.version?.endsWith("-SNAPSHOT")
}
boolean isSnapshot(DependencyConstraint dependency) {
dependency.version?.endsWith("-SNAPSHOT")
}
String toFullVersion(it) {
"${it.group}:${it.name}:${it.version}".toString()
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy