Created
May 29, 2018 17:13
-
-
Save philgebhardt/7860708d05929d81ab58ca94e0a2ae06 to your computer and use it in GitHub Desktop.
increment a project's gradle version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task increment { | |
doLast { | |
String patch=version.substring(version.lastIndexOf('.')+1) | |
int m=patch.toInteger()+1 | |
String majorMinor=version.substring(0,version.lastIndexOf('.')) | |
String s=buildFile.getText().replaceFirst("version='${version}'","version='${majorMinor}.${m}'") | |
buildFile.setText(s) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment