Explorar el Código

Support for publishing builds from gradle.

pull/4/head
Chris Smith hace 9 años
padre
commit
75d74230aa
Se han modificado 2 ficheros con 43 adiciones y 5 borrados
  1. 1
    0
      .gitignore
  2. 42
    5
      build.gradle

+ 1
- 0
.gitignore Ver fichero

@@ -50,3 +50,4 @@ __history
50 50
 /etc/nexus-teamcity.properties
51 51
 /.idea/libraries
52 52
 /.idea/dictionaries
53
+/nexus-teamcity.gradle

+ 42
- 5
build.gradle Ver fichero

@@ -1,3 +1,11 @@
1
+def jgit = new org.mdonoughe.JGitDescribeTask()
2
+jgit.dir = new File(projectDir, '.git')
3
+project.version = jgit.getDescription() + '-SNAPSHOT'
4
+
5
+apply plugin: 'maven-publish'
6
+
7
+group = 'com.dmdirc'
8
+
1 9
 configurations {
2 10
     bundle
3 11
     plugin
@@ -25,6 +33,23 @@ dependencies {
25 33
     plugin group: 'com.dmdirc', name: 'tabcompleter_mirc', version: '+', changing: true
26 34
 }
27 35
 
36
+publishing {
37
+    publications {
38
+        mavenJava(MavenPublication) {
39
+            groupId 'com.dmdirc'
40
+            artifactId 'client'
41
+
42
+            artifact jar
43
+        }
44
+    }
45
+    repositories {
46
+        maven {
47
+            name 'snapshots'
48
+            url 'http://nexus.dmdirc.com/nexus/content/repositories/snapshots/'
49
+        }
50
+    }
51
+}
52
+
28 53
 allprojects {
29 54
     apply plugin: 'java'
30 55
     apply plugin: 'findbugs'
@@ -87,13 +112,25 @@ allprojects {
87 112
     }
88 113
 }
89 114
 
90
-task createVersionConfig << {
91
-    def gitDir = new File(projectDir, '.git')
115
+task getCredentials << {
116
+    def target = file('nexus-teamcity.gradle')
117
+    if (!target.exists()) {
118
+        new URL('http://www.dmdirc.com/private/nexus-teamcity.gradle').withInputStream{
119
+            i -> target.withOutputStream { it << i }
120
+        }
121
+    }
92 122
 
93
-    def jgit = new org.mdonoughe.JGitDescribeTask()
94
-    jgit.dir = gitDir
123
+    apply from: 'nexus-teamcity.gradle'
124
+    project.publishing.repositories[0].credentials {
125
+        username "$nexusUser"
126
+        password "$nexusPass"
127
+    }
128
+}
95 129
 
96
-    version = jgit.getDescription()
130
+task publishSnapshot(dependsOn: ['getCredentials', 'publishMavenJavaPublicationToSnapshotsRepository']) << {
131
+}
132
+
133
+task createVersionConfig << {
97 134
     def targetFile = new File(buildDir, 'version.config')
98 135
 
99 136
     targetFile.text = ''

Loading…
Cancelar
Guardar