diff --git a/build.gradle b/build.gradle index 5fa23d192..63779a569 100644 --- a/build.gradle +++ b/build.gradle @@ -703,3 +703,14 @@ mixedCluster { systemProperty 'cluster.mixed', "$mixedClusterFlag" systemProperty 'cluster.number_of_nodes', "${_numNodes}" } + +// 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) + } +}