File tree Expand file tree Collapse file tree 2 files changed +45
-8
lines changed
Expand file tree Collapse file tree 2 files changed +45
-8
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,6 @@ plugins {
1616 id ' eclipse'
1717 id ' application'
1818 id ' org.graalvm.buildtools.native' version ' 0.9.28'
19- id ' net.researchgate.release' version ' 3.0.2'
20- }
21-
22- release {
23- git {
24- requireBranch. set(' ' ) // This removes the branch requirement
25- }
2619}
2720
2821repositories {
@@ -212,4 +205,48 @@ task createRelease {
212205
213206}
214207
208+ tasks. register(' bumpVersion' ) {
209+ description = ' Bumps the version number (patch, minor, or major)'
210+ group = ' Versioning'
211+
212+ doLast {
213+ def versionFile = file(' gradle.properties' )
214+ def versionFileText = versionFile. text
215+ def versionPattern = / version\s *=\s *(\d +)\. (\d +)\. (\d +)/
216+ def matcher = (versionFileText =~ versionPattern)
217+
218+ if (matcher. find()) {
219+ def major = matcher. group(1 ) as int
220+ def minor = matcher. group(2 ) as int
221+ def patch = matcher. group(3 ) as int
222+
223+ def bumpType = project. hasProperty(' bumpType' ) ? project. bumpType : ' patch'
224+
225+ switch (bumpType) {
226+ case ' major' :
227+ major++
228+ minor = 0
229+ patch = 0
230+ break
231+ case ' minor' :
232+ minor++
233+ patch = 0
234+ break
235+ case ' patch' :
236+ default :
237+ patch++
238+ break
239+ }
240+
241+ def newVersion = " ${ major} .${ minor} .${ patch} "
242+ def updatedContent = versionFileText. replaceFirst(versionPattern, " version=$newVersion " )
243+ versionFile. text = updatedContent
244+
245+ println " Version bumped to $newVersion "
246+ } else {
247+ throw new GradleException (" Version not found in gradle.properties" )
248+ }
249+ }
250+ }
251+
215252nativeCompile. finalizedBy copyNativeExecutable
Original file line number Diff line number Diff line change 1- version =1.0 .0
1+ version =0.1 .0
You can’t perform that action at this time.
0 commit comments