From 6c8bcdbeb250bd65dba129ac7c52df5bbf3ea6ef Mon Sep 17 00:00:00 2001 From: pgodithi Date: Sun, 10 Jul 2022 08:40:56 -0400 Subject: [PATCH 1/2] Version increment automation Signed-off-by: pgodithi --- build.gradle | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build.gradle b/build.gradle index 93e85374..5cbb9a75 100644 --- a/build.gradle +++ b/build.gradle @@ -302,3 +302,17 @@ afterEvaluate { } } } +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") + } + } + } +} \ No newline at end of file From 1ead8993e48d9c8bcfd1785b9da4f09fa9fc9138 Mon Sep 17 00:00:00 2001 From: pgodithi Date: Tue, 12 Jul 2022 17:40:50 -0400 Subject: [PATCH 2/2] Version increment automation: task rename updateVersion Signed-off-by: pgodithi --- build.gradle | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 5cbb9a75..aa88772d 100644 --- a/build.gradle +++ b/build.gradle @@ -302,17 +302,14 @@ afterEvaluate { } } } -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") - } - } + // 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