From 0faa7fe76a1366d020ba817fee2258458c69134a Mon Sep 17 00:00:00 2001 From: Cyrille Artho Date: Thu, 15 Nov 2018 09:30:23 +1000 Subject: [PATCH] modified: build.gradle: Put JPF version into JAR metadata by retrieving latest tag (to use it as the version string). --- build.gradle | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 03f03ef..26ff9ba 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,5 @@ apply plugin: "java" -def getCurrentVersion() { - "DEVELOPMENT-SNAPSHOT" -} - -version = currentVersion - sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -13,15 +7,31 @@ repositories { mavenCentral() } +buildscript { + repositories { + maven { + url "https://plugins.gradle.org/m2/" + } + } + dependencies { + classpath "gradle.plugin.com.palantir.gradle.gitversion:gradle-git-version:0.11.0" + } +} + dependencies { testImplementation "junit:junit:4.12" } +apply plugin: "com.palantir.git-version" +version gitVersion() +def gitDetails = versionDetails() + ext.manifestCommonAttrbutes = manifest { attributes( "Built-By": System.getProperty("user.name"), "Implementation-Vendor": "NASA Ames Research Center", - "Implementation-Version": version + "Specification-Version": gitDetails.lastTag, + "Implementation-Version": gitDetails.gitHashFull ) } -- 2.34.1