-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.xml
183 lines (149 loc) · 7.07 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
<?xml version="1.0" ?>
<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="build/classes/"/>
<property name="modules" value="modules"/>
<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"/>
<include name="plugins/*.jar"/>
</fileset>
<!-- 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_FULL" value="${env.GIT_COMMIT}" else="MANUAL">
<isset property="env.GIT_COMMIT"/>
</condition>
<condition property="label" value="${label}" else="Compiling LWC">
<isset property="label"/>
</condition>
<!-- Substring script -->
<scriptdef name="substring" language="javascript">
<attribute name="text"/>
<attribute name="start"/>
<attribute name="end"/>
<attribute name="property"/>
<![CDATA[
var text = attributes.get("text");
var start = attributes.get("start") || 0;
var end = attributes.get("end") || text.length();
if (end > text.length()) {
end = text.length()
}
project.setProperty(attributes.get("property"), text.substring(start, end));
]]>
</scriptdef>
<target name="all" depends="buildall" description="Build LWC and all modules"/>
<target name="compile-core" description="Compile core LWC">
<mkdir dir="${bin}"/>
<mkdir dir="${bin}/core/"/>
<mkdir dir="${bin}/core/resources/"/>
<!-- Timestamp, bitches -->
<tstamp>
<!-- Date format: MONTH DD YYYY e.g January 25, 2012 -->
<format property="build.time" pattern="MMMM dd, yyyy" offset="0" unit="hour" />
</tstamp>
<!-- Load the version -->
<loadfile srcfile="VERSION" property="VERSION"/>
<!-- Trim the git commit -->
<substring text="${GIT_COMMIT_FULL}" start="0" end="8" property="GIT_COMMIT"/>
<!-- Copy plugin.yml to ${bin}/core/resources -->
<copy file="src/main/resources/plugin.yml" todir="${bin}/core/resources/" overwrite="true"/>
<!-- Replace ${VERSION} with the version number in plugin.yml -->
<replace file="${bin}/core/resources/plugin.yml" value="${VERSION} (b${BUILD_NUMBER}-git-${GIT_COMMIT}) (${build.time})">
<replacefilter token="@VERSION@"/>
</replace>
<echo>${label}</echo>
<javac source="1.6" target="1.6" srcdir="${src}/main/java/" destdir="${bin}/core/"
debug="true" debuglevel="lines,vars,source" deprecation="true" includeantruntime="true">
<compilerarg value="-Xlint:-options"/>
<classpath>
<fileset refid="libs"/>
</classpath>
</javac>
</target>
<target name="compile-economy" description="Compile LWC-Economy">
<mkdir dir="${bin}"/>
<mkdir dir="${bin}/economy/"/>
<delete file="${build}/.buildeconomy"/>
<echo>Compiling LWC-Economy</echo>
<javac source="1.6" target="1.6" srcdir="${economy}/main/java/" destdir="${bin}/economy/" deprecation="true" debug="true"
debuglevel="lines,vars,source" includeantruntime="true">
<compilerarg value="-Xlint:-options"/>
<classpath>
<fileset refid="libs"/>
<dirset dir="${bin}/core/"/>
</classpath>
</javac>
</target>
<target name="compile-spout" description="Compile LWC-Spout">
<mkdir dir="${bin}"/>
<mkdir dir="${bin}/spout/"/>
<delete file="${build}/.buildspot"/>
<echo>Compiling LWC-Spout</echo>
<javac source="1.6" target="1.6" srcdir="${spout}/main/java/" destdir="${bin}/spout/" deprecation="true" debug="true"
debuglevel="lines,vars,source" includeantruntime="true">
<compilerarg value="-Xlint:-options"/>
<classpath>
<fileset refid="libs"/>
<dirset dir="${bin}/core/"/>
</classpath>
</javac>
</target>
<target name="buildall" description="Build the distribution files" depends="lwc,economy,spout">
<copy tofile="${build}/VERSION" file="VERSION" overwrite="yes"/>
</target>
<target name="lwc" description="Build LWC.jar" depends="compile-core">
<echo>Building LWC.jar</echo>
<jar jarfile="${build}/${jar.core}">
<fileset dir="${src}/main/resources/" includes="lang/*"/>
<fileset dir="${bin}/core/resources/" includes="**/*"/>
<fileset dir="${bin}/core/" excludes="resources/**"/>
<fileset dir="." includes="config/**.yml" />
<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="b${BUILD_NUMBER}-git-${GIT_COMMIT}"/>
</manifest>
</jar>
</target>
<target name="economy" description="Build LWC-Economy.jar" depends="compile-economy">
<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" depends="compile-spout">
<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>
</project>