File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -38,14 +38,22 @@ tasks.register('generateAntora') {
38
38
.join(' \n ' )
39
39
def outputFile = layout. buildDirectory. file(' generateAntora/antora.yml' ). get(). asFile
40
40
mkdir(outputFile. getParentFile())
41
- def components = project. version. split(/ (?=-)/ )
42
- def mainVersion = components[0 ];
43
- def prerelease = components. length > 1 ? components[1 ] : null
41
+ def mainVersion = project. version
42
+ def prerelease = null
43
+ def versionComponents = mainVersion. split(/ (?=-)/ )
44
+ if (versionComponents. length > 1 ) {
45
+ if (versionComponents[1 ] == ' -SNAPSHOT' ) {
46
+ mainVersion = versionComponents[0 ]
47
+ prerelease = " '-SNAPSHOT'"
48
+ } else {
49
+ prerelease = ' true'
50
+ }
51
+ }
44
52
def antoraYmlText = file(' antora.yml' ). text
45
53
layout. buildDirectory. file(' .antora.yml' ). get(). asFile. text = antoraYmlText
46
54
antoraYmlText = antoraYmlText. lines(). collect { l ->
47
55
if (l. startsWith(' version: ' )) {
48
- return prerelease == null ? " version: '${ mainVersion} '" : " version: '${ mainVersion} '\n prerelease: ' ${ prerelease} ' "
56
+ return prerelease == null ? " version: '${ mainVersion} '" : " version: '${ mainVersion} '\n prerelease: ${ prerelease} "
49
57
}
50
58
if (l. startsWith(' title: ' )) return " title: ${ project.parent.description} "
51
59
return l == ' ext:' || l. getAt(0 ) == ' ' ? null : l
You can’t perform that action at this time.
0 commit comments