forked from ucsb-cs56-projects/cs56-games-pokemon-map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
199 lines (148 loc) · 6.11 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
192
193
194
195
196
197
198
199
<?xml version="1.0" encoding="utf-8"?>
<project default="compile">
<!-- build.xml for Mantis issue 0000748
name: Sam Baldwin for CS56, S12 -->
<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="S12" />
<property name="issueNum" value="0000748" />
<property name="mainClass" value="edu.ucsb.cs56.S12.sbaldwin.pokemon.GameMain" />
<property name="projectName" value="${course}_${quarter}_${issueNum}" />
<property name="projectPath" value="${course}/${quarter}/issues/${issueNum}" />
<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" />
<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" >
<mkdir dir="build" />
<javac srcdir="src" destdir="build" debug="true" debuglevel="lines,vars,source" includeantruntime="false">
<classpath refid="project.class.path" />
</javac>
<copy todir="build/images">
<fileset dir="src/edu/ucsb/cs56/S12/sbaldwin/pokemon/images"/>
</copy>
<copy todir="build/music">
<fileset dir="src/edu/ucsb/cs56/S12/sbaldwin/pokemon/music"/>
</copy>
</target>
<target name="run" depends="compile">
<java classname="${mainClass}" classpath="build" fork="true" />
</target>
<target name="clean" >
<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="linenumbers" description="Creates a file containing all source files with line numbers">
<exec executable="bash">
<arg value="-c"/>
<arg value='tree -ifQ src | grep \.java\"$ | xargs pr -n > numberedsource.txt'/>
</exec>
</target>
<target name="javadoc" depends="compile">
<delete dir="javadoc" quiet="true" />
<javadoc destdir="javadoc" author="true" version="true" use="true" >
<fileset dir="src" includes="**/*.java"/>
<classpath refid="project.class.path" />
</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="jar" depends="compile">
<mkdir dir="dist" />
<jar destfile="dist/${projectName}.jar" basedir="build" >
<manifest>
<attribute name="Main-Class" value="${mainClass}"/>
</manifest>
</jar>
</target>
<target name="download" >
<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="jws" depends="compile,jar">
<delete dir="${webRoot}/${projectPath}/jws" />
<mkdir dir="${webRoot}/${projectPath}/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>
<target name="publish" depends="jar,javadoc,download,jws,linenumbers">
<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>
<copy file="numberedsource.txt" todir="${webRoot}/${projectPath}/browse"/>
<chmod dir="${webRoot}/${projectPath}"
perm="755" type="both" includes="**/*"/>
<echo>Project published to ${webBaseUrl}/${projectPath}</echo>
</target>
</project>