123456789101112131415161718192021222324252627 |
- ext.getGitVersionCode = { ->
- try {
- def stdout = new ByteArrayOutputStream()
- exec {
- commandLine 'git', 'rev-list', '--first-parent', '--count', 'master'
- standardOutput = stdout
- }
- return Integer.parseInt(stdout.toString().trim())
- }
- catch (ignored) {
- return -1;
- }
- }
- ext.getGitVersionName = { ->
- try {
- def stdout = new ByteArrayOutputStream()
- exec {
- commandLine 'git', 'describe', '--always', '--tags', '--dirty'
- standardOutput = stdout
- }
- return stdout.toString().trim()
- }
- catch (ignored) {
- return null;
- }
- }
|