From ecdb6907550cc7f75abc230f49a29428ed30c8d6 Mon Sep 17 00:00:00 2001 From: prudhvigodithi Date: Fri, 19 Aug 2022 15:26:01 -0400 Subject: [PATCH] add updateVersion task Signed-off-by: prudhvigodithi --- build.gradle | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build.gradle b/build.gradle index 43a39fb0..3a2ac86b 100644 --- a/build.gradle +++ b/build.gradle @@ -302,3 +302,15 @@ afterEvaluate { } } } + +// updateVersion: Task to auto increment to the next development iteration +task updateVersion { + onlyIf { System.getProperty('newVersion') } + doLast { + ext.newVersion = System.getProperty('newVersion') + println "Setting version to ${newVersion}." + // String tokenization to support -SNAPSHOT + // Include the required files that needs to be updated with new Version + ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) + } +}