From 87d1864ce606fbff651b8d192dbd69b84d75204e Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Mon, 22 Aug 2022 11:01:48 -0700 Subject: [PATCH] add updateVersion task (#223) Signed-off-by: prudhvigodithi 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) + } +}