forked from ucsb-cs56-projects/cs56-languages-vocab-quiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
191 lines (143 loc) · 6.26 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?xml version="1.0" encoding="utf-8"?>
<project default="compile">
<!-- build.xml for Mantis ticket 0000341
for: Choice Points 2, S11, CS56
name: Dane Pitkin -->
<property environment="env"/> <!-- load the environment variables -->
<property name="webRoot" value="${env.HOME}/public_html/" />
<property name="webBaseUrl" value="http://www.cs.ucsb.edu/~${env.USER}" />
<property name="course" value="cs56" />
<property name="quarter" value="S11" />
<property name="mainClass" value="ForeignVocabQuizGUI" />
<property name="mantisticket" value="0000341" />
<property name="fullPkg" value="edu.ucsb.cs56.S11.dpitkin.choice3" />
<property name="projectName" value="${course}_${quarter}_${mantisticket}" />
<property name="projectPath" value="${course}/${quarter}/issues/${mantisticket}" />
<property name="javadocDest" value="${webRoot}/${projectPath}/javadoc" />
<property name="javadocURL" value="${webBaseUrl}/${projectPath}/javadoc" />
<property name="jwsDest" value="${webRoot}/${projectPath}/jws"/>
<property name="jwsURL" value="${webBaseUrl}/${projectPath}/jws"/>
<property name="builddir" value="/cs/student/${env.USER}/cs56/choice3/build/text/"/>
<path id="project.class.path">
<pathelement location="build"/>
<pathelement location="/cs/faculty/pconrad/public_html/cs56/lib/junit-4.8.2.jar"/>
</path>
<target name="compile" description="compile my code">
<mkdir dir="build" />
<copy file="text/vocabulary.txt" todir="${builddir}"/>
<javac srcdir="src" destdir="build" debug="true" debuglevel="lines,source">
<classpath refid="project.class.path"/>
</javac>
</target>
<target name="run" depends = "compile" description="run the Main Class program">
<java classname="${fullPkg}.${mainClass}" fork="true">
<classpath refid="project.class.path"/>
</java>
</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="download" quiet="true" />
<delete dir="temp" quiet="true" />
</target>
<target name="test" depends="compile">
<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="jar" depends="compile" description="jar my code" >
<mkdir dir="./dist" />
<jar destfile="./dist/${projectName}.jar" basedir="./build" >
<manifest>
<attribute name="Main-Class" value="#fullPkg.${mainClass}"/>
</manifest>
</jar>
</target>
<target name="download" depends="" description="make my code downloadable">
<delete quiet="true">
<fileset dir="temp" includes="**/*" />
<fileset dir="download" includes="**/*" />
</delete>
<mkdir dir="download" />
<mkdir dir="temp" />
<mkdir dir="temp/${projectName}" />
<copy todir="temp/${projectName}">
<fileset dir="."
excludes="build/**, javadoc/**, **/*~, temp/**, dist/**, download/**"/>
</copy>
<tar destfile="temp/${projectName}.tar"
basedir="temp"
includes="${projectName}/**"
/>
<gzip zipfile="download/${projectName}.tgz"
src="temp/${projectName}.tar" />
<zip destfile="download/${projectName}.zip"
basedir="temp"
includes="${projectName}/**"
/>
<delete quiet="true">
<fileset dir="temp" includes="**/*"/>
</delete>
</target>
<target name="javadoc" depends="compile" description="create javadoc">
<delete dir="./javadoc" quiet="true" />
<javadoc destdir="./javadoc" author="true" version="true" use="true" >
<fileset dir="./src" includes="**/*.java" />
<classpath>
<pathelement location="/cs/faculty/pconrad/public_html/cs56/lib/junit-4.8.2.jar"/>
</classpath>
</javadoc>
<!-- delete the old javadoc -->
<delete quiet="true" dir="${javadocDest}" />
<!-- copy everything you just made to the javadoc destination, and then make it readable -->
<copy todir="${javadocDest}" >
<fileset dir="javadoc"/>
</copy>
<!-- Note: this only does the chmod command on the
javadoc subdirectory and its contents. You MIGHT have to
MANUALLY do the chmod on the parent directories. However,
you should only need to do that once. -->
<chmod dir="${javadocDest}" perm="755" type="dir" includes="**" />
<chmod dir="${javadocDest}" perm="755" type="file" includes="**/*" />
<echo>Javadoc deployed to ${javadocURL}</echo>
</target>
<target name="publish" depends="jar,javadoc,download,jws" description="publish javadoc, jar, and download" >
<mkdir dir="${webRoot}/${projectPath}" />
<delete dir="${webRoot}/${projectPath}/browse" />
<mkdir dir="${webRoot}/${projectPath}/browse" />
<delete dir="${webRoot}/${projectPath}/download" />
<mkdir dir="${webRoot}/${projectPath}/download" />
<copy file="html/index.html" todir="${webRoot}/${projectPath}"/>
<copy todir="${webRoot}/${projectPath}/download" >
<fileset dir="download"/>
<fileset dir="dist" />
</copy>
<copy file="build.xml" todir="${webRoot}/${projectPath}/browse"/>
<copy todir="${webRoot}/${projectPath}/browse/src" >
<fileset dir="src"/>
</copy>
<chmod dir="${webRoot}/${projectPath}"
perm="755" type="both" includes="**/*"/>
<echo>Project published to ${webBaseUrl}/${projectPath}</echo>
</target>
<target name="jws" depends="compile,jar" description="publish java web start">
<delete dir="${webRoot}/${projectName}/jws"/>
<mkdir dir="${webRoot}/${projectName}/jws"/>
<copy todir="${jwsDest}" file="dist/${projectName}.jar"/>
<copy todir="${jwsDest}">
<fileset dir="jws" includes="*.html"/>
<fileset dir="jws" includes="*.jnlp"/>
<fileset dir="jws" includes="*.png"/>
<fileset dir="jws" includes=".htaccess"/>
</copy>
<echo>Java web start at ${jwsURL}</echo>
</target>
</project>