Single version calculation in root projects

This commit is contained in:
Johannes Frohnmeyer 2022-04-28 22:43:08 +02:00
parent 5f55dcabf7
commit e425973c75
Signed by: Johannes
GPG Key ID: E76429612C2929F4
2 changed files with 7 additions and 11 deletions

View File

@ -3,9 +3,11 @@ plugins {
id 'maven-publish' id 'maven-publish'
} }
ext { var cl = Calendar.instance
versionPrefix = "0.1.0" var day = "${cl.get(cl.YEAR)}.${cl.get(cl.MONTH) + 1}.${cl.get(cl.DATE)}"
} var time = "${cl.get(cl.HOUR_OF_DAY)}.${cl.get(cl.MINUTE)}.${cl.get(cl.SECOND)}"
version = "0.1.0.$day.$time"
repositories { repositories {
mavenCentral() mavenCentral()
@ -27,10 +29,6 @@ publishing {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
groupId = 'io.gitlab.jfronny' groupId = 'io.gitlab.jfronny'
artifactId = 'commons' artifactId = 'commons'
var cl = Calendar.instance
var day = "${cl.get(cl.YEAR)}.${cl.get(cl.MONTH) + 1}.${cl.get(cl.DATE)}"
var time = "${cl.get(cl.HOUR_OF_DAY)}.${cl.get(cl.MINUTE)}.${cl.get(cl.SECOND)}"
version = "$versionPrefix.$day.$time"
from components.java from components.java
} }

View File

@ -4,6 +4,8 @@ plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2' id 'com.github.johnrengelman.shadow' version '7.1.2'
} }
version = rootProject.version
repositories { repositories {
mavenCentral() mavenCentral()
maven { maven {
@ -33,10 +35,6 @@ publishing {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
groupId = 'io.gitlab.jfronny' groupId = 'io.gitlab.jfronny'
artifactId = 'commons-gson' artifactId = 'commons-gson'
var cl = Calendar.instance
var day = "${cl.get(cl.YEAR)}.${cl.get(cl.MONTH) + 1}.${cl.get(cl.DATE)}"
var time = "${cl.get(cl.HOUR_OF_DAY)}.${cl.get(cl.MINUTE)}.${cl.get(cl.SECOND)}"
version = "${rootProject.versionPrefix}.$day.$time"
project.shadow.component(it) project.shadow.component(it)
} }