From ec0473510456ed22e1784bce09ef3beaf0315af9 Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Tue, 26 Jul 2022 17:42:42 -0400 Subject: [PATCH] Staging for version increment automation (#362) * Version increment automation Signed-off-by: pgodithi * Version increment automation: task rename updateVersion Signed-off-by: pgodithi (cherry picked from commit e51211b2001e711f4f774a6e5e078cff1ae1cee5) Signed-off-by: prudhvigodithi --- build.gradle | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build.gradle b/build.gradle index d813c044c6..959840d973 100644 --- a/build.gradle +++ b/build.gradle @@ -74,3 +74,15 @@ ext { dependencies { implementation 'junit:junit:4.12' } + +// 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) + } +} \ No newline at end of file