瀏覽代碼

Merge pull request #57 from csmith/master

Build file improvements.
pull/58/head
Greg Holmes 9 年之前
父節點
當前提交
f038a91634
共有 1 個檔案被更改,包括 4 行新增63 行删除
  1. 4
    63
      build.gradle

+ 4
- 63
build.gradle 查看文件

@@ -1,8 +1,7 @@
1 1
 subprojects {
2
-    apply plugin: GitVersion
3
-
4 2
     group = 'com.dmdirc.parser'
5 3
 
4
+    apply plugin: 'com.dmdirc.git-version'
6 5
     apply plugin: 'maven-publish'
7 6
     apply plugin: 'java'
8 7
 
@@ -89,22 +88,7 @@ subprojects {
89 88
         testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.17'
90 89
     }
91 90
 
92
-    task getCredentials << {
93
-        def target = file('../nexus-teamcity.gradle')
94
-        if (!target.exists()) {
95
-            new URL('http://www.dmdirc.com/private/nexus-teamcity.gradle').withInputStream{
96
-                 i -> target.withOutputStream { it << i }
97
-            }
98
-        }
99
-
100
-        apply from: '../nexus-teamcity.gradle'
101
-        project.publishing.repositories[0].credentials {
102
-            username "$nexusUser"
103
-            password "$nexusPass"
104
-        }
105
-    }
106
-
107
-    task publishSnapshot(dependsOn: ['getCredentials', 'publishMavenJavaPublicationToSnapshotsRepository']) << {
91
+    task publishSnapshot(dependsOn: 'publishMavenJavaPublicationToSnapshotsRepository') << {
108 92
     }
109 93
 
110 94
     task javadocJar(type: Jar) {
@@ -141,53 +125,10 @@ def find(name) {
141 125
 buildscript {
142 126
     repositories {
143 127
         mavenCentral()
144
-        maven {
145
-            url 'http://artifactory.dmdirc.com/artifactory/repo'
146
-        }
128
+        maven { url 'https://dl.bintray.com/dmdirc/releases/' }
147 129
     }
148 130
 
149 131
     dependencies {
150
-        classpath group: 'com.github.shanemcc', name: 'jgit-describe', version: '0.5'
151
-        classpath group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '2.3.1.+'
132
+        classpath group: 'com.dmdirc', name: 'git-version', version: '1.0'
152 133
     }
153 134
 }
154
-
155
-class GitVersion implements Plugin<Project> {
156
-    void apply(Project project) {
157
-        def jgit = new org.mdonoughe.JGitDescribeTask()
158
-        jgit.dir = getGitDirectory(project)
159
-
160
-        def subdir = getRelativeSubdir(project, jgit.dir)
161
-        if (!subdir.isEmpty()) {
162
-            jgit.subdir = subdir
163
-        }
164
-
165
-        def version = jgit.description
166
-        project.version = getProjectVersion(version)
167
-    }
168
-
169
-    File getGitDirectory(Project project) {
170
-        def target = project.projectDir
171
-        def gitDir = new File(target, '.git')
172
-        while (!gitDir.exists() && target.parentFile != null) {
173
-            target = target.parentFile
174
-            gitDir = new File(target, '.git')
175
-        }
176
-        return gitDir
177
-    }
178
-
179
-    String getRelativeSubdir(Project project, File gitDir) {
180
-        def parent = gitDir.parentFile.absolutePath
181
-        def target = project.projectDir.absolutePath
182
-        return target.substring(parent.length())
183
-    }
184
-
185
-    String getProjectVersion(String gitVersion) {
186
-        if (gitVersion.matches('.*-[0-9]+-[0-9a-f]+$')) {
187
-            return gitVersion + '-SNAPSHOT'
188
-        } else {
189
-            return gitVersion
190
-        }
191
-    }
192
-
193
-}

Loading…
取消
儲存