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 {
16
16
id ' eclipse'
17
17
id ' application'
18
18
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
- }
26
19
}
27
20
28
21
repositories {
@@ -212,4 +205,48 @@ task createRelease {
212
205
213
206
}
214
207
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
+
215
252
nativeCompile. 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