summaryrefslogtreecommitdiffstats
blob: 6aaf392eb7808a3fefb54c338296ffb0fc8c6acc (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--
 * Copyright (c) 2010, Isode Limited, London, England.
 * All rights reserved.
 -->
<project name="Stroke" default="dist" basedir=".">
    <description>
        XMPP Library porting Swiften to Java.
    </description>
  <property name="src" location="src"/>
  <property name="doc" location="doc"/>
  <property name="src.tests" location="test"/>
  <property name="test.results" location="test-results"/>
  <property name="build" location="build"/>
  <property name="dist"  location="dist"/>
  <property name="jar" value="${dist}/lib/stroke.jar"/>
  <property name="main-class" value="com.isode.stroke.examples.gui.StrokeGUI"/>
  <property name="compile.debug" value="true"/>
  <property name="testsuiteclass" value="com.isode.stroke.unittest.StrokeTestSuite" />
  <property name="xpp-dir" value="../third-party/xpp"/>
  <property name="jzlib-dir" value="../third-party/jzlib"/>
  <property name="icu4j-dir" value="../third-party/icu4j"/>

  <path id="classpath">
    <fileset dir="${xpp-dir}" includes="xpp.jar"/>
    <fileset dir="${jzlib-dir}" includes="jzlib.jar"/>
    <fileset dir="${icu4j-dir}" includes="icu4j.jar"/>
  </path>
  <target name="init">
    <tstamp/>
    <mkdir dir="${build}"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <javac srcdir="${src}" destdir="${build}" classpathref="classpath" debug="${compile.debug}">
        <compilerarg line="-encoding utf-8"/>
    </javac>
  </target>

  <target name="dist" depends="compile"
        description="generate the distribution" >
    <mkdir dir="${dist}/lib"/>

    <jar jarfile="${jar}" basedir="${build}"/>
    <manifest file="MANIFEST.MF">
        <attribute name="Main-Class" value="${main-class}"/>
    </manifest>
  </target>

<target name="compile-tests" depends="dist"
        description="compile the test sources " >
    <javac srcdir="${src.tests}" destdir="${src.tests}" debug="${compile.debug}">
        <compilerarg line="-encoding utf-8"/>
        <classpath>
            <pathelement location="${jar}"/>
            <pathelement location="${JUNIT_JAR}"/>
        </classpath>
    </javac>
  </target>

  <target name="test" depends="compile-tests">
      <delete dir="${test.results}"/>
      <mkdir dir="${test.results}"/>
    <junit fork="false">
        <formatter type="plain"/>
        <classpath>
            <pathelement location="${JUNIT_JAR}"/>
            <pathelement location="${jar}"/>
            <pathelement location="${src.tests}"/>
	    <path refid="classpath"/>
        </classpath>
        <batchtest fork="yes" todir="${test.results}">
            <fileset dir="${src.tests}">
                <include name="**/*Test.java"/>
                <!--<exclude name="**/AllTests.java"/>-->
            </fileset>
        </batchtest>
    </junit>
  </target>

  <target name="clean"
        description="clean up" >
    <delete dir="${build}"/>
    <delete dir="${test.results}"/>
    <delete dir="${dist}"/>
    <delete dir="${doc}"/>
  </target>

  <target name="javadoc" depends="init">
    <!-- Note that this may stall if no network connection is available
         to the Oracle website -->
    <javadoc packagenames="com.isode.**.**"
     sourcepath="${src}"
     destdir="${doc}"
     windowtitle="Stroke">
     <classpath> 
       <fileset dir="${xpp-dir}" includes="xpp.jar"/>
     </classpath>
      <link href="http://docs.oracle.com/javase/6/docs/api/"/>
   </javadoc>
  </target>



  <target name="run" description="Run the demo" depends="dist">
      <java fork="true" classname="${main-class}">
          <classpath>
            <path refid="classpath"/>
            <path location="${jar}"/>
          </classpath>
      </java>
  </target>
</project>