|
@@ -1,9 +1,16 @@
|
1
|
|
-// DMDirc plugins build script
|
|
1
|
+import org.eclipse.jgit.api.Git
|
|
2
|
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder
|
|
3
|
+
|
2
|
4
|
subprojects {
|
3
|
|
- def jgit = new org.mdonoughe.JGitDescribeTask()
|
4
|
|
- jgit.dir = new File(projectDir.parent, '.git')
|
5
|
|
- jgit.subDir = projectDir
|
6
|
|
- project.version = jgit.getDescription() + '-SNAPSHOT'
|
|
5
|
+ def gitdir = new File(projectDir.parent, '.git')
|
|
6
|
+ if (gitdir.isFile()) {
|
|
7
|
+ gitdir = new File(projectDir.parent, gitdir.text.replace('gitdir: ','').trim())
|
|
8
|
+ }
|
|
9
|
+
|
|
10
|
+ def repo = new FileRepositoryBuilder().setGitDir(gitdir).build()
|
|
11
|
+ def git = Git.wrap(repo)
|
|
12
|
+ def objectId = git.log().addPath(projectDir.name).setMaxCount(1).call().first().id
|
|
13
|
+ project.version = git.describe().setTarget(objectId).call() + '-SNAPSHOT'
|
7
|
14
|
|
8
|
15
|
apply plugin: 'java'
|
9
|
16
|
apply plugin: 'findbugs'
|
|
@@ -145,8 +152,7 @@ buildscript {
|
145
|
152
|
}
|
146
|
153
|
|
147
|
154
|
dependencies {
|
148
|
|
- classpath group: 'com.github.shanemcc', name: 'jgit-describe', version: '0.5'
|
149
|
|
- classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '2.3.1.+'
|
|
155
|
+ classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '3.6.1.201501031845-r'
|
150
|
156
|
}
|
151
|
157
|
}
|
152
|
158
|
|