Ben Gruver | 7d7ee58 | 2012-09-14 20:56:58 -0700 | [diff] [blame] | 1 | subprojects { |
| 2 | apply plugin: 'java' |
| 3 | |
Ben Gruver | 5cf9fe7 | 2012-09-15 19:16:16 -0700 | [diff] [blame^] | 4 | ext.baseVersion = '1.3.4' |
| 5 | ext.jarVersion = baseVersion |
Ben Gruver | 7d1263a | 2012-09-15 16:54:20 -0700 | [diff] [blame] | 6 | |
| 7 | // For non-release builds, we want to append the commit and |
| 8 | // dirty status to the version |
| 9 | gradle.taskGraph.whenReady { |
| 10 | if (!it.hasTask(release)) { |
| 11 | def versionSuffix |
| 12 | try { |
| 13 | def git = org.eclipse.jgit.api.Git.open(file('.')) |
| 14 | def head = git.getRepository().getRef("HEAD") |
| 15 | versionSuffix = head.getObjectId().abbreviate(8).name() |
| 16 | |
| 17 | if (!git.status().call().clean) { |
| 18 | versionSuffix += '-dirty' |
| 19 | } |
| 20 | } catch (Exception) { |
| 21 | // In case we can't get the commit for some reason, |
| 22 | // just use -dev |
| 23 | versionSuffix = 'dev' |
| 24 | } |
| 25 | |
Ben Gruver | 5cf9fe7 | 2012-09-15 19:16:16 -0700 | [diff] [blame^] | 26 | version = baseVersion + '-' + versionSuffix |
| 27 | |
| 28 | // use <version>-dev for the jar name, rather than the |
| 29 | // full commit+dirty string |
| 30 | jarVersion = baseVersion + '-dev' |
| 31 | } |
| 32 | |
| 33 | jar { |
| 34 | version = jarVersion |
Ben Gruver | 7d1263a | 2012-09-15 16:54:20 -0700 | [diff] [blame] | 35 | } |
| 36 | } |
| 37 | |
Ben Gruver | 7d7ee58 | 2012-09-14 20:56:58 -0700 | [diff] [blame] | 38 | repositories { |
| 39 | mavenCentral() |
| 40 | } |
Ben Gruver | 7d1263a | 2012-09-15 16:54:20 -0700 | [diff] [blame] | 41 | |
| 42 | // Note: please don't use this. This is strictly for the official releases |
| 43 | // that are posted on the googlecode download page. |
| 44 | task release { |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | |
| 49 | buildscript { |
| 50 | repositories { |
| 51 | mavenCentral() |
| 52 | } |
| 53 | dependencies { |
| 54 | classpath 'org.eclipse.jgit:org.eclipse.jgit:2.0.0.201206130900-r' |
| 55 | } |
Ben Gruver | 7d7ee58 | 2012-09-14 20:56:58 -0700 | [diff] [blame] | 56 | } |