forked from software-challenge/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
139 lines (117 loc) · 7.2 KB
/
build.xml
File metadata and controls
139 lines (117 loc) · 7.2 KB
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
<project name="Complete" basedir="." default="main">
<import file="git-build.xml" />
<property name="game_name" value="hase_und_igel_2018" />
<property name="out.dir" value="${basedir}/deploy" />
<property name="build.dir" value="${basedir}/build" />
<property name="sdk.dir" value="${basedir}/software_challenge_sdk" />
<property name="plugins.dir" value="${basedir}/game_plugins" />
<property name="lib.dir" value="${basedir}/software_challenge_sdk/lib" />
<!-- Plugin to compile (i.e. "hase_und_igel", "missippi_queen") -->
<property name="game_plugin" value="${game_name}_plugin" />
<property name="game_player" value="${game_name}_player" />
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${out.dir}" />
<delete dir="game_server/lib"/>
<delete dir="game_players/${game_name}/lib"/>
<delete dir="game_plugins/${game_name}/lib"/>
<delete dir="game_helper_clients/test_client/lib"/>
</target>
<target name="dependencies">
<echo message="Compiling SDK..." />
<ant dir="software_challenge_sdk" target="main" inheritAll="false" />
<echo message="Copy libraries..."/>
<!-- Copy libs to all sub-projects -->
<copy todir="${lib.dir}" file="${build.dir}/software_challenge_sdk/jar/software_challenge_sdk.jar"/>
<copy todir="game_players/${game_name}/lib"><fileset dir="${lib.dir}" /></copy>
<copy todir="game_plugins/${game_name}/lib"><fileset dir="${lib.dir}" /></copy>
<copy todir="game_server/lib"><fileset dir="${lib.dir}" /></copy>
<copy todir="game_helper_clients/test_client/lib"><fileset dir="${lib.dir}" /></copy>
</target>
<target name="runnable">
<echo message="Make server runnable..."/>
<copydir src="${build.dir}/software-challenge-server/jar" dest="${build.dir}/software-challenge-server/runnable"/>
<copy file="${build.dir}/${game_plugin}/jar/${game_name}.jar"
todir="${build.dir}/software-challenge-server/runnable/plugins"/>
<copydir src="${lib.dir}" dest="${build.dir}/software-challenge-server/runnable/lib"/>
<!-- 
 is CR, 
 is LF. Windows needs CRLF, Unix needs LF -->
<echo file="${build.dir}/software-challenge-server/runnable/start.bat"
message="java -Dfile.encoding=UTF-8 -jar software-challenge-server.jar
" />
<echo file="${build.dir}/software-challenge-server/runnable/start.sh"
message="#!/bin/sh
java -Dfile.encoding=UTF-8 -jar software-challenge-server.jar
" />
<chmod file="${build.dir}/software-challenge-server/runnable/start.sh"
perm="ugo+x" />
<echo message="Make test client runnable..."/>
<copydir src="${build.dir}/test_client/jar" dest="${build.dir}/test_client/runnable"/>
<copy file="${build.dir}/software-challenge-server/jar/software-challenge-server.jar" todir="${build.dir}/test_client/runnable" />
<copy file="${build.dir}/${game_player}/jar/${game_player}.jar"
tofile="${build.dir}/test_client/runnable/defaultplayer.jar"/>
<copy file="${build.dir}/${game_plugin}/jar/${game_name}.jar"
todir="${build.dir}/test_client/runnable/plugins"/>
<copydir src="${lib.dir}" dest="${build.dir}/test_client/runnable/lib"/> <!-- test client -->
<copy file="${build.dir}/software-challenge-server/runnable/server.properties" todir="${build.dir}/test_client/runnable/"/>
<echo file="${build.dir}/test_client/runnable/start-tests.bat"
message="java -Dfile.encoding=UTF-8 -jar test_client.jar
" />
<echo file="${build.dir}/test_client/runnable/start-tests.sh"
message="#!/bin/sh
java -Dfile.encoding=UTF-8 -jar test_client.jar $@
"/>
<chmod file="${build.dir}/test_client/runnable/start.sh" perm="ugo+x" />
<echo message="Make Player runnable"/>
<copydir src="${build.dir}/${game_player}/jar" dest="${build.dir}/${game_player}/runnable"/>
<copydir src="${lib.dir}" dest="${build.dir}/${game_player}/runnable/lib"/>
<echo file="${build.dir}/${game_player}/runnable/start.sh"
message="#!/bin/sh
java -Dfile.encoding=UTF-8 -jar ${game_player}.jar
" />
<echo file="${build.dir}/${game_player}/runnable/start.bat"
message="java -Dfile.encoding=UTF-8 -jar ${game_player}.jar
" />
<chmod file="${build.dir}/${game_player}/runnable/start.sh" perm="ugo+x" />
</target>
<target name="build" depends="scmversion,dependencies" description="Build and only build for all projects">
<echo message="Compiling Plugins..." />
<ant dir="game_plugins/${game_name}" target="main" />
<echo message="Compiling Server..." />
<ant dir="game_server" target="main" inheritAll="false" />
<ant dir="game_helper_clients/test_client" target="main"/>
<echo message="Compiling Player..." />
<ant dir="game_players/${game_name}" target="main"/>
</target>
<target name="build-jar" depends="dependencies,build" description="Build and create jars for all projects">
<ant dir="game_plugins/${game_name}" target="build-jar" />
<ant dir="game_players/${game_name}" target="build-jar" />
<ant dir="game_server" target="build-jar"/>
<ant dir="game_helper_clients/test_client" target="build-jar" />
</target>
<target name="deploy" depends="build-jar,runnable,build-doc">
<echo message="Zipping files..." />
<!-- Simple Client -->
<zip destfile="${out.dir}/zipped/simple_client_${game_name}_jar.zip">
<zipfileset dir="${build.dir}/${game_player}/runnable"/>
</zip>
<!-- Simple Client Source -->
<zip destfile="${out.dir}/zipped/simple_client_${game_name}_src.zip">
<zipfileset file="game_players/${game_name}/src" includes="**/*.java, **/logback.xml"/>
<mappedresources>
<fileset file="game_players/${game_name}/build-deploy.xml"/>
<globmapper from="build-deploy.xml" to="build.xml"/>
</mappedresources>
<zipfileset dir="${build.dir}/${game_plugin}/jar" includes="**/*.jar" prefix="lib"/>
<zipfileset dir="game_players/${game_name}" includes="**/*.jar"/>
<zipfileset dir="${build.dir}/${game_plugin}/doc" prefix="doc/simple_client"/>
<zipfileset dir="${build.dir}/software-challenge-server/doc/" prefix="doc/sdk"/>
</zip>
<!-- Software Challenge Server -->
<zip destfile="${out.dir}/zipped/software-challenge-server.zip">
<zipfileset dir="${build.dir}/software-challenge-server/runnable/"/>
<zipfileset file="${build.dir}/test_client/runnable/*.*" excludes="server.properties, software-challenge-server.jar"/>
<zipfileset file="${build.dir}/version"/>
</zip>
</target>
<target name="build-doc" description="Generate Javadoc for all projects">
<ant dir="game_server" target="build-doc"/>
<ant dir="game_helper_clients/test_client" target="build-doc"/>
<ant dir="software_challenge_sdk" target="build-doc"/>
<ant dir="./game_plugins/${game_name}" target="build-doc"/>
<ant dir="./game_players/${game_name}" target="build-doc"/>
</target>
<target name="build-clean" depends="clean,build" description="Build and clean all projects"/>
<target name="build-deploy" depends="deploy" description="Build, clean, generate Javadoc and Zip files for all projects" />
<target name="main" depends="build-deploy" description="Build, clean, generate Javadoc and Zip files for all projects" />
</project>