Browse Source

Add ant targets to get warnings info.

A set of ant targets to allow capturing the build output, effectively
grepping through it to find javac warnings from source files, then
outputting a teamcity info file containing the number.

Change-Id: I54e1ea72c9f7ae39565defb8caf52bf99f5ed941
Reviewed-on: http://gerrit.dmdirc.com/3125
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8rc1
Chris Smith 10 years ago
parent
commit
64d5f572be
3 changed files with 49 additions and 0 deletions
  1. 3
    0
      .gitignore
  2. 40
    0
      build-reports.xml
  3. 6
    0
      etc/warnings/template.xml

+ 3
- 0
.gitignore View File

@@ -33,8 +33,11 @@ __history
33 33
 /reports/report-pmd.*
34 34
 /reports/checkstyle.*
35 35
 /reports/deadcode.txt
36
+/reports/warnings.txt
37
+/reports/build-log.txt
36 38
 /etc/clover.license
37 39
 /etc/clover/clover.license
38 40
 /.clover
39 41
 /test_profile
40 42
 /*.key
43
+/teamcity-info.xml

+ 40
- 0
build-reports.xml View File

@@ -203,4 +203,44 @@
203 203
             -keep class dagger.** { *; }
204 204
         </proguard>
205 205
     </target>
206
+
207
+    <target name="with.warnings">
208
+        <record name="reports/build-log.txt" action="start"/>
209
+    </target>
210
+
211
+    <target name="warnings-report">
212
+        <record name="reports/build-log.txt" action="stop"/>
213
+
214
+        <copy file="reports/build-log.txt" tofile="reports/warnings.txt">
215
+            <filterchain>
216
+                <linecontainsregexp>
217
+                    <regexp pattern="java:[0-9]+: warning: .*"/>
218
+                </linecontainsregexp>
219
+                <trim/>
220
+                <replacestring from="[javac] ${basedir}${file.separator}" to=""/>
221
+                <sortfilter/>
222
+            </filterchain>
223
+        </copy>
224
+    </target>
225
+
226
+    <target name="teamcity-warnings-report">
227
+        <resourcecount property="warnings.count">
228
+            <tokens>
229
+                <concat>
230
+                    <filterchain>
231
+                        <tokenfilter>
232
+                           <linetokenizer/>
233
+                        </tokenfilter>
234
+                    </filterchain>
235
+                    <fileset file="reports/warnings.txt"/>
236
+                </concat>
237
+            </tokens>
238
+        </resourcecount>
239
+
240
+        <copy file="etc/warnings/template.xml" tofile="teamcity-info.xml">
241
+            <filterset>
242
+                <filter token="COUNT" value="${warnings.count}"/>
243
+            </filterset>
244
+        </copy>
245
+    </target>
206 246
 </project>

+ 6
- 0
etc/warnings/template.xml View File

@@ -0,0 +1,6 @@
1
+<build>
2
+    <statusInfo>
3
+        <text action="append"> warnings: @COUNT@</text>
4
+    </statusInfo>
5
+    <statisicValue key="warnings" value="@COUNT@"/>
6
+</build>

Loading…
Cancel
Save