-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
107 lines (81 loc) · 4.21 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
100
101
102
103
104
105
106
<project default="compile">
<!-- build.xml for networking-chat, W14, CS56
name: Eric Chen -->
<property environment="env"/> <!-- load the environment variables -->
<property name="webRoot" value="${env.HOME}/public_html/cs56/${projectName}" />
<property name="webBaseURL" value="http://www.cs.ucsb.edu/~${env.USER}/cs56/${quarter}/issues" />
<property name="projectName" value="cs56_networking_chat" />
<property name="javadocDest" value="${webRoot}/${projectName}/javadoc" />
<property name="javadocURL" value="${webBaseURL}/${projectName}/javadoc" />
<property name="jwsDest" value="${webRoot}/${projectName}" />
<property name="jwsURL" value="${webBaseURL}/${projectName}" />
<property name="mainClassClient" value="client.controller.RunClient" />
<property name="mainClassServer" value="server.controller.RunServer" />
<property name="server" value="Server" />
<property name="client" value="Client" />
<path id="project.class.path">
<pathelement location="build"/>
<pathelement location="lib/junit-4.8.2.jar"/>
</path>
<target name="compile" description="compile the code">
<mkdir dir="build" />
<javac srcdir="src" destdir="build" debug="true" debuglevel="lines,source" includeantruntime="false">
<classpath refid="project.class.path" />
</javac>
<copy todir="build/resources">
<fileset dir="resources"/>
</copy>
</target>
<target name="clean" description="delete unnecessary files and directories">
<delete dir="build" quiet="true" />
<delete dir="javadoc" quiet="true" />
<delete dir="dist" quiet="true" />
<delete dir="temp" quiet="true" />
</target>
<property name="javadoc_absolute_path" location="javadoc"/>
<target name="javadoc" depends="compile" description="generate javadocs from code">
<delete dir="javadoc" />
<javadoc destdir="javadoc" >
<fileset dir="src" includes="**/*.java"/> <classpath refid="project.class.path" />
<link href="https://docs.oracle.com/javase/8/docs/api/" />
</javadoc>
<echo>javadoc written to file://${javadoc_absolute_path}/index.html</echo>
</target>
<target name="test" depends="compile" description="run JUnit tests">
<junit haltonerror="no" haltonfailure="no">
<classpath refid="project.class.path" />
<batchtest fork="yes">
<fileset dir="src">
<!-- this will pick up every class with a name ending in Test -->
<include name="**/*Test.java"/>
</fileset>
</batchtest>
<formatter type="plain" usefile="false" />
</junit>
</target>
<target name="dist" depends="compile" description="make jar files">
<mkdir dir="dist" />
<mkdir dir="build/resources"/>
<copy todir="build/resources">
<fileset dir="resources"/>
</copy>
<!-- <jar destfile="dist/${client}.jar" basedir="build" includes="edu/ucsb/cs56/${quarter}/${env.USER}/chatclient/**" excludes="**/chatserver"> -->
<jar destfile="dist/${client}.jar" basedir="build" >
<manifest>
<attribute name="Main-Class" value="${mainClassClient}"/>
</manifest>
</jar>
<jar destfile="dist/${server}.jar" basedir="build" includes="server/**" excludes="**/client" >
<manifest>
<attribute name="Main-Class" value="${mainClassServer}"/>
</manifest>
</jar>
<chmod dir="dist" perm="755" type="file" includes="**/*"/>
</target>
<target name="client" depends="compile, dist" description="run the client">
<java jar="dist/Client.jar" fork="true" classpath="build" />
</target>
<target name="server" depends="compile" description="run the server">
<java classname="${mainClassServer}" fork="true" classpath="build" />
</target>
</project>