Auto-updatable version ranges

This commit improves the version format so that the minor and patch
elements can hold a special 'x' character besides the version, i.e.
`1.x.x.RELEASE` or `2.4.x.BUILD-SNAPSHOT`. A `VersionParser` now takes
care to resolve those against a list of known Spring Boot versions.

This is particularly useful in version ranges that have to change when
the latest Spring Boot versions change. Spring Initializr already auto-
udpates itself based on the sagan metadata. When a range is using this
feature, it is also automatically updated.

It might be hard to track the actual range values on a given instance so
an `InfoContributor` is now automatically exposed to list them.

Closes gh-328
This commit is contained in:
Stephane Nicoll
2016-12-06 16:39:23 +01:00
parent 814a4ad260
commit 827b9d6e93
22 changed files with 673 additions and 148 deletions

View File

@@ -55,8 +55,7 @@ class DefaultInitializrMetadataProvider implements InitializrMetadataProvider {
if (!bootVersions.find { it.default }) { // No default specified
bootVersions[0].default = true
}
metadata.bootVersions.content.clear()
metadata.bootVersions.content.addAll(bootVersions)
metadata.updateSpringBootVersions(bootVersions)
}
}

View File

@@ -22,7 +22,6 @@ import groovy.json.JsonBuilder
import io.spring.initializr.metadata.Dependency
import io.spring.initializr.metadata.InitializrMetadataProvider
import io.spring.initializr.util.Version
import io.spring.initializr.util.VersionRange
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.MediaType
@@ -52,7 +51,7 @@ class UiController {
dependencyGroups.each { g ->
g.content.each { d ->
if (v && d.versionRange) {
if (VersionRange.parse(d.versionRange).match(v)) {
if (d.match(v)) {
content << new DependencyItem(g.name, d)
}
} else {