1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Better checkVersions.

This commit is contained in:
Cedric Beust 2016-06-29 01:44:40 -08:00
parent 8e286fe6ad
commit 1cea9e7fad

View file

@ -27,9 +27,14 @@ class CheckVersions @Inject constructor(val depManager: DependencyManager,
val latestDep = depManager.create(dep.shortId, project.directory)
val artifact = (latestDep as AetherDependency).artifact
val versions = aether.resolveVersion(artifact)
val highest = versions?.highestVersion?.toString()
if (highest != null && highest != dep.id
&& Versions.toLongVersion(highest) > Versions.toLongVersion(dep.version)) {
val releases = versions?.versions?.filter { !it.toString().contains("SNAP")}
val highest = if (releases != null && releases.any()) {
releases.last().toString()
} else {
versions?.highestVersion.toString()
}
if (highest != dep.id
&& Versions.toLongVersion(highest) > Versions.toLongVersion(dep.version)) {
newVersions.add(artifact.groupId + ":" + artifact.artifactId + ":" + highest)
}
} catch(e: KobaltException) {