-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathbuild.xml
164 lines (139 loc) · 6.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
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="lwjgl3-tutorial" default="run" basedir=".">
<presetdef name="javac">
<javac includeantruntime="false"/>
</presetdef>
<!-- Properties -->
<property name="src.dir" value="src"/>
<property name="resources.dir" value="resources"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="dist.lib" value="${dist.dir}/${lib.dir}"/>
<property name="dist.resources" value="${dist.dir}/${resources.dir}"/>
<property name="intro.class" value="silvertiger.tutorial.lwjgl.Introduction"/>
<property name="main.class" value="silvertiger.tutorial.lwjgl.Main"/>
<property name="debug.port" value="5005"/>
<!-- Classpath -->
<path id="lwjgl.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<exclude name="**/*javadoc*"/>
<exclude name="**/*sources*"/>
</fileset>
</path>
<!-- Conditions -->
<condition property="lib.exists">
<available file="${lib.dir}" type="dir"/>
</condition>
<condition property="lwjgl.natives" value="natives-windows">
<os family="Windows"/>
</condition>
<condition property="lwjgl.natives" value="natives-linux">
<os name="Linux"/>
</condition>
<condition property="lwjgl.natives" value="natives-macos">
<os name="Mac OS X"/>
</condition>
<!-- Public Targets -->
<target name="init" depends="-check-lib"
description="This target initializes the compilation.\n
If necessary the libraries will get dowloaded into the folder ${lib.dir} via ivy.">
<mkdir dir="${build.dir}"/>
</target>
<target name="compile" depends="init"
description="This target compiles the sources to the folder ${build.dir}.">
<javac srcdir="${src.dir}" destdir="${build.dir}">
<classpath refid="lwjgl.classpath"/>
</javac>
</target>
<target name="intro" depends="compile"
description="This target runs the introduction.">
<java classname="${intro.class}" fork="true">
<classpath>
<pathelement location="${build.dir}"/>
<path refid="lwjgl.classpath"/>
</classpath>
</java>
</target>
<target name="run" depends="compile"
description="This target runs the application.">
<java classname="${main.class}" fork="true">
<classpath>
<pathelement location="${build.dir}"/>
<path refid="lwjgl.classpath"/>
</classpath>
</java>
</target>
<target name="debug" depends="-compile-debug"
description="This target allows you to debug the application by attaching a debugger on port ${debug.port}.">
<java classname="${main.class}" fork="true">
<classpath>
<pathelement location="${build.dir}"/>
<path refid="lwjgl.classpath"/>
</classpath>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug.port}"/>
</java>
</target>
<target name="jar" depends="compile"
description="This target will create a jar file for distribution into the folder ${dist.dir}.">
<mkdir dir="${dist.dir}"/>
<manifestclasspath property="manifest.classpath" jarfile="${dist.dir}/${ant.project.name}.jar">
<classpath refid="lwjgl.classpath"/>
</manifestclasspath>
<jar basedir="${build.dir}" destfile="${dist.dir}/${ant.project.name}.jar">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${manifest.classpath}"/>
</manifest>
</jar>
<copy todir="${dist.lib}">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<exclude name="**/*javadoc*"/>
<exclude name="**/*sources*"/>
</fileset>
</copy>
<copy todir="${dist.resources}">
<fileset dir="${resources.dir}"/>
</copy>
</target>
<target name="clean"
description="This target will clean the project.\n
The folder ${build.dir} and ${dist.dir} will get deleted.">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="update"
description="This target will download the libraries via ivy.">
<delete dir="${lib.dir}"/>
<antcall target="-retrieve"/>
<ivy:cleancache/>
</target>
<target name="help"
description="This target displays usage information.">
<echo message="For using this ant script you need to have Apache Ivy installed, you can get it here: http://ant.apache.org/ivy/"/>
<echo message="When first running the application the libraries will get downloaded."/>
<echo message="If you want to get a newer or older version of lwjgl simply change the 'lwjgl.version' property and call 'ant update'."/>
<echo message=""/>
<echo message="These are the three main targets:"/>
<echo message="'ant run' will run the application."/>
<echo message="'ant jar' will create a jar for distribution."/>
<echo message="'ant update' will update the libraries."/>
<echo message=""/>
<echo message="For a list of all targets call 'ant -projecthelp'."/>
</target>
<!-- Private Targets -->
<target name="-retrieve">
<ivy:retrieve conf="default,javadoc,sources" pattern="${lib.dir}/[artifact](-[classifier]).[ext]"/>
</target>
<target name="-compile-debug" depends="init">
<javac debug="true" srcdir="${src.dir}" destdir="${build.dir}">
<classpath refid="lwjgl.classpath"/>
</javac>
</target>
<target name="-check-lib" unless="lib.exists">
<antcall target="update"/>
</target>
</project>