This commit is contained in:
Erik C. Thauvin 2021-05-31 12:12:43 -07:00
parent d19857bdd7
commit 5e6a29fbe0
7 changed files with 49 additions and 50 deletions

View file

@ -49,7 +49,7 @@ or in your `gradle.build` file:
```gradle ```gradle
someTask { someTask {
dependsOn(incrementPatch) dependsOn incrementPatch
... ...
} }
``` ```
@ -178,7 +178,7 @@ But, for example, if you wanted to save the version properties in a different fi
```gradle ```gradle
semver { semver {
properties = "my.version" // read and save properties in "my.version" properties = 'my.version' // read and save properties in "my.version"
} }
``` ```
@ -186,13 +186,13 @@ or using different property keys for the version data:
```gradle ```gradle
semver { semver {
keysPrefix = "" // no prefix keysPrefix = '' // no prefix
semverKey = "version" semverKey = 'version'
majorKey = "maj" majorKey = 'maj'
minorKey = "min" minorKey = 'min'
patchKey = "build" patchKey = 'build'
preReleaseKey = "rel" preReleaseKey = 'rel'
buildMetaKey = "meta" buildMetaKey = 'meta'
} }
``` ```
which would match the data in `my.version`: which would match the data in `my.version`:
@ -227,8 +227,8 @@ In order to quickly support multiple projects. The `keysPrefix` property is avai
```gradle ```gradle
semver { semver {
properties = "test.properties" properties = 'test.properties'
keysPrefix = "test." keysPrefix = 'test.'
} }
``` ```

View file

@ -3,25 +3,24 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins { plugins {
java id("com.github.ben-manes.versions") version "0.39.0"
`java-gradle-plugin` id("com.gradle.plugin-publish") version "0.15.0"
`maven-publish`
jacoco
kotlin("jvm") version "1.4.31" // Don't upgrade until kotlin-dsl plugin is upgraded.
id("com.github.ben-manes.versions") version "0.38.0"
id("com.gradle.plugin-publish") version "0.14.0"
id("io.gitlab.arturbosch.detekt") version "1.17.1" id("io.gitlab.arturbosch.detekt") version "1.17.1"
id("jacoco")
id("java")
id("java-gradle-plugin")
id("maven-publish")
id("org.gradle.kotlin.kotlin-dsl") version "2.1.4" id("org.gradle.kotlin.kotlin-dsl") version "2.1.4"
id("org.sonarqube") version "3.2.0" id("org.sonarqube") version "3.2.0"
kotlin("jvm") version "1.4.31" // Don't upgrade until kotlin-dsl plugin is upgraded.
} }
version = "1.0.5" version = "1.0.5"
group = "net.thauvin.erik.gradle" group = "net.thauvin.erik.gradle"
object VersionInfo { object Versions {
const val spek = "2.0.15" // Don't upgrade until 2.0.17 const val SPEK = "2.0.15" // Don't upgrade until 2.0.17
} }
val versions: VersionInfo by extra { VersionInfo }
val github = "https://github.com/ethauvin/semver-gradle" val github = "https://github.com/ethauvin/semver-gradle"
val packageName = "net.thauvin.erik.gradle.semver" val packageName = "net.thauvin.erik.gradle.semver"
@ -34,7 +33,7 @@ repositories {
dependencies { dependencies {
implementation(gradleApi()) implementation(gradleApi())
implementation(platform("org.jetbrains.kotlin:kotlin-bom")) implementation(platform(kotlin("bom")))
implementation(kotlin("stdlib")) implementation(kotlin("stdlib"))
testImplementation(kotlin("reflect")) testImplementation(kotlin("reflect"))
@ -42,8 +41,8 @@ dependencies {
//testImplementation(gradleTestKit()) //testImplementation(gradleTestKit())
testImplementation("org.spekframework.spek2:spek-dsl-jvm:${versions.spek}") testImplementation("org.spekframework.spek2:spek-dsl-jvm:${Versions.SPEK}")
testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:${versions.spek}") testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:${Versions.SPEK}")
} }
tasks { tasks {
@ -58,7 +57,7 @@ tasks {
withType<Test> { withType<Test> {
testLogging { testLogging {
exceptionFormat = TestExceptionFormat.FULL exceptionFormat = TestExceptionFormat.FULL
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) events = setOf(TestLogEvent.SKIPPED, TestLogEvent.FAILED)
} }
useJUnitPlatform { useJUnitPlatform {

View file

@ -14,7 +14,7 @@ mainClassName = 'com.example.Example'
defaultTasks 'run' defaultTasks 'run'
def semverProcessor = "net.thauvin.erik:semver:1.2.0" def semverProcessor = 'net.thauvin.erik:semver:1.2.0'
dependencies { dependencies {
annotationProcessor semverProcessor annotationProcessor semverProcessor
@ -41,8 +41,8 @@ run {
} }
semver { semver {
// properties = "example.properties" // properties = 'example.properties'
// keysPrefix = "example." // keysPrefix = 'example.'
// preReleaseKey = "release" // preReleaseKey = 'release'
// buildMetaKey = "meta" // buildMetaKey = 'meta'
} }

View file

@ -1,9 +1,9 @@
plugins { plugins {
kotlin("jvm").version("1.5.0") id("application")
application id("com.github.ben-manes.versions") version "0.38.0"
id("org.jetbrains.kotlin.kapt").version("1.5.0") id("net.thauvin.erik.gradle.semver") version "1.0.4"
id("net.thauvin.erik.gradle.semver").version("1.0.4") kotlin("jvm") version "1.5.0"
id("com.github.ben-manes.versions").version("0.38.0") kotlin("kapt") version "1.5.0"
} }
// ./gradlew // ./gradlew

View file

@ -2,7 +2,7 @@ plugins {
id 'java' id 'java'
id 'application' id 'application'
id 'net.thauvin.erik.gradle.semver' version '1.0.4' id 'net.thauvin.erik.gradle.semver' version '1.0.4'
id 'com.github.ben-manes.versions' version '0.38.0' id 'com.github.ben-manes.versions' version '0.39.0'
} }
// ./gradlew // ./gradlew
@ -36,10 +36,10 @@ application {
} }
semver { semver {
// properties = "example.properties" // properties = 'example.properties'
// keysPrefix = "example." // keysPrefix = 'example.'
// preReleaseKey = "release" // preReleaseKey = 'release'
// buildMetaKey = "meta" // buildMetaKey = 'meta'
} }
incrementBuildMeta { incrementBuildMeta {
@ -60,5 +60,5 @@ run {
} }
task echoVersion(type:Exec) { task echoVersion(type:Exec) {
commandLine 'echo', "${-> project.version}" commandLine('echo', "${-> project.version}")
} }

View file

@ -4,10 +4,10 @@ import java.time.LocalDateTime
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
plugins { plugins {
kotlin("jvm").version("1.5.0") id("application")
application id("com.github.ben-manes.versions") version "0.39.0"
id("net.thauvin.erik.gradle.semver").version("1.0.4") id("net.thauvin.erik.gradle.semver") version "1.0.4"
id("com.github.ben-manes.versions").version("0.38.0") kotlin("jvm") version "1.5.10"
} }
// ./gradlew // ./gradlew

View file

@ -4,7 +4,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath "net.thauvin.erik.gradle:semver:1.0.5-beta" classpath 'net.thauvin.erik.gradle:semver:1.0.5-beta'
} }
} }
@ -31,9 +31,9 @@ repositories {
} }
application { application {
println(project.version) println project.version
project.afterEvaluate { project.afterEvaluate {
println(project.version) println project.version
} }
} }
@ -47,13 +47,13 @@ incrementBuildMeta {
run { run {
doFirst { doFirst {
println("Version: $semver.major$semver.separator$semver.minor$semver.separator$semver.patch$semver.preReleasePrefix$semver.preRelease$semver.buildMetaPrefix$semver.buildMeta") println "Version: $semver.major$semver.separator$semver.minor$semver.separator$semver.patch$semver.preReleasePrefix$semver.preRelease$semver.buildMetaPrefix$semver.buildMeta"
args = [f.name] args = [f.name]
} }
} }
task echoVersion(type:Exec) { task echoVersion(type:Exec) {
commandLine "echo", "${-> version}" commandLine('echo', "${-> version}")
} }
semver { semver {