summaryrefslogtreecommitdiff
path: root/smartdashboard/build.xml
blob: c681afc8b776869d138b6e954adb87587ac28f57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<project name="SmartDashboard" basedir="." default="main">
    <property name="src.dir"   value="src" />
    <property name="test.dir"   value="tests" />
    <property name="build.dir" value="build" />
	<property name="dist.dir" value="dist" />
    <property name="classes.dir" value="${build.dir}/classes" />
	<property name="javadoc.dir" value="${build.dir}/javadoc" />
    <property name="junitreport.dir" value="${build.dir}/junitreport" />
    <property name="lib.dir" value="lib" />

    <property name="main-class" value="edu.wpi.first.smartdashboard.main" />

    <path id="application" location="${jar.dir}/${ant.project.name}.jar" />
    <path id="classpath">
        <fileset dir="${lib.dir}" includes="**/*.jar" />
    </path>

    <target name="clean">
        <delete dir="${build.dir}" />
        <delete dir="${dist.dir}" />
        <delete dir="target" />
        <delete dir="${lib.dir}" includes="NetworkTables-*.jar" />
    </target>

    <target name="compile">
        <exec executable="mvn"><arg value="dependency:copy" /></exec>
        <mkdir dir="${classes.dir}" />
        <javac source="1.6"
               target="1.6"
               srcdir="${src.dir}" 
               destdir="${classes.dir}" 
               classpathref="classpath"
               includeantruntime="false"
               debug="on" 
               debuglevel="lines,vars,source"/>
    </target>
	
	<target name="javadoc">
		<mkdir dir="${javadoc.dir}" />
		<javadoc sourcepath="${src.dir}" destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="Smart Dashboard">
			<doctitle>
				<![CDATA[
				<h1>Smart Dashboard</h1>
				]]>
			</doctitle>
		</javadoc>
		<zip destfile="${dist.dir}/tools/${ant.project.name}.javadoc.zip" basedir="${javadoc.dir}" />
	</target>

    <target name="jar" depends="compile">
        <mkdir dir="${dist.dir}" />
        <jar destfile="${dist.dir}/tools/${ant.project.name}.jar" basedir="${classes.dir}" >
            <manifest>
                <attribute name="Main-Class" value="${main-class}" />
            </manifest>
			<zipgroupfileset dir="lib/" includes="*.jar" /> 
        </jar>
    </target>
    
    <target name="deploy" depends="jar">
      <exec executable="mvn"><arg value="deploy" /></exec>
    </target>
    
    <target name="run" depends="jar">
        <java classname="${main-class}" fork="yes" >
            <classpath>
                <path refid="classpath" />
                <path refid="application" />
            </classpath>
        </java>
    </target>

    <target name="test" depends="jar" >
        <mkdir dir="${junitreport.dir}" />
        <junit fork="yes" printsummary="yes" failureproperty="junit.failure">
            <classpath>
                <path refid="classpath" />
                <path refid="application" />
            </classpath>

            <formatter type="xml" />

            <batchtest todir="${junitreport.dir}">
                <fileset dir="${test.dir}" includes="**/*Test.java" />
            </batchtest>
        </junit>
        <fail if="junit.failure" />
    </target>

    <target name="junitreport">
        <junitreport todir="${junitreport.dir}" >
            <fileset dir="${junitreport.dir}" includes="TEST-*.xml"/>
            <report todir="${junitreport.dir}" />
        </junitreport>
    </target>

    <target name="clean-build" depends="clean,jar" />
    <target name="main" depends="test" />
</project>