Skip to content

Instantly share code, notes, and snippets.

@yarinkos
Created August 7, 2018 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yarinkos/0f006da5a624f9d16629201a8e1794ef to your computer and use it in GitHub Desktop.
Save yarinkos/0f006da5a624f9d16629201a8e1794ef to your computer and use it in GitHub Desktop.
groovy version upgrade
version='1.0.11.1001'
// task incrementrevsion{
def v = version
println v
String minor=v.substring(v.lastIndexOf('.')+1) //get last digit
int m=minor.toInteger()+1 //increment
// println m
String major=v.substring(0,v.lastIndexOf(".")); //get the beginning
// println major
String newVersion = major+"."+m
print newVersion
//String s=buildFile.getText().replaceFirst("version='$version'","version='"+major+ "." +m+"'")
//println s
//buildFile.setText(s) //replace the build file's text
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment