123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <?xml version="1.0" encoding="UTF-8"?>
- <project name="DMDirc-reports" default="default" basedir=".">
- <description>Checkstyle, findbugs, CPD and PMD reports</description>
-
- <target name="doallreports" depends="test-both,-allreports,javadoc"
- description="Run all reports." />
- <target name="domostreports" depends="test-both,-mostreports,javadoc"
- description="Run all reports except Findbugs." />
-
- <target name="checkstyle" depends="checkstyle-all, -move-index" description="Run checkstyle." />
-
- <target name="-allreports" depends="findbugs, cpd, pmd, checkstyle" />
- <target name="-mostreports" depends="cpd, pmd, checkstyle" />
-
- <target name="-init-checkstyle" depends="-init-dependencies">
- <taskdef resource="checkstyletask.properties" classpathref="analyse-classpath"/>
- </target>
-
- <target name="-init-pmd" depends="-init-dependencies">
- <taskdef name="pmd" classpathref="analyse-classpath" classname="net.sourceforge.pmd.ant.PMDTask" />
- </target>
-
- <target name="-init-cpd" depends="-init-dependencies">
- <taskdef name="cpd" classpathref="analyse-classpath" classname="net.sourceforge.pmd.cpd.CPDTask" />
- </target>
-
- <target name="-init-findbugs" depends="-init-dependencies">
- <taskdef name="findbugs" classpathref="analyse-classpath" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
- </target>
-
- <target name="checkstyle-all" depends="-init-checkstyle">
- <checkstyle config="checkstyle/dmdirc_checks.xml" failureProperty="checkstyle.failure" failOnViolation="false">
- <fileset dir="src/" includes="**/*.java" excludes="net/miginfocom/**"/>
- <fileset dir="modules/plugins/src/" includes="**/*.java"/>
- <fileset dir="modules/parser/src/" includes="**/*.java"/>
- <fileset dir="modules/util/src/" includes="**/*.java"/>
- <formatter type="xml" tofile="reports/checkstyle.xml"/>
- </checkstyle>
- <xslt in="reports/checkstyle.xml" out="reports/checkstyle.html" style="checkstyle/checkstyle.xsl"/>
- </target>
-
- <target name="-move-index">
- <!-- <copy file="checkstyle/index.html" tofile="reports/index.html"/> -->
- <copy file="checkstyle/sorttable.js" tofile="reports/sorttable.js"/>
- </target>
-
- <target name="pmd" description="Run PMD." depends="-init-pmd">
- <pmd shortFilenames="true">
- <ruleset>checkstyle/pmd_checks.xml</ruleset>
- <formatter type="xml" toFile="reports/report-pmd.xml" linkPrefix="http://pmd.sourceforge.net/xref/"/>
- <fileset dir="src/" includes="com/dmdirc/**/*.java" />
- <fileset dir="modules/plugins/src/" includes="com/dmdirc/**/*.java"/>
- <fileset dir="modules/util/src/" includes="com/dmdirc/**/*.java"/>
- <fileset dir="modules/parser/src/" includes="com/dmdirc/**/*.java"/>
- </pmd>
- <xslt in="reports/report-pmd.xml" style="checkstyle/pmd.xslt" out="reports/report-pmd.html" />
- </target>
-
- <target name="pmd-minimal" description="Run PMD with minimal ruleset." depends="-init-pmd">
- <pmd shortFilenames="true">
- <ruleset>checkstyle/pmd_minimal.xml</ruleset>
- <formatter type="xml" toFile="reports/report-pmd.xml" linkPrefix="http://pmd.sourceforge.net/xref/"/>
- <fileset dir="src/" includes="com/dmdirc/**/*.java" />
- <fileset dir="modules/plugins/src/" includes="com/dmdirc/**/*.java"/>
- <fileset dir="modules/util/src/" includes="com/dmdirc/**/*.java"/>
- <fileset dir="modules/parser/src/" includes="com/dmdirc/**/*.java"/>
- </pmd>
- <xslt in="reports/report-pmd.xml" style="checkstyle/pmd.xslt" out="reports/report-pmd.html" />
- </target>
-
- <target name="cpd" description="Run CPD." depends="-init-cpd">
- <cpd format="xml" minimumTokenCount="50" outputFile="reports/report-cpd.xml">
- <fileset dir="src/com/">
- <include name="**/*.java"/>
- </fileset>
- </cpd>
- <xslt in="reports/report-cpd.xml" style="checkstyle/cpd.xslt" out="reports/report-cpd.html" />
- </target>
-
- <target name="findbugs" depends="-init-findbugs,jar" description="Run Findbugs.">
- <mkdir dir="reports/findbugs" />
- <findbugs home="/usr/share/java/findbugs/" effort="max"
- jvmargs="-Xmx512M"
- output="xml:withMessages"
- outputFile="reports/findbugs/report-fb.xml" reportLevel="low">
- <sourcePath path="src/" />
- <class location="dist/DMDirc.jar" />
- </findbugs>
- <xslt in="reports/findbugs/report-fb.xml" style="checkstyle/findbugs.xslt" out="reports/report-fb.html" />
- </target>
-
- <target name="-init-proguard" depends="-init-dependencies">
- <taskdef resource="proguard/ant/task.properties" classpathref="analyse-classpath"/>
- </target>
-
- <target name="deadcode" depends="-init-proguard">
- <proguard>
- -libraryjars ${java.home}/lib/rt.jar
- -libraryjars ${java.home}/lib/jce.jar
- -libraryjars lib/main/
- -libraryjars modules/plugins/lib/main/
-
- -injars dist/DMDirc.jar(com/dmdirc/**,net/miginfocom/**)
- -injars modules/plugins/dist/(com/dmdirc/**)
-
- -dontoptimize
- -dontobfuscate
- -dontpreverify
- -printusage reports/deadcode.txt
-
- -dontnote !com.dmdirc.**
-
- <!-- The main entry point -->
- -keep public class com.dmdirc.Main {
- public static void main(java.lang.String[]);
- }
-
- <!-- All plugins -->
- -keep class ** implements com.dmdirc.plugins.Plugin {
- <init>(...);
- public void load(com.dmdirc.plugins.PluginInfo, dagger.ObjectGraph);
- public void onLoad();
- public void showConfig(com.dmdirc.config.prefs.PreferencesDialogModel);
- }
-
- <!-- Dagger provider methods -->
- -keepclassmembers @dagger.Module class ** {
- @dagger.Provides *;
- }
-
- <!-- Dagger generated subclasses -->
- -keep class **$$ModuleAdapter
- -keep class **$$InjectAdapter
- -keep class **$$StaticInjection
-
- <!-- Injectable constructors -->
- -keepclassmembers class * {
- @javax.inject.Inject *;
- <init>();
- }
-
- <!-- Package info classes -->
- -keep class **.package-info
-
- <!-- Enum stuff. -->
- -keepclassmembers enum ** {
- *** valueOf(java.lang.String);
- *** values();
- }
-
- <!-- Parser callbacks -->
- -keepclassmembers class ** {
- public void on*(com.dmdirc.parser.interfaces.Parser, ...);
- }
-
- <!-- Serializable version fields -->
- -keepclassmembers class ** implements java.io.Serializable {
- static final long serialVersionUID;
- }
-
- <!-- Swing dialogs -->
- -keep class com.dmdirc.addons.ui_swing.** extends com.dmdirc.addons.ui_swing.dialogs.StandardDialog {
- <init>(...);
- }
-
- <!-- Swing window implementations -->
- -keep class ** extends com.dmdirc.addons.ui_swing.components.frames.TextFrame {
- <init>(...);
- }
-
- <!-- Swing frame managers -->
- -keep class ** implements com.dmdirc.addons.ui_swing.framemanager.FrameManager {
- <init>(...);
- }
-
- <!-- DCC plugin panels -->
- -keep class com.dmdirc.addons.dcc.ui.PlaceholderPanel { <init>(...); }
- -keep class com.dmdirc.addons.dcc.ui.TransferPanel { <init>(...); }
-
- <!-- Exported services -->
- -keepclassmembers class ** implements com.dmdirc.plugins.Plugin {
- @com.dmdirc.plugins.Exported <methods>;
- }
-
- <!-- Debug plugin commands -->
- -keep class * extends com.dmdirc.addons.debug.DebugCommand {
- <init>(...);
- String getName();
- void execute(...);
- }
-
- <!-- Possibly inlined constants -->
- -keepclassmembers class * {
- static final % *;
- static final java.lang.String *;
- }
-
- <!-- Non-DMDirc classes -->
- -keep class org.** { *; }
- -keep class net.** { *; }
- -keep class com.sun.** { *; }
- -keep class com.google.** { *; }
- -keep class com.palintir.** { *; }
- -keep class dagger.** { *; }
- </proguard>
- </target>
- </project>
|