You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build-reports.xml 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="DMDirc-reports" default="default" basedir=".">
  3. <description>Checkstyle and findbugs reports</description>
  4. <target name="doallreports" depends="test-both,-allreports,javadoc"
  5. description="Run all reports." />
  6. <target name="domostreports" depends="test-both,-mostreports,javadoc"
  7. description="Run all reports except Findbugs." />
  8. <target name="checkstyle" depends="checkstyle-all, -move-index" description="Run checkstyle." />
  9. <target name="-allreports" depends="findbugs, checkstyle" />
  10. <target name="-mostreports" depends="checkstyle" />
  11. <target name="-init-checkstyle" depends="-init-dependencies">
  12. <taskdef resource="checkstyletask.properties" classpathref="analyse-classpath"/>
  13. </target>
  14. <target name="-init-findbugs" depends="-init-dependencies">
  15. <taskdef name="findbugs" classpathref="analyse-classpath" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
  16. </target>
  17. <target name="checkstyle-all" depends="-init-checkstyle">
  18. <checkstyle config="etc/checkstyle/dmdirc.xml" failureProperty="checkstyle.failure" failOnViolation="false">
  19. <fileset dir="src/" includes="**/*.java" excludes="net/miginfocom/**"/>
  20. <fileset dir="modules/parser/src/" includes="**/*.java"/>
  21. <fileset dir="modules/util/src/" includes="**/*.java"/>
  22. <formatter type="xml" tofile="reports/checkstyle.xml"/>
  23. </checkstyle>
  24. <xslt in="reports/checkstyle.xml" out="reports/checkstyle.html" style="etc/checkstyle/checkstyle.xsl"/>
  25. </target>
  26. <target name="-move-index">
  27. <copy file="etc/reports/sorttable.js" tofile="reports/sorttable.js"/>
  28. </target>
  29. <target name="findbugs" depends="-init-findbugs,jar" description="Run Findbugs.">
  30. <mkdir dir="reports/findbugs" />
  31. <findbugs home="/usr/share/java/findbugs/" effort="max"
  32. jvmargs="-Xmx512M"
  33. output="xml:withMessages"
  34. outputFile="reports/findbugs/report-fb.xml" reportLevel="low">
  35. <sourcePath path="src/" />
  36. <class location="dist/DMDirc.jar" />
  37. </findbugs>
  38. <xslt in="reports/findbugs/report-fb.xml" style="etc/findbugs/findbugs.xslt" out="reports/report-fb.html" />
  39. </target>
  40. <target name="-init-proguard" depends="-init-dependencies">
  41. <taskdef resource="proguard/ant/task.properties" classpathref="analyse-classpath"/>
  42. </target>
  43. <target name="deadcode" depends="-init-proguard">
  44. <proguard>
  45. -libraryjars ${java.home}/lib/rt.jar
  46. -libraryjars ${java.home}/lib/jce.jar
  47. -libraryjars lib/main/
  48. -libraryjars modules/plugins/lib/main/
  49. -injars dist/DMDirc.jar(com/dmdirc/**,net/miginfocom/**)
  50. -injars modules/plugins/dist/(com/dmdirc/**)
  51. -dontoptimize
  52. -dontobfuscate
  53. -dontpreverify
  54. -printusage reports/deadcode.txt
  55. -dontnote !com.dmdirc.**
  56. <!-- The main entry point -->
  57. -keep public class com.dmdirc.Main {
  58. public static void main(java.lang.String[]);
  59. }
  60. <!-- All plugins -->
  61. -keep class ** implements com.dmdirc.plugins.Plugin {
  62. &lt;init&gt;(...);
  63. public void load(com.dmdirc.plugins.PluginInfo, dagger.ObjectGraph);
  64. public void onLoad();
  65. public void showConfig(com.dmdirc.config.prefs.PreferencesDialogModel);
  66. }
  67. <!-- Dagger provider methods -->
  68. -keepclassmembers @dagger.Module class ** {
  69. @dagger.Provides *;
  70. }
  71. <!-- Dagger generated subclasses -->
  72. -keep class **$$ModuleAdapter
  73. -keep class **$$InjectAdapter
  74. -keep class **$$StaticInjection
  75. <!-- Injectable constructors -->
  76. -keepclassmembers class * {
  77. @javax.inject.Inject *;
  78. &lt;init&gt;();
  79. }
  80. <!-- Package info classes -->
  81. -keep class **.package-info
  82. <!-- Enum stuff. -->
  83. -keepclassmembers enum ** {
  84. *** valueOf(java.lang.String);
  85. *** values();
  86. }
  87. <!-- Parser callbacks -->
  88. -keepclassmembers class ** {
  89. public void on*(com.dmdirc.parser.interfaces.Parser, ...);
  90. }
  91. <!-- Serializable version fields -->
  92. -keepclassmembers class ** implements java.io.Serializable {
  93. static final long serialVersionUID;
  94. }
  95. <!-- Swing dialogs -->
  96. -keep class com.dmdirc.addons.ui_swing.** extends com.dmdirc.addons.ui_swing.dialogs.StandardDialog {
  97. &lt;init&gt;(...);
  98. }
  99. <!-- Swing window implementations -->
  100. -keep class ** extends com.dmdirc.addons.ui_swing.components.frames.TextFrame {
  101. &lt;init&gt;(...);
  102. }
  103. <!-- Swing frame managers -->
  104. -keep class ** implements com.dmdirc.addons.ui_swing.framemanager.FrameManager {
  105. &lt;init&gt;(...);
  106. }
  107. <!-- DCC plugin panels -->
  108. -keep class com.dmdirc.addons.dcc.ui.PlaceholderPanel { &lt;init&gt;(...); }
  109. -keep class com.dmdirc.addons.dcc.ui.TransferPanel { &lt;init&gt;(...); }
  110. <!-- Exported services -->
  111. -keepclassmembers class ** implements com.dmdirc.plugins.Plugin {
  112. @com.dmdirc.plugins.Exported &lt;methods&gt;;
  113. }
  114. <!-- Debug plugin commands -->
  115. -keep class * extends com.dmdirc.addons.debug.DebugCommand {
  116. &lt;init&gt;(...);
  117. String getName();
  118. void execute(...);
  119. }
  120. <!-- Possibly inlined constants -->
  121. -keepclassmembers class * {
  122. static final % *;
  123. static final java.lang.String *;
  124. }
  125. <!-- Non-DMDirc classes -->
  126. -keep class org.** { *; }
  127. -keep class net.** { *; }
  128. -keep class com.sun.** { *; }
  129. -keep class com.google.** { *; }
  130. -keep class com.palintir.** { *; }
  131. -keep class dagger.** { *; }
  132. </proguard>
  133. </target>
  134. <target name="with.warnings">
  135. <record name="reports/build-log.txt" action="start"/>
  136. </target>
  137. <target name="warnings-report">
  138. <record name="reports/build-log.txt" action="stop"/>
  139. <copy file="reports/build-log.txt" tofile="reports/warnings.txt">
  140. <filterchain>
  141. <!-- Pick out the warnings generated for source files -->
  142. <linecontainsregexp>
  143. <regexp pattern="java:[0-9]+: warning: .*"/>
  144. </linecontainsregexp>
  145. <!-- Trim whitespace and boilerplate -->
  146. <trim/>
  147. <replacestring from="[javac] ${basedir}${file.separator}" to=""/>
  148. <!-- Ignore anything that's not from a source directory (e.g. dagger generated code) -->
  149. <linecontainsregexp>
  150. <regexp pattern="^(modules${file.separator}[a-z]+${file.separator})?src.*"/>
  151. </linecontainsregexp>
  152. <!-- Sort the results in file order -->
  153. <sortfilter/>
  154. </filterchain>
  155. </copy>
  156. <copy file="reports/warnings.txt" tofile="reports/warnings-deprecations.txt">
  157. <filterchain>
  158. <linecontainsregexp>
  159. <regexp pattern=".*: warning: \[deprecation\] .*"/>
  160. </linecontainsregexp>
  161. </filterchain>
  162. </copy>
  163. <copy file="reports/warnings.txt" tofile="reports/warnings-other.txt">
  164. <filterchain>
  165. <linecontainsregexp negate="true">
  166. <regexp pattern=".*: warning: \[deprecation\] .*"/>
  167. </linecontainsregexp>
  168. </filterchain>
  169. </copy>
  170. </target>
  171. <target name="teamcity-warnings-report">
  172. <resourcecount property="warnings.count">
  173. <tokens>
  174. <concat>
  175. <filterchain>
  176. <tokenfilter>
  177. <linetokenizer/>
  178. </tokenfilter>
  179. </filterchain>
  180. <fileset file="reports/warnings.txt"/>
  181. </concat>
  182. </tokens>
  183. </resourcecount>
  184. <copy file="etc/warnings/template.xml" tofile="teamcity-info.xml">
  185. <filterset>
  186. <filter token="COUNT" value="${warnings.count}"/>
  187. </filterset>
  188. </copy>
  189. </target>
  190. <target name="-init-tattletale">
  191. <taskdef name="report"
  192. classname="org.jboss.tattletale.ant.ReportTask"
  193. classpathref="analyse-classpath"/>
  194. </target>
  195. <target name="tattletale" depends="-init-tattletale">
  196. <report source="modules/plugins/dist/" destination="reports/tattletale/"/>
  197. </target>
  198. </project>