From 4b3103d345de6de8896aa7c604d8463becefed3d Mon Sep 17 00:00:00 2001 From: prudhvigodithi Date: Fri, 19 Aug 2022 15:36:29 -0400 Subject: [PATCH] add updateVersion task Signed-off-by: prudhvigodithi --- build.gradle | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6bd89770..c5e8e0e3 100644 --- a/build.gradle +++ b/build.gradle @@ -910,4 +910,15 @@ publishing { } } } -} \ No newline at end of file +} + +// 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 + ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) + } +}