Browse Source

Split up client build file.

Makes it a bit less messy, and easier to find the right bits.
pull/411/head
Chris Smith 9 years ago
parent
commit
6a658d40bc
5 changed files with 240 additions and 147 deletions
  1. 46
    0
      analysis.gradle
  2. 4
    147
      build.gradle
  3. 76
    0
      fatjar.gradle
  4. 73
    0
      jar.gradle
  5. 41
    0
      publishing.gradle

+ 46
- 0
analysis.gradle View File

@@ -0,0 +1,46 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+dependencies {
24
+    pmd group: 'net.sourceforge.pmd', name: 'pmd-core', version: '5.2.3'
25
+    pmd group: 'net.sourceforge.pmd', name: 'pmd-java', version: '5.2.3'
26
+}
27
+
28
+pmd {
29
+    ruleSets = []
30
+    ruleSetFiles = files("$rootDir/etc/pmd/full.xml")
31
+    toolVersion = '5.2.3'
32
+    ignoreFailures = true
33
+}
34
+
35
+tasks.withType(FindBugs) {
36
+    reports {
37
+        html.enabled = true
38
+        xml.enabled = false
39
+    }
40
+}
41
+
42
+findbugs {
43
+    reportLevel = 'low'
44
+    effort = 'max'
45
+    ignoreFailures = true
46
+}

+ 4
- 147
build.gradle View File

@@ -12,10 +12,6 @@ apply plugin: 'pmd'
12 12
 configurations {
13 13
     bundle
14 14
 
15
-    plugin {
16
-        transitive = false
17
-    }
18
-
19 15
     compile {
20 16
         extendsFrom bundle
21 17
     }
@@ -40,34 +36,9 @@ dependencies {
40 36
     bundle group: 'com.dmdirc', name: 'util', version: '+', changing: true
41 37
     bundle group: 'com.dmdirc.parser', name: 'common', version: '+', changing: true
42 38
 
43
-    plugin group: 'com.dmdirc', name: 'ui_swing', version: '+', changing: true
44
-    plugin group: 'com.dmdirc', name: 'parser_irc', version: '+', changing: true
45
-    plugin group: 'com.dmdirc', name: 'tabcompletion_bash', version: '+', changing: true
46
-    plugin group: 'com.dmdirc', name: 'tabcompletion_mirc', version: '+', changing: true
47
-
48 39
     testCompile group: 'junit', name: 'junit', version: '4.12'
49 40
     testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.17'
50 41
     testCompile group: 'com.google.jimfs', name: 'jimfs', version: '1.0'
51
-
52
-    pmd group: 'net.sourceforge.pmd', name: 'pmd-core', version: '5.2.3'
53
-    pmd group: 'net.sourceforge.pmd', name: 'pmd-java', version: '5.2.3'
54
-}
55
-
56
-publishing {
57
-    publications {
58
-        mavenJava(MavenPublication) {
59
-            groupId 'com.dmdirc'
60
-            artifactId 'client'
61
-
62
-            artifact jar
63
-        }
64
-    }
65
-    repositories {
66
-        maven {
67
-            name 'snapshots'
68
-            url 'http://artifactory.dmdirc.com/artifactory/repo'
69
-        }
70
-    }
71 42
 }
72 43
 
73 44
 sourceSets {
@@ -91,124 +62,10 @@ repositories {
91 62
     }
92 63
 }
93 64
 
94
-pmd {
95
-    ruleSets = []
96
-    ruleSetFiles = files("$rootDir/etc/pmd/full.xml")
97
-    toolVersion = '5.2.3'
98
-    ignoreFailures = true
99
-}
100
-
101
-tasks.withType(FindBugs) {
102
-    reports {
103
-        html.enabled = true
104
-        xml.enabled = false
105
-    }
106
-}
107
-
108
-findbugs {
109
-    reportLevel = 'low'
110
-    effort = 'max'
111
-    ignoreFailures = true
112
-}
113
-
114
-task publishSnapshot(dependsOn: 'publishMavenJavaPublicationToSnapshotsRepository') << {
115
-}
116
-
117
-task createVersionConfig {
118
-    inputs.dir 'src'
119
-    inputs.dir 'res'
120
-    outputs.file new File(buildDir, 'version.config')
121
-    dependsOn classes
122
-
123
-    doLast {
124
-        def targetFile = new File(buildDir, 'version.config')
125
-
126
-        targetFile.text = ''
127
-        targetFile << "keysections:\n identity\n version\n updater\n bundledplugins_versions\n\n"
128
-        targetFile << "identity:\n name=DMDirc version information\n globaldefault=true\n order=95000\n\n"
129
-        targetFile << "version:\n version=${version}\n\n"
130
-        targetFile << "updater:\n channel=${updaterChannel}\n\n"
131
-        targetFile << "buildenv:\n"
132
-        def compileConfiguration = project.configurations.getByName("compile")
133
-        def resolvedConfiguration = compileConfiguration.resolvedConfiguration
134
-        def resolvedArtifacts = resolvedConfiguration.resolvedArtifacts
135
-        resolvedArtifacts.each { dp ->
136
-            def version = dp.moduleVersion.id
137
-            targetFile << " " + version.group + " " + version.name + " " + version.version + "\n"
138
-        }
139
-    }
140
-}
141
-
142
-task createFatVersionConfig {
143
-    inputs.file new File(buildDir, 'version.config')
144
-    outputs.file new File(buildDir, 'fat.version.config')
145
-    dependsOn createVersionConfig
146
-
147
-    doLast {
148
-        def sourceFile = new File(buildDir, 'version.config')
149
-        def targetFile = new File(buildDir, 'fat.version.config')
150
-
151
-        java.nio.file.Files.copy(sourceFile.toPath(), targetFile.toPath(),
152
-            java.nio.file.StandardCopyOption.REPLACE_EXISTING)
153
-
154
-        targetFile << "\nbundledplugins_versions:\n"
155
-        configurations.plugin.each { p ->
156
-            targetFile << " " + p.name.replaceFirst('-', '=').replaceAll('.jar$', '\n');
157
-        }
158
-    }
159
-}
160
-
161
-test.dependsOn createVersionConfig
162
-
163
-jar {
164
-    outputs.file "dist/DMDirc.jar"
165
-    dependsOn createVersionConfig
166
-
167
-    exclude 'com/dmdirc/version.config'
168
-
169
-    from("$buildDir/version.config") {
170
-        into 'com/dmdirc/'
171
-    }
172
-
173
-    from { configurations.bundle.collect { it.isDirectory() ? it : zipTree(it) } } {
174
-        exclude 'META-INF/**'
175
-    }
176
-
177
-    manifest {
178
-        attributes 'Main-Class': 'com.dmdirc.Main'
179
-    }
180
-
181
-    doLast {
182
-        copy {
183
-            from jar.archivePath
184
-            into "dist/"
185
-            rename ".*", "DMDirc.jar"
186
-        }
187
-    }
188
-}
189
-
190
-task('fatjar', type: Jar) {
191
-    dependsOn createFatVersionConfig
192
-    baseName = 'fat-client'
193
-
194
-    from("$buildDir/fat.version.config") {
195
-        into 'com/dmdirc'
196
-        rename 'fat.version.config', 'version.config'
197
-    }
198
-
199
-    into('plugins') {
200
-        from configurations.plugin
201
-        rename '(.*?)-.*(\\.jar)', '$1$2'
202
-    }
203
-
204
-    with jar {
205
-        exclude 'com/dmdirc/version.config'
206
-    }
207
-
208
-    manifest {
209
-        attributes 'Main-Class': 'com.dmdirc.Main'
210
-    }
211
-}
65
+apply from: 'analysis.gradle'
66
+apply from: 'publishing.gradle'
67
+apply from: 'jar.gradle'
68
+apply from: 'fatjar.gradle'
212 69
 
213 70
 buildscript {
214 71
     repositories {

+ 76
- 0
fatjar.gradle View File

@@ -0,0 +1,76 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+configurations {
24
+    plugin {
25
+        transitive = false
26
+    }
27
+}
28
+
29
+dependencies {
30
+    plugin group: 'com.dmdirc', name: 'ui_swing', version: '+', changing: true
31
+    plugin group: 'com.dmdirc', name: 'parser_irc', version: '+', changing: true
32
+    plugin group: 'com.dmdirc', name: 'tabcompletion_bash', version: '+', changing: true
33
+    plugin group: 'com.dmdirc', name: 'tabcompletion_mirc', version: '+', changing: true
34
+}
35
+
36
+task createFatVersionConfig {
37
+    inputs.file new File(buildDir, 'version.config')
38
+    outputs.file new File(buildDir, 'fat.version.config')
39
+    dependsOn createVersionConfig
40
+
41
+    doLast {
42
+        def sourceFile = new File(buildDir, 'version.config')
43
+        def targetFile = new File(buildDir, 'fat.version.config')
44
+
45
+        java.nio.file.Files.copy(sourceFile.toPath(), targetFile.toPath(),
46
+                java.nio.file.StandardCopyOption.REPLACE_EXISTING)
47
+
48
+        targetFile << "\nbundledplugins_versions:\n"
49
+        configurations.plugin.each { p ->
50
+            targetFile << " " + p.name.replaceFirst('-', '=').replaceAll('.jar$', '\n');
51
+        }
52
+    }
53
+}
54
+
55
+task('fatjar', type: Jar) {
56
+    dependsOn createFatVersionConfig
57
+    baseName = 'fat-client'
58
+
59
+    from("$buildDir/fat.version.config") {
60
+        into 'com/dmdirc'
61
+        rename 'fat.version.config', 'version.config'
62
+    }
63
+
64
+    into('plugins') {
65
+        from configurations.plugin
66
+        rename '(.*?)-.*(\\.jar)', '$1$2'
67
+    }
68
+
69
+    with jar {
70
+        exclude 'com/dmdirc/version.config'
71
+    }
72
+
73
+    manifest {
74
+        attributes 'Main-Class': 'com.dmdirc.Main'
75
+    }
76
+}

+ 73
- 0
jar.gradle View File

@@ -0,0 +1,73 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+task createVersionConfig {
24
+    inputs.dir 'src'
25
+    inputs.dir 'res'
26
+    outputs.file new File(buildDir, 'version.config')
27
+    dependsOn classes
28
+
29
+    doLast {
30
+        def targetFile = new File(buildDir, 'version.config')
31
+
32
+        targetFile.text = ''
33
+        targetFile << "keysections:\n identity\n version\n updater\n bundledplugins_versions\n\n"
34
+        targetFile << "identity:\n name=DMDirc version information\n globaldefault=true\n order=95000\n\n"
35
+        targetFile << "version:\n version=${version}\n\n"
36
+        targetFile << "updater:\n channel=${updaterChannel}\n\n"
37
+        targetFile << "buildenv:\n"
38
+        def compileConfiguration = project.configurations.getByName("compile")
39
+        def resolvedConfiguration = compileConfiguration.resolvedConfiguration
40
+        def resolvedArtifacts = resolvedConfiguration.resolvedArtifacts
41
+        resolvedArtifacts.each { dp ->
42
+            def version = dp.moduleVersion.id
43
+            targetFile << " " + version.group + " " + version.name + " " + version.version + "\n"
44
+        }
45
+    }
46
+}
47
+
48
+jar {
49
+    outputs.file "dist/DMDirc.jar"
50
+    dependsOn createVersionConfig
51
+
52
+    exclude 'com/dmdirc/version.config'
53
+
54
+    from("$buildDir/version.config") {
55
+        into 'com/dmdirc/'
56
+    }
57
+
58
+    from { configurations.bundle.collect { it.isDirectory() ? it : zipTree(it) } } {
59
+        exclude 'META-INF/**'
60
+    }
61
+
62
+    manifest {
63
+        attributes 'Main-Class': 'com.dmdirc.Main'
64
+    }
65
+
66
+    doLast {
67
+        copy {
68
+            from jar.archivePath
69
+            into "dist/"
70
+            rename ".*", "DMDirc.jar"
71
+        }
72
+    }
73
+}

+ 41
- 0
publishing.gradle View File

@@ -0,0 +1,41 @@
1
+/*
2
+ * Copyright (c) 2006-2015 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+publishing {
24
+    publications {
25
+        mavenJava(MavenPublication) {
26
+            groupId 'com.dmdirc'
27
+            artifactId 'client'
28
+
29
+            artifact jar
30
+        }
31
+    }
32
+    repositories {
33
+        maven {
34
+            name 'snapshots'
35
+            url 'http://artifactory.dmdirc.com/artifactory/repo'
36
+        }
37
+    }
38
+}
39
+
40
+task publishSnapshot(dependsOn: 'publishMavenJavaPublicationToSnapshotsRepository') << {
41
+}

Loading…
Cancel
Save