-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
124 lines (105 loc) · 3.62 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
@author yongboy
@date 2012-06-11
@desc
two tasks :
jar : 单纯打包成socketio-netty-1.0.jar文件,不包括测试代码
deploy : 为测试代码打包部署,测试使用
编译后结果,见 jar 目录
-->
<project name="export the jar" default="jar" basedir=".">
<property name="target" location="jar" />
<property name="java.target.version" value="1.6" />
<property name="jar.name" value="socketio-netty-1.0" />
<property name="build" location="build" />
<property name="lib" location="lib/" />
<property name="excludes"
value="**/.svn/*,**/.nbattrs,**/.project,**/.classpath" />
<target name="clean" description="Delete existing output directories">
<delete dir="${target}" />
<delete dir="${build}" />
<delete file="${jar.name}.jar" />
<mkdir dir="${target}" />
</target>
<target name="compile" depends="clean" description="Compile the souce">
<mkdir dir="${build}" />
<javac srcdir="src" destdir="${build}" debug="on"
optimize="on" deprecation="on" source="1.6" target="${java.target.version}">
<classpath>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
</target>
<path id="classpath">
<fileset dir="${lib}" includes="*.jar"/>
</path>
<target name="jar" depends="compile">
<echo message="正在生成jar包..." />
<jar jarfile="${target}/${jar.name}.jar" basedir="${build}" />
<zip destfile="${target}/${jar.name}.jar"
basedir="source/"
includes="**/socketio.properties"
update = "true"
/>
</target>
<!-- 部署测试使用 -->
<path id="test-classpath">
<fileset dir="${target}/lib" includes="*.jar"/>
</path>
<target name="test-compile" description="Compile the test souce">
<delete dir="${build}" />
<mkdir dir="${build}" />
<javac srcdir="test" destdir="${build}" debug="on"
optimize="on" deprecation="on" source="1.6" target="${java.target.version}">
<classpath>
<fileset dir="${target}/lib">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="test-copyjar">
<echo message="拷贝测试代码依赖jar文件" />
<copy todir="${target}/lib">
<fileset dir="${target}">
<include name="${jar.name}.jar" />
</fileset>
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</copy>
<delete file="${target}/${jar.name}.jar" />
</target>
<target name="deploy" depends="compile,jar,test-copyjar,test-compile" description="deploy the example">
<pathconvert property="mf.classpath" pathsep=" ">
<path refid="test-classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*" to="lib/*" />
</chainedmapper>
</mapper>
</pathconvert>
<echo message="拷贝依赖资源文件和脚本等" />
<copy todir="${target}/">
<fileset dir="source/">
<exclude name="**/socketio.properties" />
</fileset>
<fileset dir="script/">
<include name="**/*.bat" />
<include name="**/*.sh" />
</fileset>
</copy>
<echo message="正在生成测试部署jar包..." />
<jar jarfile="${target}/server.jar" basedir="${build}">
<manifest>
<attribute name="Class-Path" value=". ${mf.classpath} "/>
<!-- 这里定义运行接口,main方法所在类 -->
<attribute name="Main-class" value="com.yongboy.socketio.test.MultiServerDemo" />
</manifest>
</jar>
</target>
</project>