forked from perlundq/yajsync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·99 lines (85 loc) · 3.88 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="YajSync">
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.7"/>
<property name="source" value="1.7"/>
<property name="lib.dir" value="/usr/share/java"/> <!-- NOTE: re-define with ant -Dlib.dir=OTHER.PATH.EXAMPLE_1 -->
<property name="junit.jar" value="${lib.dir}/junit4.jar"/> <!-- NOTE: re-define with ant -Djunit.jar=OTHER.PATH.EXAMPLE_2/junit4.jar -->
<property name="build.dir" value="build"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main.class.dir" value="${build.dir}/main"/>
<property name="test.out.dir" value="${build.dir}/test"/>
<property name="test.class.dir" value="${test.out.dir}"/>
<property name="main.src.dir" value="src/main"/>
<property name="test.src.dir" value="src/test"/>
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${main.class.dir}"/>
<delete dir="${jar.dir}"/>
<delete dir="${test.out.dir}"/>
<delete dir="${test.class.dir}"/>
</target>
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${main.class.dir}"/>
<mkdir dir="${jar.dir}"/>
</target>
<target name="build" depends="init">
<javac debug="true" debuglevel="${debuglevel}" destdir="${main.class.dir}" includeantruntime="false" source="${source}" target="${target}">
<src path="${main.src.dir}"/>
</javac>
</target>
<target name="client-jar" depends="build">
<jar destfile="${jar.dir}/yajsync.jar" basedir="${main.class.dir}">
<manifest>
<attribute name="Main-Class" value="com.github.perlundq.yajsync.ui.YajSyncClient"/>
</manifest>
</jar>
</target>
<target name="server-jar" depends="build">
<jar destfile="${jar.dir}/yajsyncd.jar" basedir="${main.class.dir}">
<manifest>
<attribute name="Main-Class" value="com.github.perlundq.yajsync.ui.YajSyncServer"/>
</manifest>
</jar>
</target>
<target name="jar" depends="client-jar,server-jar"/>
<!-- test -->
<target name="init_test">
<mkdir dir="${test.out.dir}"/>
<mkdir dir="${test.class.dir}"/>
</target>
<target name="require_junit4">
<fail message="${junit.jar} does not exist. Please provide the path to junit4.jar with the -D option to ant. Example if the jar file is at /tmp/junit4.jar: -Djunit.jar=/tmp/junit4.jar">
<condition>
<not>
<available file="${junit.jar}"/>
</not>
</condition>
</fail>
</target>
<target name="build_test" depends="build,init_test,require_junit4">
<javac debug="true" debuglevel="${debuglevel}" destdir="${test.class.dir}" source="${source}" target="${target}" includeantruntime="false">
<src path="${test.src.dir}"/>
<classpath>
<pathelement location="${main.class.dir}"/>
<pathelement location="${junit.jar}"/>
</classpath>
</javac>
</target>
<target name="test" depends="build_test">
<junit printsummary="yes" haltonfailure="yes" showoutput="yes" logfailedtests="yes" fork="true" forkmode="once">
<classpath>
<pathelement location="${junit.jar}"/>
<pathelement path="${test.class.dir}"/>
<pathelement path="${main.class.dir}"/>
</classpath>
<formatter type="plain" usefile="false"/>
<batchtest todir="${test.out.dir}">
<fileset dir="${test.src.dir}">
<exclude name="**/ReadableByteBuffer.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>