-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_game.xml
92 lines (88 loc) · 3.41 KB
/
build_game.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
<?xml version="1.0" encoding="UTF-8"?>
<!--
You should not change this file.
This build file is supposed to be used in all tendiwa modules.
When you need to customize build process for a module, edit build.properties file.
-->
<project name="tendiwa_game">
<property environment="env"/>
<description>
Ant script for generating a game from backend, frontend and modules.
</description>
<target name="game" depends="ontology,_build_core,_build_client">
<jar destfile="game.jar">
<zipgroupfileset dir="." includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="org.tendiwa.core.Tendiwa"/>
</manifest>
</jar>
</target>
<target name="_core_src_available">
<available file="core/build.xml" property="core.available"/>
</target>
<target name="_build_core" depends="_core_src_available" if="core.available">
<ant dir="core" target="jar"/>
</target>
<target name="_client_src_available">
<available file="client/build.xml" property="client.available"/>
</target>
<target name="_build_client" depends="_client_src_available" if="client.available">
<ant dir="client" target="jar"/>
</target>
<target name="clean">
<delete>
<fileset dir="." includes="*.jar"/>
</delete>
</target>
<target name="ontology" depends="_core_src_available">
<antcall target="_build_core"/>
<description>
Transforms xml descriptions of game objects to source code and places them in module's src/
directory.
</description>
<tempfile destdir="${java.io.tmpdir}" prefix="tendiwa" property="tmpdir"/>
<mkdir dir="${tmpdir}"/>
<!--Extract ontologies from jars-->
<unjar dest="${tmpdir}" failonemptyarchive="true">
<fileset dir=".">
<include name="*.jar"/>
</fileset>
<patternset>
<include name="**/ontology/*.xml"/>
</patternset>
</unjar>
<!--Extract ontologies from source code-->
<copy todir="${tmpdir}">
<fileset dir="." includes="**/data/ontology/*.xml"/>
<flattenmapper/>
</copy>
<!--Generate sources-->
<java classname="org.tendiwa.core.Tendiwa" failonerror="true">
<arg value="--ontology"/>
<arg value="${tmpdir}"/>
<classpath>
<pathelement path="tendiwa-backend.jar"/>
<fileset dir="libs" includes="**/*.jar"/>
</classpath>
</java>
<mkdir dir="${tmpdir}/ontology"/>
<mkdir dir="${tmpdir}/ontology/src"/>
<mkdir dir="${tmpdir}/ontology/bin"/>
<!--Compile generated sources -->
<javac
srcdir="${tmpdir}/ontology/src"
destdir="${tmpdir}/ontology/bin"
>
<classpath>
<pathelement path="tendiwa-backend.jar"/>
<fileset dir="libs" includes="**/*.jar"/>
</classpath>
</javac>
<!--Create jar with ontology consisting of compiled generated sources -->
<jar basedir="${tmpdir}/ontology/bin" destfile="tendiwa-ontology.jar">
<fileset dir="${tmpdir}/ontology/bin" includes="*.class"/>
</jar>
<!--<delete dir="${unjar.tmpdir}"/>-->
<echo>Resources source code generated</echo>
</target>
</project>