-
Notifications
You must be signed in to change notification settings - Fork 198
/
build.xml
182 lines (161 loc) · 7.06 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
<?xml version="1.0" ?>
<project name="hafen" default="deftgt">
<property file="build.properties" />
<property name="ext-lib-base" value="http://www.havenandhearth.com/java" />
<target name="build-env">
<mkdir dir="build" />
<mkdir dir="build/classes" />
<available property="has-res-jar" file="bin/builtin-res.jar" />
<available property="unpacked-lib" file="build/classes-lib" />
</target>
<target name="make-buildinfo" depends="build-env">
<touch file="build/classes/buildinfo" datetime="01/01/2000 12:00 am" />
<loadproperties srcFile="build/classes/buildinfo" prefix="buildinfo." />
<exec executable="git" outputproperty="git-rev" failifexecutionfails="false">
<arg line="rev-parse HEAD" />
</exec>
<condition property="buildinfo-unchanged">
<equals arg1="${buildinfo.git-rev}" arg2="${git-rev}" />
</condition>
</target>
<target name="buildinfo" depends="make-buildinfo" unless="buildinfo-unchanged">
<echo message="Updating buildinfo" />
<echo file="build/classes/buildinfo" xml:space="default">
git-rev = ${git-rev}
</echo>
</target>
<macrodef name="extlib">
<attribute name="name" />
<attribute name="path" />
<attribute name="url" />
<sequential>
<local name="@{name}-files" />
<mkdir dir="@{path}" />
<loadresource property="@{name}-files">
<url url="@{url}/lib-files" />
<filterchain>
<prefixlines prefix="@{url}/" />
</filterchain>
</loadresource>
<get dest="@{path}/" usetimestamp="true">
<resourcelist>
<propertyresource name="@{name}-files" />
</resourcelist>
</get>
<touch file="@{path}/has-@{name}" />
</sequential>
</macrodef>
<target name="extlib-env">
<mkdir dir="lib/ext" />
<available property="extlib/has-jogl" file="lib/ext/jogl/has-jogl" />
<available property="extlib/has-lwjgl-base" file="lib/ext/lwjgl/has-lwjgl-base" />
<available property="extlib/has-lwjgl-gl" file="lib/ext/lwjgl/has-lwjgl-gl" />
<available property="extlib/has-steamworks" file="lib/ext/steamworks/has-steamworks" />
</target>
<target name="extlib/jogl" depends="extlib-env" unless="extlib/has-jogl">
<extlib name="jogl" path="lib/ext/jogl" url="${ext-lib-base}/jogl/current" />
</target>
<target name="extlib/lwjgl-base" depends="extlib-env" unless="extlib/has-lwjgl-base">
<extlib name="lwjgl-base" path="lib/ext/lwjgl" url="${ext-lib-base}/lwjgl/current/lwjgl" />
</target>
<target name="extlib/lwjgl-gl" depends="extlib-env, extlib/lwjgl-base" unless="extlib/has-lwjgl-gl">
<extlib name="lwjgl-gl" path="lib/ext/lwjgl" url="${ext-lib-base}/lwjgl/current/lwjgl-opengl" />
</target>
<target name="extlib/steamworks" depends="extlib-env" unless="extlib/has-steamworks">
<extlib name="steamworks" path="lib/ext/steamworks" url="${ext-lib-base}/steamworks/current" />
</target>
<target name="hafen-client" depends="build-env, extlib/jogl, extlib/lwjgl-gl, extlib/steamworks">
<javac srcdir="src" destdir="build/classes" debug="on"
source="1.8" target="1.8" includeantruntime="no"
bootclasspath="${boot-classpath}">
<classpath>
<pathelement path="lib/ext/jogl/jogl-all.jar" />
<pathelement path="lib/ext/jogl/gluegen-rt.jar" />
<pathelement path="lib/ext/lwjgl/lwjgl-fat.jar" />
<pathelement path="lib/ext/lwjgl/lwjgl-awt.jar" />
<pathelement path="lib/ext/lwjgl/lwjgl-opengl-fat.jar" />
<pathelement path="lib/ext/steamworks/steamworks4j.jar" />
<pathelement path="lib/jglob.jar" />
</classpath>
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xlint:-options" />
<!-- <compilerarg value="-Xbarda" /> -->
</javac>
<copy todir="build/classes">
<fileset dir="src" excludes="**/*.java" />
</copy>
<copy todir="build/classes/haven" file="etc/ressrv.crt" />
<copy todir="build/classes/haven" file="etc/authsrv.crt" />
<copy todir="build/classes/haven" file="etc/res-preload" />
<copy todir="build/classes/haven" file="etc/res-bgload" />
<copy todir="build/classes/haven" file="etc/icon.png" />
<copy file="local-boot.properties" tofile="build/classes/haven/boot-props" failonerror="false" quiet="true" />
</target>
<target name="lib-classes" depends="build-env" unless="unpacked-lib">
<mkdir dir="build/classes-lib" />
<unjar src="lib/jglob.jar" dest="build/classes-lib">
<patternset excludes="META-INF/**" />
</unjar>
</target>
<target name="jar" depends="hafen-client, buildinfo, lib-classes">
<jar destfile="build/hafen.jar" update="true">
<fileset dir="build/classes" />
<fileset dir="build/classes-lib" />
<manifest>
<attribute name="Main-Class" value="haven.MainFrame" />
<attribute name="Class-Path" value="jogl-all.jar gluegen-rt.jar lwjgl-fat.jar lwjgl-awt.jar lwjgl-opengl-fat.jar steamworks4j.jar builtin-res.jar hafen-res.jar" />
</manifest>
</jar>
<chmod file="build/hafen.jar" perm="a+x" />
</target>
<target name="res-jar" depends="build-env" unless="has-res-jar">
<get src="${ext-lib-base}/builtin-res.jar" dest="lib/ext/builtin-res.jar"
usetimestamp="true" />
<get src="${ext-lib-base}/hafen-res.jar" dest="lib/ext/hafen-res.jar"
usetimestamp="true" />
<available property="lib-res-jar" file="lib/ext/hafen-res.jar" />
<fail unless="lib-res-jar" message="hafen-res.jar not available" />
<available property="lib-builtin-jar" file="lib/ext/builtin-res.jar" />
<fail unless="lib-builtin-jar" message="builtin-res.jar not available" />
</target>
<target name="jars" depends="build-env, jar, extlib/jogl, extlib/lwjgl-gl, extlib/steamworks">
<copy todir="build" failonerror="false" quiet="true">
<fileset dir="lib">
<include name="builtin-res.jar" />
<include name="hafen-res.jar" />
</fileset>
</copy>
<copy todir="build">
<fileset dir="lib/ext/jogl"><include name="*.jar" /></fileset>
<fileset dir="lib/ext/lwjgl"><include name="*.jar" /></fileset>
<fileset dir="lib/ext/steamworks"><include name="*.jar" /></fileset>
</copy>
<copy file="local-config.properties" tofile="build/haven-config.properties" failonerror="false" quiet="true" />
</target>
<target name="bin" depends="jar, extlib/jogl, extlib/lwjgl-gl, extlib/steamworks, res-jar">
<mkdir dir="bin" />
<copy todir="bin">
<fileset dir="build">
<include name="hafen.jar" />
</fileset>
<fileset dir="lib/ext">
<include name="hafen-res.jar" />
<include name="builtin-res.jar" />
</fileset>
<fileset dir="lib/ext/jogl"><include name="*.jar" /></fileset>
<fileset dir="lib/ext/lwjgl"><include name="*.jar" /></fileset>
<fileset dir="lib/ext/steamworks"><include name="*.jar" /></fileset>
</copy>
<copy file="etc/ansgar-config.properties" tofile="bin/haven-config.properties" />
<chmod file="bin/hafen.jar" perm="a+x" />
</target>
<target name="deftgt" depends="jars, bin" />
<target name="run" depends="bin">
<java jar="bin/hafen.jar" fork="true" />
</target>
<target name="clean">
<delete dir="build" />
<delete dir="lib/ext" />
<delete dir="bin" />
</target>
</project>