forked from ucsb-cs56-projects/cs56-games-blackjack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
118 lines (102 loc) · 4.27 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="compile">
<!-- build.xml for Mantis issue866
name: Garrett Johnston for CS56, S12 -->
<!-- modified build.xml for Github CS56 Blackjack Project
name: Fanny Kuang for CS56, S13 -->
<!-- modified build.xml for CS56 Blackjack Project
name: Eric Palyan, W14 -->
<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="W13"/>
<property name="projectName" value="blackjack"/>
<property name="mainClass" value="edu.ucsb.cs56.projects.game.blackjack.BlackjackGui"/>
<property name="projectPath" value="${course}/projects/game/${projectName}"/>
<property name="javadocDest" value="${webRoot}/${projectPath}/javadoc"/>
<property name="javadocURL" value="${webBaseUrl}/${projectPath}/javadoc"/>
<property name="imagesDest" value="${webRoot}/${projectPath}/images"/>
<path id="project.class.path">
<pathelement location="build"/>
<pathelement location="lib/junit-4.8.2.jar"/>
</path>
<!-- Compile src code -->
<target name="compile" description="compiles src code into .class files and stores them in build directory">
<mkdir dir="build"/>
<javac srcdir="src" destdir="build" debug="true" debuglevel="lines,source" includeantruntime="false">
<classpath refid="project.class.path"/>
</javac>
<copy todir="build/images">
<fileset dir="images" includes="*.gif"/>
</copy>
</target>
<!-- copy images to web -->
<target name="images" depends="compile,jar" description="copy images to web">
<delete dir="${webRoot}/${projectPath}/images"/>
<mkdir dir="${imagesDest}"/>
<copy todir="${imagesDest}">
<fileset dir="images" includes="*.gif"/>
</copy>
</target>
<!-- Run the Gui -->
<target name="run" depends="compile, jar" description="run the BlackjackGui">
<java fork="true" classname="${mainClass}">
<classpath refid="project.class.path"/>
</java>
</target>
<!-- Clean the directories -->
<target name="clean" description="delete unnecessary files and directories">
<delete failonerror="false" verbose="true">
<fileset dir="build" includes="**/*.class"/>
</delete>
<delete dir="javadoc" quiet="true"/>
<delete dir="dist" quiet="true"/>
<delete dir="download" quiet="true"/>
<delete dir="temp" quiet="true"/>
<delete dir="build/images" quiet="true"/>
</target>
<!-- Run JUnit tests -->
<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>
<!-- Javadoc -->
<target name="javadoc" depends="compile" description="prepare and post javadoc">
<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>
<!-- JAR -->
<target name="jar" depends="compile" description="JAR up files and put into dist directory">
<mkdir dir="dist"/>
<jar destfile="dist/${course}_${quarter}_${projectName}.jar" basedir="build">
<manifest>
<attribute name="Main-Class" value="${mainClass}"/>
</manifest>
</jar>
</target>
</project>