-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.xml
207 lines (173 loc) · 8.19 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
200
201
202
203
204
205
206
207
<?xml version="1.0" ?>
<!--
~ Copyright 2011 Tyler Blair. All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without modification, are
~ permitted provided that the following conditions are met:
~
~ 1. Redistributions of source code must retain the above copyright notice, this list of
~ conditions and the following disclaimer.
~
~ 2. Redistributions in binary form must reproduce the above copyright notice, this list
~ of conditions and the following disclaimer in the documentation and/or other materials
~ provided with the distribution.
~
~ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
~ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
~ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
~ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
~ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
~ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
~ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
~ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~
~ The views and conclusions contained in the software and documentation are those of the
~ authors and contributors and should not be interpreted as representing official policies,
~ either expressed or implied, of anybody else.
-->
<project name="LWC" default="all">
<!-- Name of the jar to create -->
<property name="jar.core" value="LWC.jar"/>
<property name="jar.economy" value="LWC-Economy.jar"/>
<property name="jar.spout" value="LWC-Spout.jar"/>
<property name="lib" value="lib"/>
<property name="src" value="src"/>
<property name="bin" value="bin"/>
<property name="modules" value="modules"/>
<property name="core" value="${modules}/core/src/"/>
<property name="economy" value="${modules}/economy/src/"/>
<property name="spout" value="${modules}/spout/src/"/>
<property name="build" value="build"/>
<!-- Location of the plugins folder development server -->
<property name="dev" value="../../minecraft/plugins"/>
<!-- Libraries used by LWC & modules -->
<fileset dir="${lib}" id="libs">
<include name="*.jar"/>
</fileset>
<!-- JUnit testing -->
<property name="test.classname" value="com.griefcraft.LWCTestSuite"/>
<path id="test.classpath">
<pathelement location="${bin}/core/"/>
<pathelement location="${bin}/economy/"/>
<pathelement location="${bin}/spout/"/>
<pathelement location="${bin}/test/"/>
<fileset refid="libs"/>
</path>
<!-- Jenkins integration -->
<property environment="env"/>
<condition property="BUILD_NUMBER" value="${env.BUILD_NUMBER}" else="MANUAL">
<isset property="env.BUILD_NUMBER"/>
</condition>
<condition property="GIT_COMMIT" value="${env.GIT_COMMIT}" else="MANUAL">
<isset property="env.GIT_COMMIT"/>
</condition>
<target name="all" depends="clean,compile,build,lwc,economy,spout" description="Build LWC and all modules"/>
<target name="clean">
<!-- Delete the previous folders -->
<delete dir="${bin}/core/"/>
<delete dir="${bin}/economy/"/>
<delete dir="${bin}/spout/"/>
<delete dir="${bin}/test/"/>
<!-- create some folders -->
<mkdir dir="${bin}/core/"/>
<mkdir dir="${bin}/economy/"/>
<mkdir dir="${bin}/spout/"/>
<mkdir dir="${bin}/test/"/>
</target>
<target name="compile" description="Compilation">
<echo>${label}</echo>
<javac srcdir="${src}/main/java/;${core};" destdir="${bin}/core/"
debug="true" debuglevel="lines,vars,source" deprecation="true" includeantruntime="true">
<classpath>
<fileset refid="libs"/>
</classpath>
</javac>
<echo>Compiling LWC-Economy</echo>
<javac srcdir="${economy}/main/java/" destdir="${bin}/economy/" deprecation="true" debug="true"
debuglevel="lines,vars,source" includeantruntime="true">
<classpath>
<fileset refid="libs"/>
<dirset dir="${bin}/core/"/>
</classpath>
</javac>
<echo>Compiling LWC-Spout</echo>
<javac srcdir="${spout}/main/java/" destdir="${bin}/spout/" deprecation="true" debug="true"
debuglevel="lines,vars,source" includeantruntime="true">
<classpath>
<fileset refid="libs"/>
<dirset dir="${bin}/core/"/>
</classpath>
</javac>
<echo>Compiling LWC Unit Tests</echo>
<javac srcdir="${src}/test/main/java/" destdir="${bin}/test/" deprecation="true" debug="true"
debuglevel="lines,vars,source" includeantruntime="true">
<classpath>
<fileset refid="libs"/>
<dirset dir="${bin}/core/"/>
<dirset dir="${bin}/economy/"/>
</classpath>
</javac>
</target>
<target name="build" description="Build the distribution files">
<delete dir="${build}"/>
<mkdir dir="${build}"/>
<copy tofile="${build}/VERSION" file="VERSION" overwrite="yes"/>
</target>
<target name="lwc" description="Build LWC.jar">
<echo>Building LWC.jar</echo>
<jar jarfile="${build}/${jar.core}">
<fileset dir="${src}" includes="lang/*"/>
<fileset dir="${src}/resources/" includes="**/*"/>
<fileset dir="${bin}/core/"/>
<manifest>
<attribute name="Implementation-Title" value="LWC"/>
<attribute name="Implementation-Vendor" value="Hidendra"/>
<!-- <attribute name="Implementation-Version" value="git-LWC-${GIT_COMMIT}-b${BUILD_NUMBER}jnks" /> -->
<attribute name="Implementation-Version" value="${BUILD_NUMBER}"/>
</manifest>
</jar>
</target>
<target name="economy" description="Build LWC-Economy.jar">
<echo>Building LWC-Economy.jar</echo>
<jar jarfile="${build}/${jar.economy}">
<fileset dir="${economy}/resources/" includes="plugin.yml"/>
<fileset dir="${bin}/economy/"/>
<manifest>
<attribute name="Class-Path" value="LWC.jar"/>
<attribute name="Implementation-Title" value="LWC"/>
<attribute name="Implementation-Vendor" value="Hidendra"/>
<attribute name="Implementation-Version" value="${BUILD_NUMBER}"/>
</manifest>
</jar>
</target>
<target name="spout" description="Build LWC-Spout.jar">
<echo>Building LWC-Spout.jar</echo>
<jar jarfile="${build}/${jar.spout}">
<fileset dir="${spout}/resources/" includes="plugin.yml"/>
<fileset dir="${bin}/spout/"/>
<manifest>
<attribute name="Class-Path" value="LWC.jar"/>
<attribute name="Implementation-Title" value="LWC"/>
<attribute name="Implementation-Vendor" value="Hidendra"/>
<attribute name="Implementation-Version" value="${BUILD_NUMBER}"/>
</manifest>
</jar>
</target>
<target name="test">
<mkdir dir="${build}/test-reports/"/>
<!-- Prevent the already packaged classes from interfering -->
<delete dir="${bin}/core/"/>
<delete dir="${bin}/economy/"/>
<delete dir="${bin}/spout/"/>
<junit fork="yes" haltonfailure="yes">
<batchtest fork="yes" todir="${build}/test-reports/">
<fileset dir="${bin}/test/">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
<formatter type="xml"/>
<classpath refid="test.classpath"/>
</junit>
</target>
</project>