aboutsummaryrefslogtreecommitdiff
path: root/build.xml
blob: ebd31dc3e2b4826ac534fdd8ef70278e10e3ea31 (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
<project name="Wall-J" default="zip" basedir=".">

    <property name="dir.out" value="."/>
    <property name="dir.lib" value="lib"/>
    <property name="dir.src" value="src"/>
    <property name="dir.javasrc" value="${dir.src}/main/java"/>
    <property name="dir.docsrc" value="${dir.src}/docs"/>
    <property name="dir.classes" value="classes"/>
    <property name="dir.docs" value="docs"/>
    <property name="dir.apidoc" value="${dir.docs}/doc"/>
    <property name="dir.zipsubdir" value="Naili_Tran-Girard_WallJ.zip"/>

    <property name="file.jar" value="${dir.out}/wallj.jar"/>
    <property name="file.zip" value="${dir.out}/NailiTran-Girard_WallJ.zip"/>
    <property name="file.ant" value="build.xml"/>
    <property name="file.readme" value="readme.md"/>

    <property name="class.entry" value="fr.umlv.java.wallj.Main"/>

    <target name="compile">
        <mkdir dir="${dir.classes}"/>
        <javac srcdir="${dir.src}" destdir="${dir.classes}" includeantruntime="false">
            <classpath>
                <fileset dir="${dir.lib}" includes="*.jar"/>
            </classpath>
        </javac>
    </target>

    <target name="jar" depends="compile">
        <manifestclasspath property="jar.classpath" jarfile="${file.jar}">
            <classpath>
                <fileset dir="${dir.lib}" includes="*.jar"/>
            </classpath>
        </manifestclasspath>
        <jar jarfile="${file.jar}" basedir="${dir.classes}">
            <manifest>
                <attribute name="Main-Class" value="${class.entry}"/>
                <attribute name="Class-Path" value="${jar.classpath}"/>
            </manifest>
            <zipfileset prefix="${dir.lib}" dir="${dir.lib}" includes="*.jar"/>
        </jar>
    </target>

    <target name="javadoc">
        <mkdir dir="${dir.apidoc}"/>
        <javadoc sourcepath="${dir.javasrc}" destdir="${dir.apidoc}"/>
    </target>

    <target name="docs">
        <mkdir dir="${dir.docs}"/>
        <apply executable="pandoc" dest="${dir.docs}">
            <arg value="--template"/>
            <arg value="${dir.docsrc}/report-template.tex"/>
            <arg value="--filter=pandoc-filter-plantuml.sh"/>
            <arg value="--filter=pandoc-filter-tikz.py"/>
            <arg value="--number-sections"/>
            <arg value="--listings"/>
            <arg value="--output"/>
            <targetfile/>
            <srcfile/>
            <fileset dir="${dir.docsrc}" includes="*.md"/>
            <mapper type="glob" from="*.md" to="*.pdf"/>
        </apply>
    </target>

    <target name="zip" depends="jar,docs">
        <zip destfile="${file.zip}" encoding="UTF-8">
            <zipfileset dir="." excludes="**/*" prefix="${dir.zipsubdir}/${dir.apidoc}"/>
            <zipfileset dir="." excludes="**/*" prefix="${dir.zipsubdir}/${dir.classes}"/>

            <zipfileset dir="${dir.lib}" includes="*.jar" prefix="${dir.zipsubdir}/${dir.lib}"/>
            <zipfileset dir="${dir.javasrc}" includes="**/*.java" prefix="${dir.zipsubdir}/${dir.javasrc}"/>
            <zipfileset dir="${dir.docs}" includes="*.pdf" prefix="${dir.zipsubdir}/${dir.docs}"/>

            <zipfileset file="${file.ant}" prefix="${dir.zipsubdir}"/>
            <zipfileset file="${file.jar}" prefix="${dir.zipsubdir}"/>
            <zipfileset file="${file.readme}" prefix="${dir.zipsubdir}"/>
        </zip>
    </target>

    <target name="clean">
        <delete includeEmptyDirs="true" failonerror="false">
            <fileset dir="${dir.classes}"/>
            <fileset dir="${dir.docs}"/>
            <fileset file="${file.jar}"/>
            <fileset file="${file.zip}"/>
        </delete>
    </target>

</project>