60 lines
1.2 KiB
Groovy
60 lines
1.2 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'application'
|
|
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
|
|
id 'com.github.ben-manes.versions' version '0.51.0'
|
|
}
|
|
|
|
// ./gradlew
|
|
// ./gradlew incrementPatch run
|
|
// ./gradlew incrementMinor run
|
|
// ./gradlew incrementMajor run
|
|
// ./gradlew incrementBuildMeta run
|
|
// ./gradlew echoVersion
|
|
|
|
defaultTasks 'run'
|
|
|
|
mainClassName = 'App'
|
|
|
|
dependencies {
|
|
testImplementation platform('org.junit:junit-bom:5.10.2')
|
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
semver {
|
|
// properties = 'example.properties'
|
|
// keysPrefix = 'example.'
|
|
// preReleaseKey = 'release'
|
|
// buildMetaKey = 'meta'
|
|
}
|
|
|
|
incrementBuildMeta {
|
|
doFirst {
|
|
// buildMeta = sprintf("%03d", (buildMeta as Integer) + 1)
|
|
buildMeta = new Date().format("yyyyMMddHHmmss")
|
|
}
|
|
}
|
|
|
|
run {
|
|
// project.afterEvaluate {
|
|
// println "Version: $version"
|
|
// }
|
|
doFirst {
|
|
println "Version: $version"
|
|
}
|
|
|
|
// args = ['example.properties']
|
|
args = ['version.properties']
|
|
}
|
|
|
|
task echoVersion(type:Exec) {
|
|
commandLine('echo', "${-> project.version}")
|
|
}
|