This repository has been archived by the owner on Jan 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
143 lines (122 loc) · 4.71 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is a custom project build file to be used with Apache Ant
By default the command `ant` executes the "all" target, which compiles all source files and creates a JAR.
Other potential targets can be viewed on the command line with `ant -p`.
Main targets:
all Builds the entire TWCore distribution
bots Builds the TWCore bots
clean Deletes the jar and all class files
cfg Copies all the .cfg files from the src directory to the bin directory if file doesn't exist
core Builds the TWCore core
dir Builds a specific directory. (e.g. ant dir -Ddir=bots/multibot)
jar Creates JAR file
javadoc Creates Java API Documentation
path Prints TWCores classpath
restricted Builds the restricted bots directory
run Runs the TWCore JAR
NOTE: The "restricted" target builds .class files in bin/ for bots that aren't open source
Notice that the .class files are copied to their declared java import paths
E.g. src/twcore/bots/restricted/staffbot/staffbot.java = bin/twcore/bots/staffbot/staffbot.class
DEBUG: To compile the project with jdb debugging enabled use -Ddebug=true
-->
<project name="twcore" default="all" basedir=".">
<path id="classpath">
<fileset dir="bin" includes="*.jar"/>
<fileset dir="lib" includes="*.jar"/>
</path>
<property name="debug" value="off"/>
<target name="all" depends="clean,jar,bots" description="Builds the entire TWCore distribution">
<echo>Project build complete</echo>
</target>
<target name="bots" description="Builds the TWCore bots">
<echo>Compiling Bots</echo>
<javac classpathref="classpath" srcdir="src/twcore/bots" destdir="bin" debug="${debug}" debuglevel="lines,vars,source" includeantruntime="false" />
</target>
<target name="clean" description="Deletes the jar and all class files">
<echo>Deleting Files</echo>
<delete failonerror="false">
<fileset dir="bin">
<include name="twcore.jar"/>
</fileset>
<fileset dir="bin/twcore">
<include name="**/**.class"/>
</fileset>
</delete>
</target>
<target name="cfg" description="Copies all the .cfg files from the src directory to the bin directory if file doesn't exist">
<echo>Copying Bot configuration files</echo>
<touch>
<fileset dir="bin">
<include name="**/**.cfg"/>
<include name="**/**.xml"/>
</fileset>
</touch>
<copy todir="bin">
<fileset dir="src">
<exclude name="**/restricted/**"/>
<include name="**/**.cfg"/>
<include name="**/**.xml"/>
</fileset>
</copy>
<copy todir="bin/twcore/bots">
<fileset dir="src/twcore/bots/restricted">
<include name="**/**.cfg"/>
<include name="**/**.xml"/>
</fileset>
</copy>
</target>
<target name="core" description="Builds the TWCore core">
<echo>Compiling Core</echo>
<mkdir dir="bin"></mkdir>
<javac classpathref="classpath" srcdir="src/twcore/core" destdir="bin" includeantruntime="false" />
</target>
<target name="dir" description="Builds a specific directory. (e.g. ant dir -Ddir=bots/multibot)">
<echo>Compiling directory ${dir}</echo>
<javac classpathref="classpath" srcdir="src/twcore/${dir}" destdir="bin" debug="${debug}" debuglevel="lines,vars,source" includeantruntime="false" />
</target>
<target name="jar" description="Creates JAR file" depends="core">
<echo>Creating Jar File</echo>
<manifestclasspath property="jar.classpath" jarfile="bin/twcore.jar">
<classpath refid="classpath" />
</manifestclasspath>
<jar destfile="bin/twcore.jar">
<fileset dir="bin"></fileset>
<manifest>
<attribute name="Main-Class" value="twcore.core.Start"/>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</jar>
</target>
<target name="javadoc" description="Creates Java API Documentation">
<mkdir dir="javadoc"></mkdir>
<javadoc
access="package"
author="true"
classpathref="classpath"
destdir="javadoc"
doctitle="Trench Wars Bot Core (TWCore) API Documentation"
nodeprecated="false"
nodeprecatedlist="false"
noindex="false"
nonavbar="false"
notree="false"
sourcepath="src"
splitindex="true"
use="true"
version="true"/>
</target>
<target name="restricted" description="Builds the restricted bots directory">
<echo>Compiling Restricted Bots</echo>
<javac classpathref="classpath" srcdir="src/twcore/bots/restricted" destdir="bin" debug="${debug}" debuglevel="lines,vars,source" includeantruntime="false" />
</target>
<target name="run" description="Runs the TWCore JAR">
<java jar="bin/twcore.jar" fork="true">
<arg value="bin/setup.cfg"/>
</java>
</target>
<target name="path" description="Prints TWCores classpath">
<pathconvert property="path" refid="classpath"/>
<echo message="${path}"/>
</target>
</project>