forked from hyperbox/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
executable file
·143 lines (115 loc) · 6.21 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
<!--
*
* Hyperbox - Virtual Infrastructure Manager
* Copyright (C) 2013-2015 Maxime Dor
*
* http://kamax.io/hbox/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
-->
<project name="Hyperbox API" default="build">
<macrodef name="assertDirAvailable">
<attribute name="dir" />
<sequential>
<fail message="@{dir} could not be found">
<condition>
<not>
<available file="@{dir}" type="dir" />
</not>
</condition>
</fail>
</sequential>
</macrodef>
<property file="build.properties" />
<property name="hbox.api.base.dir" location="." />
<property file="${hbox.api.base.dir}/global.properties" />
<property name="hbox.api.src.dir" location="${hbox.api.base.dir}/${src.dirname}" />
<condition property="hbox.api.out.dir" value="${hbox.out.dir}">
<isset property="hbox.out.dir" />
</condition>
<property name="hbox.api.out.dir" location="${hbox.api.base.dir}/${out.dirname}" />
<property name="hbox.api.core.dir" location="${hbox.api.src.dir}/${core.name}" />
<property name="hbox.api.tools.dir" location="${hbox.api.src.dir}/${tools.name}" />
<property name="hbox.api.kryo.dir" location="${hbox.api.src.dir}/network/${kryonet.name}" />
<property name="hbox.api.jar.filename" value="${hbox.name}-${api.name}.jar" />
<property name="hbox.api.out.build.dir" location="${hbox.api.out.dir}/${build.dirname}" />
<property name="hbox.api.out.build.class.dir" location="${hbox.api.out.build.dir}/${class.dirname}" />
<property name="hbox.api.out.build.jar.dir" location="${hbox.api.out.build.dir}/${jar.dirname}" />
<property name="hbox.api.out.build.jar.file" location="${hbox.api.out.build.jar.dir}/${hbox.api.jar.filename}" />
<property name="hbox.api.tools.src.dir" location="${hbox.api.tools.dir}/${src.dirname}" />
<property name="hbox.api.tools.class.dir" location="${hbox.api.out.build.class.dir}/${core.name}-${tools.name}" />
<property name="hbox.api.core.src.dir" location="${hbox.api.core.dir}/${src.dirname}" />
<property name="hbox.api.core.lib.dir" location="${hbox.api.core.dir}/${lib.dirname}" />
<property name="hbox.api.core.class.dir" location="${hbox.api.out.build.class.dir}/${core.name}" />
<property name="hbox.api.kryo.src.dir" location="${hbox.api.kryo.dir}/${src.dirname}" />
<property name="hbox.api.kryo.lib.dir" location="${hbox.api.kryo.dir}/${lib.dirname}" />
<property name="hbox.api.kryo.class.dir" location="${hbox.api.out.build.class.dir}/${core.name}-${kryonet.name}" />
<property name="hbox.api.media.dir" location="${hbox.api.base.dir}/${media.dirname}" />
<property name="hbox.api.media.img.dir" location="${hbox.api.media.dir}/${image.dirname}" />
<condition property="ifWin">
<os family="windows" />
</condition>
<condition property="ifLinux">
<os family="unix" />
</condition>
<target name="clean">
<delete dir="${hbox.api.out.dir}"/>
</target>
<target name="configure.win" if="ifWin">
<property name="os.family" value="win"/>
</target>
<target name="configure.linux" if="ifLinux">
<property name="os.family" value="linux"/>
</target>
<target name="configure" depends="configure.win, configure.linux">
<property name="platform" value="${os.family}.${os.arch}" />
<assertDirAvailable dir="${hbox.api.tools.src.dir}" />
<assertDirAvailable dir="${hbox.api.core.src.dir}" />
<assertDirAvailable dir="${hbox.api.kryo.src.dir}" />
<property file="${hbox.api.base.dir}/${tools.dirname}/${platform}/build.properties" />
<property file="${hbox.api.base.dir}/${tools.dirname}/${os.family}/build.properties" />
<exec executable="git" dir="${hbox.api.base.dir}" outputProperty="hbox.api.version">
<arg line="describe --always"/>
</exec>
<echo message="Hyperbox API Version: ${hbox.api.version}" />
</target>
<path id="hbox.api.classpath">
<pathelement location="${hbox.api.kryo.class.dir}"/>
<pathelement location="${hbox.api.core.class.dir}"/>
<pathelement location="${hbox.api.tools.class.dir}"/>
<fileset dir="${hbox.api.kryo.lib.dir}" includes="**/*.jar"/>
<fileset dir="${hbox.api.core.lib.dir}" includes="**/*.jar"/>
</path>
<target name="compile" depends="configure">
<mkdir dir="${hbox.api.tools.class.dir}" />
<mkdir dir="${hbox.api.core.class.dir}" />
<mkdir dir="${hbox.api.kryo.class.dir}" />
<javac source="1.6" target="1.6" debug="on" includeantruntime="false" srcdir="${hbox.api.tools.src.dir}" destdir="${hbox.api.tools.class.dir}" classpathref="hbox.api.classpath" />
<javac source="1.6" target="1.6" debug="on" includeantruntime="false" srcdir="${hbox.api.core.src.dir}" destdir="${hbox.api.core.class.dir}" classpathref="hbox.api.classpath" />
<javac source="1.6" target="1.6" debug="on" includeantruntime="false" srcdir="${hbox.api.kryo.src.dir}" destdir="${hbox.api.kryo.class.dir}" classpathref="hbox.api.classpath" />
<echo file="${hbox.api.core.class.dir}/api.build.properties" append="false">version=${hbox.api.version}${line.separator}</echo>
<echo file="${hbox.api.core.class.dir}/api.build.properties" append="true">protocol=${hbox.api.version}${line.separator}</echo>
</target>
<target name="build" depends="compile">
<mkdir dir="${hbox.api.out.build.jar.dir}" />
<jar destfile="${hbox.api.out.build.jar.file}">
<fileset dir="${hbox.api.tools.class.dir}" />
<fileset dir="${hbox.api.core.class.dir}" />
<fileset dir="${hbox.api.kryo.class.dir}" />
</jar>
</target>
<extension-point name="deploy" depends="compile" />
<extension-point name="dist" depends="compile" />
</project>