blob: 801014e5a42eae999310b95f1adcfe5d5677b39e [file] [log] [blame]
Ben Gruver7d7ee582012-09-14 20:56:58 -07001subprojects {
2 apply plugin: 'java'
3
Ben Gruver5cf9fe72012-09-15 19:16:16 -07004 ext.baseVersion = '1.3.4'
5 ext.jarVersion = baseVersion
Ben Gruver7d1263a2012-09-15 16:54:20 -07006
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 Gruver5cf9fe72012-09-15 19:16:16 -070026 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 Gruver7d1263a2012-09-15 16:54:20 -070035 }
36 }
37
Ben Gruver7d7ee582012-09-14 20:56:58 -070038 repositories {
39 mavenCentral()
40 }
Ben Gruver7d1263a2012-09-15 16:54:20 -070041
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
49buildscript {
50 repositories {
51 mavenCentral()
52 }
53 dependencies {
54 classpath 'org.eclipse.jgit:org.eclipse.jgit:2.0.0.201206130900-r'
55 }
Ben Gruver7d7ee582012-09-14 20:56:58 -070056}