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') {
3838 .join(' \n ' )
3939 def outputFile = layout. buildDirectory. file(' generateAntora/antora.yml' ). get(). asFile
4040 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+ }
4452 def antoraYmlText = file(' antora.yml' ). text
4553 layout. buildDirectory. file(' .antora.yml' ). get(). asFile. text = antoraYmlText
4654 antoraYmlText = antoraYmlText. lines(). collect { l ->
4755 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} "
4957 }
5058 if (l. startsWith(' title: ' )) return " title: ${ project.parent.description} "
5159 return l == ' ext:' || l. getAt(0 ) == ' ' ? null : l
You can’t perform that action at this time.
0 commit comments