133 lines
4.3 KiB
XML
133 lines
4.3 KiB
XML
<project name="NetPaint" default="runclient" basedir=".">
|
|
<description>
|
|
Performs different build tasks for the NetText project.
|
|
</description>
|
|
|
|
<!-- Global Properties -->
|
|
<property name="user.name" location="Vladimir Urazov" />
|
|
<property name="src" location="src" />
|
|
<property name="docs" location="apidoc" />
|
|
<property name="doc_packages" value="nettext.*" />
|
|
<property name="classes" location="build" />
|
|
<property name="libs" location="lib" />
|
|
<property name="jarname_server" value="NetPaintServer.jar" />
|
|
<property name="jarname_client" value="NetPaintClient.jar" />
|
|
<property name="runClass_server" value="nettext.server.ServerRunner" />
|
|
<property name="runClass_client" value="nettext.client.ClientRunner" />
|
|
<property name="checkstyle_logfile" value="checkstyle_log.txt" />
|
|
<property name="pmd_logfile" value="pmd_log.html" />
|
|
<property name="pmd_rules" value="rulesets/basic.xml,rulesets/unusedcode.xml,rulesets/design.xml,rulesets/imports.xml" />
|
|
|
|
<!-- Paths -->
|
|
<property name="pmd_path" location="/net/hu15/cs2335/java/pmd/lib" />
|
|
<property name="checkstyle_path" location="/net/hu15/cs2335/java/checkstyle" />
|
|
|
|
<path id="pmd.classpath">
|
|
<fileset dir="${pmd_path}">
|
|
<include name="*.jar"/>
|
|
</fileset>
|
|
</path>
|
|
|
|
<path id="checkstyle.classpath">
|
|
<fileset dir="${checkstyle_path}">
|
|
<include name="checkstyle-all-3.3.jar" />
|
|
</fileset>
|
|
</path>
|
|
|
|
<!-- Taskdefs -->
|
|
<taskdef resource="checkstyletask.properties" classpathref="checkstyle.classpath" />
|
|
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath" />
|
|
|
|
<!-- Targets -->
|
|
<target name="init">
|
|
<!-- Create the time stamp -->
|
|
<tstamp />
|
|
</target>
|
|
|
|
<target name="build" depends="init" description="Compiles the program">
|
|
<!-- Make sure the necessary directory structure exists -->
|
|
<mkdir dir="${classes}" />
|
|
|
|
<!-- Compile -->
|
|
<javac srcdir="${src}" destdir="${classes}" />
|
|
|
|
<copy todir="${classes}/nettext/util">
|
|
<fileset dir="Images"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<target name="javadoc" description="Creates JavaDoc for NetText">
|
|
<!-- Make sure the necessary directory structure exists -->
|
|
<mkdir dir="${docs}" />
|
|
|
|
<!-- Generate comments -->
|
|
<javadoc packagenames="${doc_packages}" sourcepath="${src}" destdir="${docs}" />
|
|
</target>
|
|
|
|
<target name="jar" depends="build" description="Package the compiled classes into a JAR file.">
|
|
<jar destfile="${jarname_server}" basedir="${classes}">
|
|
<manifest>
|
|
<attribute name="Built-By" value="${user.name}" />
|
|
|
|
<attribute name="Main-Class" value="${runClass_server}" />
|
|
</manifest>
|
|
</jar>
|
|
|
|
<jar destfile="${jarname_client}" basedir="${classes}">
|
|
<manifest>
|
|
<attribute name="Built-By" value="${user.name}" />
|
|
|
|
<attribute name="Main-Class" value="${runClass_client}" />
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="runserver" depends="build" description="Start the server">
|
|
<java classname="${runClass_server}" fork="true">
|
|
<classpath>
|
|
<pathelement path="${classes}" />
|
|
</classpath>
|
|
|
|
</java>
|
|
</target>
|
|
|
|
<target name="runclient" depends="build" description="Start the client">
|
|
<java classname="${runClass_client}" fork="true">
|
|
<classpath>
|
|
<pathelement path="${classes}" />
|
|
</classpath>
|
|
</java>
|
|
</target>
|
|
|
|
<target name="checkstyle" description="Checks all of the source code with Checkstyle.">
|
|
<checkstyle config="${checkstyle_path}/docs/sun_checks.xml" failOnViolation="false">
|
|
<fileset dir="${src}" includes="**/*.java" />
|
|
|
|
<formatter type="plain" toFile="${checkstyle_logfile}" />
|
|
</checkstyle>
|
|
</target>
|
|
|
|
<target name="pmd" description="Run PMD against all source code files.">
|
|
<pmd rulesetfiles="${pmd_rules}">
|
|
<fileset dir="${src}" includes="**/*.java" />
|
|
|
|
<formatter type="html" toFile="${pmd_logfile}" />
|
|
</pmd>
|
|
</target>
|
|
|
|
<target name="all">
|
|
<antcall target="checkstyle" />
|
|
<antcall target="pmd" />
|
|
<antcall target="build" />
|
|
<antcall target="javadoc" />
|
|
</target>
|
|
|
|
<target name="clean">
|
|
<delete dir="${classes}" />
|
|
<delete dir="${docs}" />
|
|
<delete file="${jarname}" />
|
|
<delete file="${checkstyle_logfile}" />
|
|
<delete file="${pmd_logfile}" />
|
|
</target>
|
|
</project>
|