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 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="DMDirc-reports" default="default" basedir=".">
  3. <description>Checkstyle, findbugs, CPD and PMD 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, cpd, pmd, checkstyle" />
  10. <target name="-mostreports" depends="cpd, pmd, checkstyle" />
  11. <target name="-init-checkstyle" depends="-init-dependencies">
  12. <taskdef resource="checkstyletask.properties" classpathref="analyse-classpath"/>
  13. </target>
  14. <target name="-init-pmd" depends="-init-dependencies">
  15. <taskdef name="pmd" classpathref="analyse-classpath" classname="net.sourceforge.pmd.ant.PMDTask" />
  16. </target>
  17. <target name="-init-cpd" depends="-init-dependencies">
  18. <taskdef name="cpd" classpathref="analyse-classpath" classname="net.sourceforge.pmd.cpd.CPDTask" />
  19. </target>
  20. <target name="-init-findbugs" depends="-init-dependencies">
  21. <taskdef name="findbugs" classpathref="analyse-classpath" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
  22. </target>
  23. <target name="checkstyle-all" depends="-init-checkstyle">
  24. <checkstyle config="checkstyle/dmdirc_checks.xml" failureProperty="checkstyle.failure" failOnViolation="false">
  25. <fileset dir="src/" includes="**/*.java" excludes="net/miginfocom/**"/>
  26. <fileset dir="modules/plugins/src/" includes="**/*.java"/>
  27. <fileset dir="modules/parser/src/" includes="**/*.java"/>
  28. <fileset dir="modules/util/src/" includes="**/*.java"/>
  29. <formatter type="xml" tofile="reports/checkstyle.xml"/>
  30. </checkstyle>
  31. <xslt in="reports/checkstyle.xml" out="reports/checkstyle.html" style="checkstyle/checkstyle.xsl"/>
  32. </target>
  33. <target name="-move-index">
  34. <!-- <copy file="checkstyle/index.html" tofile="reports/index.html"/> -->
  35. <copy file="checkstyle/sorttable.js" tofile="reports/sorttable.js"/>
  36. </target>
  37. <target name="pmd" description="Run PMD." depends="-init-pmd">
  38. <pmd shortFilenames="true">
  39. <ruleset>checkstyle/pmd_checks.xml</ruleset>
  40. <formatter type="xml" toFile="reports/report-pmd.xml" linkPrefix="http://pmd.sourceforge.net/xref/"/>
  41. <fileset dir="src/" includes="com/dmdirc/**/*.java" />
  42. <fileset dir="modules/plugins/src/" includes="com/dmdirc/**/*.java"/>
  43. <fileset dir="modules/util/src/" includes="com/dmdirc/**/*.java"/>
  44. <fileset dir="modules/parser/src/" includes="com/dmdirc/**/*.java"/>
  45. </pmd>
  46. <xslt in="reports/report-pmd.xml" style="checkstyle/pmd.xslt" out="reports/report-pmd.html" />
  47. </target>
  48. <target name="pmd-minimal" description="Run PMD with minimal ruleset." depends="-init-pmd">
  49. <pmd shortFilenames="true">
  50. <ruleset>checkstyle/pmd_minimal.xml</ruleset>
  51. <formatter type="xml" toFile="reports/report-pmd.xml" linkPrefix="http://pmd.sourceforge.net/xref/"/>
  52. <fileset dir="src/" includes="com/dmdirc/**/*.java" />
  53. <fileset dir="modules/plugins/src/" includes="com/dmdirc/**/*.java"/>
  54. <fileset dir="modules/util/src/" includes="com/dmdirc/**/*.java"/>
  55. <fileset dir="modules/parser/src/" includes="com/dmdirc/**/*.java"/>
  56. </pmd>
  57. <xslt in="reports/report-pmd.xml" style="checkstyle/pmd.xslt" out="reports/report-pmd.html" />
  58. </target>
  59. <target name="cpd" description="Run CPD." depends="-init-cpd">
  60. <cpd format="xml" minimumTokenCount="50" outputFile="reports/report-cpd.xml">
  61. <fileset dir="src/com/">
  62. <include name="**/*.java"/>
  63. </fileset>
  64. </cpd>
  65. <xslt in="reports/report-cpd.xml" style="checkstyle/cpd.xslt" out="reports/report-cpd.html" />
  66. </target>
  67. <target name="findbugs" depends="-init-findbugs,jar" description="Run Findbugs.">
  68. <mkdir dir="reports/findbugs" />
  69. <findbugs home="/usr/share/java/findbugs/" effort="max"
  70. jvmargs="-Xmx512M"
  71. output="xml:withMessages"
  72. outputFile="reports/findbugs/report-fb.xml" reportLevel="low">
  73. <sourcePath path="src/" />
  74. <class location="dist/DMDirc.jar" />
  75. </findbugs>
  76. <xslt in="reports/findbugs/report-fb.xml" style="checkstyle/findbugs.xslt" out="reports/report-fb.html" />
  77. </target>
  78. <target name="-init-proguard" depends="-init-dependencies">
  79. <taskdef resource="proguard/ant/task.properties" classpathref="analyse-classpath"/>
  80. </target>
  81. <target name="deadcode" depends="-init-proguard">
  82. <proguard>
  83. -libraryjars ${java.home}/lib/rt.jar
  84. -libraryjars ${java.home}/lib/jce.jar
  85. -libraryjars lib/main/
  86. -libraryjars modules/plugins/lib/main/
  87. -injars dist/DMDirc.jar(com/dmdirc/**,net/miginfocom/**)
  88. -injars modules/plugins/dist/(com/dmdirc/**)
  89. -dontoptimize
  90. -dontobfuscate
  91. -dontpreverify
  92. -printusage reports/deadcode.txt
  93. -dontnote !com.dmdirc.**
  94. <!-- The main entry point -->
  95. -keep public class com.dmdirc.Main {
  96. public static void main(java.lang.String[]);
  97. }
  98. <!-- All plugins -->
  99. -keep class ** implements com.dmdirc.plugins.Plugin {
  100. &lt;init&gt;(...);
  101. public void load(com.dmdirc.plugins.PluginInfo, dagger.ObjectGraph);
  102. public void onLoad();
  103. public void showConfig(com.dmdirc.config.prefs.PreferencesDialogModel);
  104. }
  105. <!-- Dagger provider methods -->
  106. -keepclassmembers @dagger.Module class ** {
  107. @dagger.Provides *;
  108. }
  109. <!-- Dagger generated subclasses -->
  110. -keep class **$$ModuleAdapter
  111. -keep class **$$InjectAdapter
  112. -keep class **$$StaticInjection
  113. <!-- Injectable constructors -->
  114. -keepclassmembers class * {
  115. @javax.inject.Inject *;
  116. &lt;init&gt;();
  117. }
  118. <!-- Package info classes -->
  119. -keep class **.package-info
  120. <!-- Enum stuff. -->
  121. -keepclassmembers enum ** {
  122. *** valueOf(java.lang.String);
  123. *** values();
  124. }
  125. <!-- Parser callbacks -->
  126. -keepclassmembers class ** {
  127. public void on*(com.dmdirc.parser.interfaces.Parser, ...);
  128. }
  129. <!-- Serializable version fields -->
  130. -keepclassmembers class ** implements java.io.Serializable {
  131. static final long serialVersionUID;
  132. }
  133. <!-- Swing dialogs -->
  134. -keep class com.dmdirc.addons.ui_swing.** extends com.dmdirc.addons.ui_swing.dialogs.StandardDialog {
  135. &lt;init&gt;(...);
  136. }
  137. <!-- Swing window implementations -->
  138. -keep class ** extends com.dmdirc.addons.ui_swing.components.frames.TextFrame {
  139. &lt;init&gt;(...);
  140. }
  141. <!-- Swing frame managers -->
  142. -keep class ** implements com.dmdirc.addons.ui_swing.framemanager.FrameManager {
  143. &lt;init&gt;(...);
  144. }
  145. <!-- DCC plugin panels -->
  146. -keep class com.dmdirc.addons.dcc.ui.PlaceholderPanel { &lt;init&gt;(...); }
  147. -keep class com.dmdirc.addons.dcc.ui.TransferPanel { &lt;init&gt;(...); }
  148. <!-- Exported services -->
  149. -keepclassmembers class ** implements com.dmdirc.plugins.Plugin {
  150. @com.dmdirc.plugins.Exported &lt;methods&gt;;
  151. }
  152. <!-- Debug plugin commands -->
  153. -keep class * extends com.dmdirc.addons.debug.DebugCommand {
  154. &lt;init&gt;(...);
  155. String getName();
  156. void execute(...);
  157. }
  158. <!-- Possibly inlined constants -->
  159. -keepclassmembers class * {
  160. static final % *;
  161. static final java.lang.String *;
  162. }
  163. <!-- Non-DMDirc classes -->
  164. -keep class org.** { *; }
  165. -keep class net.** { *; }
  166. -keep class com.sun.** { *; }
  167. -keep class com.google.** { *; }
  168. -keep class com.palintir.** { *; }
  169. -keep class dagger.** { *; }
  170. </proguard>
  171. </target>
  172. </project>