Browse Source

Rewrite the entire git-version thingy.

pull/441/head
Chris Smith 9 years ago
parent
commit
3be80e6504
1 changed files with 11 additions and 5 deletions
  1. 11
    5
      build.gradle

+ 11
- 5
build.gradle View File

@@ -1,6 +1,13 @@
1
-def jgit = new org.mdonoughe.JGitDescribeTask()
2
-jgit.dir = new File(projectDir, '.git')
3
-project.version = jgit.getDescription() + '-SNAPSHOT'
1
+import org.eclipse.jgit.api.Git
2
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder
3
+
4
+def gitdir = new File(projectDir, '.git')
5
+if (gitdir.isFile()) {
6
+  gitdir = new File(projectDir, gitdir.text.replace('gitdir: ','').trim())
7
+}
8
+
9
+def repo = new FileRepositoryBuilder().setGitDir(gitdir).build()
10
+project.version = Git.wrap(repo).describe().call() + '-SNAPSHOT'
4 11
 
5 12
 group = 'com.dmdirc'
6 13
 
@@ -76,8 +83,7 @@ buildscript {
76 83
     }
77 84
 
78 85
     dependencies {
79
-        classpath group: 'com.github.shanemcc', name: 'jgit-describe', version: '0.5'
80
-        classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '2.3.1.+'
86
+        classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '3.6.1.201501031845-r'
81 87
     }
82 88
 }
83 89
 

Loading…
Cancel
Save