-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathZGameBuild.xml
183 lines (167 loc) · 7.56 KB
/
ZGameBuild.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
183
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="GameCode">
<property environment="env"/>
<property name="ECLIPSE_HOME" value="F:/eclipse1.8/eclipse/"/>
<property name="GameServer.location" value="../GameServer"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.8"/>
<property name="source" value="1.8"/>
<property name="lib.dir" value="lib"/>
<property name="src.dir" value="src"/>
<property name="classes.dir" value="bin"/>
<property name="output.dir" value="../Common/lib"/>
<property name="jarname" value="code.jar"/>
<property name="project.name" value="GameCode"/>
<path id="JUnit 4.libraryclasspath">
<pathelement location="${ECLIPSE_HOME}plugins/org.junit_4.11.0.v201303080030/junit.jar"/>
<pathelement location="${ECLIPSE_HOME}plugins/org.hamcrest.core_1.3.0.v201303031735.jar"/>
</path>
<!-- 第三方jar包的路径 -->
<path id="lib-classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<path id="redis.userclasspath">
<pathelement location="../../../lib/jredis-master/Release/jredis-core-all-a.0-SNAPSHOT.jar" />
<pathelement location="../../../lib/jredis-master/Release/jredis-core-api-a.0-SNAPSHOT.jar" />
<pathelement location="../../../lib/jredis-master/Release/jredis-core-bench-a.0-SNAPSHOT.jar"/>
<pathelement location="../../../lib/jredis-master/Release/jredis-core-ri-a.0-SNAPSHOT.jar"/>
</path>
<path id="GameCode.classpath">
<pathelement location="bin"/>
<pathelement location="lib/mina-core-2.0.0-RC1.jar"/>
<pathelement location="lib/slf4j-log4j12-1.5.6.jar"/>
<pathelement location="lib/slf4j-simple-1.5.10.jar"/>
<pathelement location="lib/slf4j-api-1.5.10.jar"/>
<pathelement location="lib/protobuf-java-2.3.0.jar"/>
<pathelement location="lib/mysql-connector-java-5.1.6-bin.jar"/>
<pathelement location="lib/quartz-2.1.7.jar"/>
<pathelement location="lib/joda-time-2.9.1.jar"/>
<pathelement location="lib/bonecp-0.8.0.RELEASE.jar"/>
<pathelement location="lib/HikariCP-3.2.0.jar"/>
<pathelement location="lib/guava-19.0.jar"/>
<pathelement location="lib/log4j.jar"/>
<path refid="JUnit 4.libraryclasspath"/>
<path refid="redis.userclasspath"/>
</path>
<target name="init">
<echo message="create classdir ${classes.dir}"/>
<mkdir dir="${classes.dir}"/>
<echo message="create outputdir ${output.dir}"/>
<mkdir dir="${output.dir}"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="jar" name="build" />
<target name="build-subprojects"/>
<target depends="jar" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="source,lines,vars" destdir="bin" includeAntRuntime="false" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="GameCode.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects">
<ant antfile="build.xml" dir="${GameServer.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${GameServer.location}" inheritAll="false" target="build">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
</target>
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
<target name="Test">
</target>
<!-- 工程目录结构
project
|-bin
|-src
|-lib
|-out
|-build.xml
-->
<!-- 2. 编译 -->
<target name="compile" depends="init">
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" debuglevel="source,lines,vars">
<compilerarg line="-encoding UTF-8"/>
<classpath refid="lib-classpath"/>
</javac>
</target>
<!-- 3. 打包jar文件 -->
<target name="jar" depends="compile">
<copy todir="${output.dir}">
<fileset dir="${lib.dir}"/>
</copy>
<!--Create a property containing all .jar files,
prefix lib/, and seperated with a space-->
<pathconvert property="mf.classpath" pathsep=" ">
<mapper>
<chainedmapper>
<!-- jar包文件只留文件名,去掉目录信息 -->
<flattenmapper/>
<!-- add lib/ prefix -->
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</mapper>
<path refid="lib-classpath"/>
</pathconvert>
<!-- jar文件的输出路径 -->
<jar destfile="${output.dir}/${jarname}" basedir="${classes.dir}">
<!--
<manifest>
<attribute name="Class-Path" value="${mf.classpath}"/>
</manifest>
-->
<!--
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/bonecp-0.8.0.RELEASE.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/guava-19.0.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/log4j.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/joda-time-2.9.1.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/mina-core-2.0.0-RC1.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/mysql-connector-java-5.1.6-bin.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/protobuf-java-2.3.0.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/quartz-2.1.7.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/slf4j-api-1.5.10.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/slf4j-log4j12-1.5.6.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/slf4j-simple-1.5.10.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/jredis-core-all-a.0-SNAPSHOT.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/jredis-core-api-a.0-SNAPSHOT.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/jredis-core-bench-a.0-SNAPSHOT.jar" />
<zipfileset excludes="META-INF/*.SF" src="${lib.dir}/jredis-core-ri-a.0-SNAPSHOT.jar" />
-->
</jar>
</target>
<target name="upload" depends="jar">
<!-- 打包成zip-->
<zip destfile="${output.dir}/${project.name}.zip" basedir="${output.dir}">
<exclude name="*.zip" />
</zip>
<scp port="22" todir="root:[email protected]:/usr/local/XGame" trust="true" verbose="true" file="${output.dir}/${project.name}.zip" />
<!--<sshexec port="16333" host="10.10.3.117" username="root" password="love7road!" trust="true" command="source /etc/profile;cd /gamerver/app/;./antrun.sh stop;cd /game;unzip -o server_${time}.zip;cd /gamerver/app/;./antrun.sh start;jps" />-->
</target>
</project>