Skip to content

Instantly share code, notes, and snippets.

@xavier0507
Created September 21, 2016 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xavier0507/9dddec0f8f2a751c762559c51704c52c to your computer and use it in GitHub Desktop.
Save xavier0507/9dddec0f8f2a751c762559c51704c52c to your computer and use it in GitHub Desktop.
CI: Execute Static Analysis through Ant on Jenkins
<project name="AndroidSampleCode" default="help">
<!-- For findbugs -->
<property name="findbugs.home" value="findbugs-3.0.0" />
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
<classpath>
<fileset dir="${findbugs.home}/lib" includes="**/*jar" />
</classpath>
</taskdef>
<target name="-findbugs" if="findbugs.home">
<echo level="info">Start findbugs...</echo>
<findbugs home="${findbugs.home}" output="xml" outputFile="findbugs.xml" excludeFilter="findbugs-exclude.xml">
<auxClasspath path="${project.target.android.jar}" />
<class location="${out.dir}" />
</findbugs>
</target>
<taskdef resource="checkstyletask.properties" classpath="checkstyle-5.7/checkstyle-5.7-all.jar" />
<target name="-checkstyle" description="Generates a report of code convention violations.">
<checkstyle config="checkstyle-5.7/sun_checks.xml" failureProperty="checkstyle.failure" failOnViolation="false">
<formatter type="xml" tofile="checkstyle_report.xml" />
<fileset dir="src" includes="**/*.java" />
</checkstyle>
</target>
<!--<path id="pmd.classpath">
<pathelement location="${build}"/>
<fileset dir="pmd-bin-5.2.3/lib/">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
<target name="pmd">
<pmd rulesetfiles="pmd-bin-5.2.3/rulesets.xml">
<formatter type="xml" toFile="pmd_report.xml"/>
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
</pmd>
</target> -->
<target name="-post-build" depends="-findbugs,-checkstyle" />
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment