123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <?xml version="1.0" encoding="UTF-8"?>
- <project name="DMDirc-reports" default="default" basedir=".">
- <description>Checkstyle and findbugs 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, checkstyle" />
- <target name="-mostreports" depends="checkstyle" />
-
- <target name="-init-checkstyle" depends="-init-dependencies">
- <taskdef resource="checkstyletask.properties" classpathref="analyse-classpath"/>
- </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="etc/checkstyle/dmdirc.xml" failureProperty="checkstyle.failure" failOnViolation="false">
- <fileset dir="src/" includes="**/*.java" excludes="net/miginfocom/**"/>
- <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="etc/checkstyle/checkstyle.xsl"/>
- </target>
-
- <target name="-move-index">
- <copy file="etc/reports/sorttable.js" tofile="reports/sorttable.js"/>
- </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="etc/findbugs/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>
-
- <target name="with.warnings">
- <record name="reports/build-log.txt" action="start"/>
- </target>
-
- <target name="warnings-report">
- <record name="reports/build-log.txt" action="stop"/>
-
- <copy file="reports/build-log.txt" tofile="reports/warnings.txt">
- <filterchain>
- <!-- Pick out the warnings generated for source files -->
- <linecontainsregexp>
- <regexp pattern="java:[0-9]+: warning: .*"/>
- </linecontainsregexp>
- <!-- Trim whitespace and boilerplate -->
- <trim/>
- <replacestring from="[javac] ${basedir}${file.separator}" to=""/>
- <!-- Ignore anything that's not from a source directory (e.g. dagger generated code) -->
- <linecontainsregexp>
- <regexp pattern="^(modules${file.separator}[a-z]+${file.separator})?src.*"/>
- </linecontainsregexp>
- <!-- Sort the results in file order -->
- <sortfilter/>
- </filterchain>
- </copy>
-
- <copy file="reports/warnings.txt" tofile="reports/warnings-deprecations.txt">
- <filterchain>
- <linecontainsregexp>
- <regexp pattern=".*: warning: \[deprecation\] .*"/>
- </linecontainsregexp>
- </filterchain>
- </copy>
-
- <copy file="reports/warnings.txt" tofile="reports/warnings-other.txt">
- <filterchain>
- <linecontainsregexp negate="true">
- <regexp pattern=".*: warning: \[deprecation\] .*"/>
- </linecontainsregexp>
- </filterchain>
- </copy>
- </target>
-
- <target name="teamcity-warnings-report">
- <resourcecount property="warnings.count">
- <tokens>
- <concat>
- <filterchain>
- <tokenfilter>
- <linetokenizer/>
- </tokenfilter>
- </filterchain>
- <fileset file="reports/warnings.txt"/>
- </concat>
- </tokens>
- </resourcecount>
-
- <copy file="etc/warnings/template.xml" tofile="teamcity-info.xml">
- <filterset>
- <filter token="COUNT" value="${warnings.count}"/>
- </filterset>
- </copy>
- </target>
-
- <target name="-init-tattletale">
- <taskdef name="report"
- classname="org.jboss.tattletale.ant.ReportTask"
- classpathref="analyse-classpath"/>
- </target>
-
- <target name="tattletale" depends="-init-tattletale">
- <report source="modules/plugins/dist/" destination="reports/tattletale/"/>
- </target>
- </project>
|