From 5bc41e3859af883e16049f3805535f7b6cc854de Mon Sep 17 00:00:00 2001 From: pgodithi Date: Mon, 11 Jul 2022 13:53:35 -0400 Subject: [PATCH 1/2] Version increment automation Signed-off-by: pgodithi --- build.gradle | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build.gradle b/build.gradle index f6437aabf..8fc198856 100644 --- a/build.gradle +++ b/build.gradle @@ -703,3 +703,19 @@ mixedCluster { systemProperty 'cluster.mixed', "$mixedClusterFlag" systemProperty 'cluster.number_of_nodes', "${_numNodes}" } + +// versionIncrement: Task to auto increment to the next development iteration +task versionIncrement { + onlyIf { System.getProperty('newVersion') } + doLast { + ext.newVersion = System.getProperty('newVersion') + println "Setting version to ${newVersion}." + // String tokenization to support -SNAPSHOT + ant.replaceregexp(match: opensearch_version.tokenize('-')[0], replace: newVersion.tokenize('-')[0], flags:'g', byline:true) { + fileset(dir: projectDir) { + // Include the required files that needs to be updated with new Version + include(name: "build.gradle") + } + } + } +} From 5afc57566a0bc96307b4dbe1a4722bc2321913a3 Mon Sep 17 00:00:00 2001 From: pgodithi Date: Tue, 12 Jul 2022 18:42:35 -0400 Subject: [PATCH 2/2] Version increment automation: task rename updateVersion Signed-off-by: pgodithi --- build.gradle | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 8fc198856..62b3725a0 100644 --- a/build.gradle +++ b/build.gradle @@ -704,18 +704,13 @@ mixedCluster { systemProperty 'cluster.number_of_nodes', "${_numNodes}" } -// versionIncrement: Task to auto increment to the next development iteration -task versionIncrement { +// 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(match: opensearch_version.tokenize('-')[0], replace: newVersion.tokenize('-')[0], flags:'g', byline:true) { - fileset(dir: projectDir) { - // Include the required files that needs to be updated with new Version - include(name: "build.gradle") - } - } + ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) } }