From 362fa3981060f3f838dc8f43d7eb00a18cbc5daa Mon Sep 17 00:00:00 2001 From: brian Date: Sat, 2 May 2020 17:22:53 +0100 Subject: [PATCH] feat: version artifacts using git --- build.gradle.kts | 29 ++++++++++++++++++++++++++--- gradle.properties | 3 +-- plugin/build.gradle.kts | 30 ------------------------------ 3 files changed, 27 insertions(+), 35 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index af70e88..eeffcad 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,6 +17,9 @@ import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask import io.exflo.gradle.tasks.IntellijRunConfiguratorTask import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import me.qoomon.gradle.gitversioning.GitVersioningPluginConfig +import me.qoomon.gradle.gitversioning.GitVersioningPluginConfig.* + plugins { `maven-publish` @@ -27,21 +30,42 @@ plugins { id("com.github.johnrengelman.shadow") version "5.2.0" apply true id("io.spring.dependency-management") version "1.0.9.RELEASE" id("com.github.ben-manes.versions") version "0.27.0" + id("me.qoomon.git-versioning") version "3.0.0" } if (!JavaVersion.current().isJava11Compatible) { throw GradleException("Java 11 or later is required to build Exflo. Detected version ${JavaVersion.current()}") } +version = "0.0.0-SNAPSHOT" + +gitVersioning.apply(closureOf { + branch(closureOf{ + pattern = "master" + versionFormat = "\${version}" + }) + branch(closureOf{ + pattern = "feature/(?.+)" + versionFormat = "\${feature}-SNAPSHOT" + }) + tag(closureOf{ + pattern = "v(?[0-9].*)" + versionFormat = "\${tagVersion}" + }) + commit(closureOf{ + versionFormat = "\${commit.short}" + }) +}) + val distZip: Zip by project.tasks distZip.apply { - dependsOn(":ingestion:kafka:build", ":ingestion:postgres:build") + dependsOn(":plugin:build") doFirst { delete { fileTree(Pair("build/distributions", "*.zip")) } } } val distTar: Tar by project.tasks distTar.apply { - dependsOn(":ingestion:kafka:build", ":ingestion:postgres:build") + dependsOn("plugin:build") doFirst { delete { fileTree(Pair("build/distributions", "*.tar.gz")) } } compression = Compression.GZIP archiveExtension.set("tar.gz") @@ -52,7 +76,6 @@ allprojects { apply(from = "${rootDir}/gradle/versions.gradle") group = "io.exflo" - version = rootProject.version repositories { mavenLocal() diff --git a/gradle.properties b/gradle.properties index c433874..e9f40da 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,5 +16,4 @@ # suppress inspection "UnusedProperty" for whole file org.gradle.jvmargs=-Xmx1g org.gradle.caching=true -org.gradle.parallel=true -version=0.1.0 \ No newline at end of file +org.gradle.parallel=true \ No newline at end of file diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index fe5703e..13119b0 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -28,36 +28,6 @@ dependencies { implementation(project(":ingestion:postgres")) } -publishing { - publications { - create("mavenJava") { - - groupId = "${rootProject.group}" - version = "${project.version}" - - project.shadow.component(this) - - pom { - name.set("Exflo - ${project.name}") - url.set("https://github.com/41North/exflo") - - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - - scm { - connection.set("scm:git:git://github.com/41North/exflo.git") - developerConnection.set("scm:git:ssh://github.com/41North/exflo.git") - url.set("https://github.com/41North/exflo") - } - } - } - } -} - val build: DefaultTask by project.tasks build.dependsOn(tasks.shadowJar)