Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,29 @@ configurations.all {
resolutionStrategy.force 'commons-codec:commons-codec:1.13'
resolutionStrategy.force 'com.google.guava:guava:31.0.1-jre'
}

// 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: ".github/workflows/sql-workbench-test-and-build-workflow.yml")
include(name: "doctest/build.gradle")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you also remove this? we don't have version defined in doctest/build.gradle

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed in my latest commit @joshuali925

include(name: "build.gradle")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more question, is matching opensearch_version.tokenize('-')[0] enough on build.gradle? e.g. should patterns be more strict to avoid accidentally matching other dependency versions or this is enough?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I can add more restrictive parsing, will push in my latest commit.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check now @joshuali925
Sample PR with new change: prudhvigodithi#2
Does this sample PR for version increment looks good?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved, last question: i see it's hard coded to use snapshot in build.gradle + '-SNAPSHOT"', will there be a case we use x.x.x instead of x.x.x-SNAPSHOT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So until now we all build with -SNAPSHOT except during main release.
@bbarani @peterzhuamazon

}
}
ant.replaceregexp(file:'sql-jdbc/build.gradle', match:"version '\\d+.\\d+.\\d+.\\d+'", replace:"version " + "'" + newVersion.tokenize('-')[0] + '.0' + "'", flags:'g', byline:true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you remove this line? sql-jdbc was accidentally bumped in previous PR, but it's a driver and the version should be independent

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So @joshuali925 there is no version increment in this file sql-jdbc/build.gradle'?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed in my latest commit @joshuali925

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. the latest sql-jdbc release is 1.1.0.1, the next one should be 1.2.0.0 or 2.0.0.0 depending on the changes, but should not be the same version as core and plugins

ant.replaceregexp(match:'"version": "\\d+.\\d+.\\d+.\\d+', replace:'"version": ' + '"' + newVersion.tokenize('-')[0] + '.0', flags:'g', byline:true) {
fileset(dir: projectDir) {
include(name: "workbench/package.json")
include(name: "workbench/opensearch_dashboards.json")
}
}
ant.replaceregexp(file:'workbench/opensearch_dashboards.json', match:'"opensearchDashboardsVersion": "\\d+.\\d+.\\d+', replace:'"opensearchDashboardsVersion": ' + '"' + newVersion.tokenize('-')[0], flags:'g', byline:true)
}
}