From ec7ae2fa4b4c09c8ffc3d5a6305e5c4b91af5d39 Mon Sep 17 00:00:00 2001 From: heatherlp Date: Wed, 7 Aug 2019 16:41:52 +0100 Subject: [PATCH] [FABN-1320] Fix git_tag.sh - so that it parses the build.gradle version - also specify a version and add a task to print it in the root level build.gradle Change-Id: I2bbe066e41237b764555057078de0fe04448cee6 Signed-off-by: heatherlp Signed-off-by: James Taylor --- build.gradle | 11 ++++++++++- scripts/gittag.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 scripts/gittag.sh diff --git a/build.gradle b/build.gradle index 8a422d6d..ff30168d 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,8 @@ apply plugin: 'idea' apply plugin: 'eclipse-wtp' +version = '1.3.1-SNAPSHOT' + allprojects { repositories { mavenLocal() @@ -19,7 +21,7 @@ subprojects { apply plugin: 'maven' group = 'org.hyperledger.fabric-chaincode-java' - version = '1.3.1-SNAPSHOT' + version = rootProject.version sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -33,4 +35,11 @@ subprojects { testCompile 'org.mockito:mockito-core:2.23.0' testCompile 'com.github.stefanbirkner:system-rules:1.17.0' } + tasks.withType(JavaCompile) { + options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" + } +} + +task printVersionName() { + println rootProject.version } diff --git a/scripts/gittag.sh b/scripts/gittag.sh new file mode 100755 index 00000000..1c408980 --- /dev/null +++ b/scripts/gittag.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Exit on first error, print all commands. +set -e +set -o pipefail +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" + +# release name +RELEASE=release-1.4 + +function abort { + echo "!! Exiting shell script" + echo "!!" "$1" + exit -1 +} + +# Run printVersionName task in the root directory, grab the first line and remove anything after the version number +VERSION=$(cd ../ && ./gradlew -q printVersionName | gsed -n 1p | gsed -r "s/-.*//") + +echo New version string will be v${VERSION} + +# do the release notes for this new version exist? +if [[ -f "${DIR}/release_notes/v${VERSION}.txt" ]]; then + echo "Release notes exist, hope they make sense!" +else + abort "No releases notes under the file ${DIR}/release_notes/v${NEW_VERSION}.txt exist"; +fi + +git checkout "${RELEASE}" +git pull +git tag -a "v${VERSION}" `git log -n 1 --pretty=oneline | head -c7` -F release_notes/"v${VERSION}".txt +git push origin v${VERSION} HEAD:refs/heads/${RELEASE} \ No newline at end of file