blob: 00ebfba48f98e69d6fb614035431e9b0cafcd220 [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'
Ben Gruverc9afead2012-09-15 22:56:10 -070031 } else {
32 version = baseVersion
Ben Gruver5cf9fe72012-09-15 19:16:16 -070033 }
34
35 jar {
36 version = jarVersion
Ben Gruver7d1263a2012-09-15 16:54:20 -070037 }
38 }
39
Ben Gruver7d7ee582012-09-14 20:56:58 -070040 repositories {
41 mavenCentral()
42 }
Ben Gruver7d1263a2012-09-15 16:54:20 -070043
44 // Note: please don't use this. This is strictly for the official releases
45 // that are posted on the googlecode download page.
46 task release {
47 }
48}
49
50
51buildscript {
52 repositories {
53 mavenCentral()
54 }
55 dependencies {
56 classpath 'org.eclipse.jgit:org.eclipse.jgit:2.0.0.201206130900-r'
57 }
Ben Gruver7d7ee582012-09-14 20:56:58 -070058}