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

Fix the version range problem.

This commit is contained in:
Cedric Beust 2016-08-04 05:03:35 -08:00
parent 896b133d66
commit ef93dd523e

View file

@ -142,7 +142,7 @@ class Aether(localRepo: File, val settings: KobaltSettings, val eventBus: EventB
private val kobaltRepositories: List<RemoteRepository> private val kobaltRepositories: List<RemoteRepository>
get() = Kobalt.repos.map { get() = Kobalt.repos.map {
RemoteRepository.Builder("maven", "default", it.url) RemoteRepository.Builder(null, "default", it.url)
// .setSnapshotPolicy(RepositoryPolicy(false, null, null)) // .setSnapshotPolicy(RepositoryPolicy(false, null, null))
.build().let { repository -> .build().let { repository ->
val proxyConfigs = settings.proxyConfigs ?: return@map repository val proxyConfigs = settings.proxyConfigs ?: return@map repository
@ -152,14 +152,8 @@ class Aether(localRepo: File, val settings: KobaltSettings, val eventBus: EventB
} }
} }
private fun rangeRequest(a: Artifact): VersionRangeRequest { private fun rangeRequest(a: Artifact): VersionRangeRequest
with(VersionRangeRequest()) { = VersionRangeRequest(a, kobaltRepositories, "RELEASE")
artifact = a
repositories = kobaltRepositories
return this
}
}
private fun collectRequest(artifact: Artifact, scope: Scope?): CollectRequest { private fun collectRequest(artifact: Artifact, scope: Scope?): CollectRequest {
with(CollectRequest()) { with(CollectRequest()) {
@ -209,7 +203,7 @@ class Aether(localRepo: File, val settings: KobaltSettings, val eventBus: EventB
if (KobaltAether.isRangeVersion(artifact.version)) { if (KobaltAether.isRangeVersion(artifact.version)) {
val request = rangeRequest(artifact) val request = rangeRequest(artifact)
val v = system.resolveVersionRange(session, request) val v = system.resolveVersionRange(session, request)
val highestVersion = v.versions.last { ! it.toString().contains("-")}.toString() val highestVersion = v.highestVersion.toString()
val ar = DefaultArtifact(artifact.groupId, artifact.artifactId, artifact.classifier, val ar = DefaultArtifact(artifact.groupId, artifact.artifactId, artifact.classifier,
artifact.extension, highestVersion) artifact.extension, highestVersion)
listOf(AetherResult(ar, request.repositories[0])) listOf(AetherResult(ar, request.repositories[0]))