From 7a3ec96b93e8b315c1ad901764f1d6f32970ae1a Mon Sep 17 00:00:00 2001 From: pgodithi Date: Mon, 11 Jul 2022 13:31:09 -0400 Subject: [PATCH 1/2] Version increment automation Signed-off-by: pgodithi --- build.gradle | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build.gradle b/build.gradle index 0e68e8f04..df38e295f 100644 --- a/build.gradle +++ b/build.gradle @@ -93,3 +93,20 @@ allprojects { evaluationDependsOnChildren() check.dependsOn subprojects*.check + +// 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: "alerting/build.gradle") + include(name: "build.gradle") + } + } + } +} \ No newline at end of file From 707fd3e24785d9224b01ab338897ab47caad038b Mon Sep 17 00:00:00 2001 From: pgodithi Date: Tue, 12 Jul 2022 18:38:29 -0400 Subject: [PATCH 2/2] Version increment automation: task rename updateVersion Signed-off-by: pgodithi --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index df38e295f..26695687c 100644 --- a/build.gradle +++ b/build.gradle @@ -94,8 +94,8 @@ evaluationDependsOnChildren() check.dependsOn subprojects*.check -// 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') @@ -105,8 +105,8 @@ task versionIncrement { fileset(dir: projectDir) { // Include the required files that needs to be updated with new Version include(name: "alerting/build.gradle") - include(name: "build.gradle") } } + 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