update gradle script to detect version from tag.

parent 60ff9529
Pipeline #521 failed with stages
in 1 minute and 29 seconds
...@@ -22,7 +22,7 @@ buildscript { ...@@ -22,7 +22,7 @@ buildscript {
} }
dependencies { dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.7.2') classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.9.0')
} }
} }
...@@ -34,6 +34,28 @@ apply plugin: 'maven' ...@@ -34,6 +34,28 @@ apply plugin: 'maven'
apply plugin: 'com.jfrog.artifactory' apply plugin: 'com.jfrog.artifactory'
apply plugin: 'signing' apply plugin: 'signing'
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
ext {
defVersion = '0.1.49'
lastVersion = ['sh', '-c', 'git describe --abbrev=0'].execute().text.trim() ?: defVersion
devVersion = lastVersion + '-SNAPSHOT'
versionStringTagPrefix = 'v'
CI_COMMIT_REF_NAME = System.getenv("CI_COMMIT_REF_NAME")
CI_COMMIT_TAG = System.getenv("CI_COMMIT_TAG")
versionString = CI_COMMIT_TAG?.startsWith(versionStringTagPrefix) ? CI_COMMIT_TAG.substring(versionStringTagPrefix.length()) : devVersion
artifactory_publishRepo = versionString.toString().endsWith("-SNAPSHOT") ? 'gradle-dev-local' : 'gradle-release-local'
}
version = project.ext.versionString
group = 'ca.bulltech.util'
repositories { repositories {
maven { maven {
url "${local_combined_url}" url "${local_combined_url}"
...@@ -83,12 +105,6 @@ dependencies { ...@@ -83,12 +105,6 @@ dependencies {
testImplementation 'ch.qos.logback:logback-core:1.2.3' testImplementation 'ch.qos.logback:logback-core:1.2.3'
} }
version = '0.1.49'
group = 'ca.bulltech.util'
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
test { test {
useJUnitPlatform() useJUnitPlatform()
...@@ -225,7 +241,7 @@ artifactory { ...@@ -225,7 +241,7 @@ artifactory {
publish { publish {
repository { repository {
repoKey = 'gradle-dev-local' repoKey = project.ext.artifactory_publishRepo
username = artifactory_username username = artifactory_username
password = artifactory_password password = artifactory_password
maven = true maven = true
...@@ -248,7 +264,7 @@ artifactory { ...@@ -248,7 +264,7 @@ artifactory {
} }
resolve { resolve {
repository { repository {
repoKey = 'gradle-dev' repoKey = project.ext.artifactory_publishRepo
username = artifactory_username username = artifactory_username
password = artifactory_password password = artifactory_password
maven = true maven = true
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="util" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="ca.bulltech.util" external.system.module.version="0.1.49" type="JAVA_MODULE" version="4"> <module external.linked.project.id="util" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="ca.bulltech.util" external.system.module.version="0.1.49-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/out/production/classes" /> <output url="file://$MODULE_DIR$/out/production/classes" />
<output-test url="file://$MODULE_DIR$/out/test/classes" /> <output-test url="file://$MODULE_DIR$/out/test/classes" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment