Skip to content
Merged
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
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -728,23 +728,23 @@ def generateAttributes() {
def micrometerDocsPrefix = "https://docs.micrometer.io"

return [
'project-version': project.version,
'spring-integration-docs': "$springDocs/spring-integration/reference".toString(),
'spring-framework-docs': "$springDocs/spring-framework/reference/${generateVersionWithoutPatch(springVersion)}".toString(),
'spring-retry-java-docs': "$springDocs/spring-retry/docs/$springRetryVersion/apidocs".toString(),
'javadoc-location-org-springframework-transaction': "$springDocs/spring-framework/docs/$springVersion/javadoc-api".toString(),
'javadoc-location-org-springframework-amqp': "$springDocs/spring-amqp/docs/$project.version/api".toString(),
'micrometer-docs': "$micrometerDocsPrefix/micrometer/reference/${generateVersionWithoutPatch(micrometerVersion)}".toString(),
'micrometer-tracing-docs': "$micrometerDocsPrefix/tracing/reference/${generateVersionWithoutPatch(micrometerTracingVersion)}".toString()
"project-version": project.version,
"spring-integration-docs": "$springDocs/spring-integration/reference".toString(),
"spring-framework-docs": "$springDocs/spring-framework/reference/${generateVersionWithoutPatch(springVersion)}".toString(),
"spring-retry-java-docs": "$springDocs/spring-retry/docs/$springRetryVersion/apidocs".toString(),
"javadoc-location-org-springframework-transaction": "$springDocs/spring-framework/docs/$springVersion/javadoc-api".toString(),
"javadoc-location-org-springframework-amqp": "$springDocs/spring-amqp/docs/$project.version/api".toString(),
"micrometer-docs": "$micrometerDocsPrefix/micrometer/reference/${generateVersionWithoutPatch(micrometerVersion)}".toString(),
"micrometer-tracing-docs": "$micrometerDocsPrefix/tracing/reference/${generateVersionWithoutPatch(micrometerTracingVersion)}".toString()
Copy link
Member

Choose a reason for hiding this comment

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

Why did you change to double quotes?
That is not Groovy way about static strings as map keys: https://www.jetbrains.com/help/inspectopedia/GroovyGStringKey.html

]
}

static String generateVersionWithoutPatch(String version) {

def matcher = version =~ /^(\d+.\d+).\d+(-SNAPSHOT)?$/
def matcher = version =~ /^(\d+.\d+).\d+(-SNAPSHOT|-M\d+)?$/
if(matcher) {

return matcher[0][2] == null
return matcher[0][2] == null || matcher[0][2].startsWith("-M")
Copy link
Member

Choose a reason for hiding this comment

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

There is also -RC.
But in general the algorithm for Antora versioning is MAJOR.MINOR + -SNAPSHOT if present.
So, please, revise this respectively.
Just wrote this Groovy script to be sure:

version = '7.0.1-SNAPSHOT'
majorMinor = version.split('\\.')[0,1].join('.')
println majorMinor + (version.endsWith('-SNAPSHOT') ? '-SNAPSHOT' : '')

Or just one line for your logic:

return version.split('\\.')[0,1].join('.') +  (version.endsWith('-SNAPSHOT') ? '-SNAPSHOT' : '')

? matcher[0][1]
: matcher[0][1] + matcher[0][2]
}
Expand Down