-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
156 lines (149 loc) · 5.78 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
144
145
146
147
148
149
150
151
152
153
154
155
156
<project name="ConfigReader" default="Default" basedir="./">
<!--ANT 1.7 is required -->
<property environment="env" />
<property name="src.main.dir" value="${basedir}/src" />
<property name="src.test.dir" value="${basedir}/test" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="lib.test.dir" value="${basedir}/libtest" />
<property name="res.dir" value="${basedir}/res" />
<property name="bin.dir" value="${basedir}/antbin" />
<property name="bin.main" value="${bin.dir}/main" />
<property name="bin.test" value="${bin.dir}/test" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="dist.docs.dir" value="${dist.dir}/docs" />
<property name="dist.release.dir" value="${dist.dir}/release" />
<!-- 初始化classpath -->
<zipfileset id="jar_lib" dir="${lib.dir}">
<include name="codeutil_1.0.jar" />
<include name="org.json-bin-20160810.jar" />
<include name="curvesapi-1.04.jar" />
<include name="xmlbeans-2.6.0.jar" />
<include name="commons-codec-1.10.jar" />
<include name="commons-collections4-4.1.jar" />
<include name="commons-logging-1.2.jar" />
<include name="log4j-1.2.17.jar" />
<include name="poi-3.16.jar" />
<include name="poi-excelant-3.16.jar" />
<include name="poi-ooxml-3.16.jar" />
<include name="poi-ooxml-schemas-3.16.jar" />
<include name="poi-scratchpad-3.16.jar" />
</zipfileset>
<zipfileset id="jar_test_lib" dir="${lib.test.dir}">
<include name="junit.jar" />
<include name="org.hamcrest.core_1.3.0.v201303031735.jar" />
</zipfileset>
<path id="id_classpath">
<fileset refid="jar_lib" />
<fileset refid="jar_test_lib" />
</path>
<!-- 默认构建入口 -->
<target name="Default" description="默认构建入口">
<antcall target="Init" />
<antcall target="Compile" />
<antcall target="GenJar" />
<antcall target="InitReleaseFolder" />
<antcall target="ZipRelease" />
<antcall target="GenJavadoc" />
<!--
-->
</target>
<!-- 初始化环境-->
<target name="Init" description="初始化环境">
<antcall target="Clean" />
<antcall target="Initdir" />
</target>
<target name="Clean">
<delete dir="${bin.dir}" />
<delete dir="${dist.docs.dir}" />
<delete dir="${dist.release.dir}" />
</target>
<target name="Initdir">
<mkdir dir="${bin.dir}" />
<mkdir dir="${dist.docs.dir}" />
<mkdir dir="${dist.release.dir}" />
</target>
<!-- 编译文件-->
<target name="Compile" description="编译文件">
<antcall target="CompileMain" />
<antcall target="CompileTest" />
</target>
<target name="CompileMain">
<delete dir="${bin.main}" />
<mkdir dir="${bin.main}" />
<javac srcdir="${src.main.dir}" destdir="${bin.main}" encoding="UTF-8" debug="true" includeantruntime="false" source="1.8" target="1.8">
<classpath refid="id_classpath" />
</javac>
</target>
<target name="CompileTest">
<delete dir="${bin.test}" />
<mkdir dir="${bin.test}" />
<javac srcdir="${src.test.dir}" destdir="${bin.test}" encoding="UTF-8" debug="true" includeantruntime="false" source="1.8" target="1.8">
<classpath location="${bin.main}" />
<classpath refid="id_classpath" />
</javac>
</target>
<!-- 打包成可执行文件jar -->
<target name="GenJar" description="打包成可执行文件jar">
<tstamp />
<property name="jarName" value="ConfigReader.jar" />
<property name="version" value="${DSTAMP}" />
<!--
<path id="mf_classpath">
<fileset refid="jar_lib" />
</path>
<pathconvert property="mf.classpath" pathsep=" ">
<path refid="mf_classpath"></path>
</pathconvert>
-->
<jar destfile="${dist.release.dir}/${jarName}" update="false">
<manifest id="">
<attribute name="Project-Version" value="${version}" />
<attribute name="Manifest-Version" value="1.0" />
<attribute name="Class-Path" value=". lib/codeutil_1.0.jar lib/org.json-bin-20160810.jar lib/curvesapi-1.04.jar lib/xmlbeans-2.6.0.jar lib/commons-codec-1.10.jar lib/commons-collections4-4.1.jar lib/commons-logging-1.2.jar lib/log4j-1.2.17.jar lib/poi-3.16.jar lib/poi-excelant-3.16.jar lib/poi-ooxml-3.16.jar lib/poi-ooxml-schemas-3.16.jar lib/poi-scratchpad-3.16.jar" />
<attribute name="Main-Class" value="cfg.ConfigReaderMain" />
<!-- JarInJar打包配置
<attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader" />
<attribute name="Rsrc-Class-Path" value="./ poi-3.16.jar log4j-1.2.17.jar poi-ooxml-3.16.jar poi-ooxml-schemas-3.16.jar org.json-bin-20160810.jar codeutil_1.0.jar" />
<attribute name="Rsrc-Main-Class" value="cfg.ConfigReaderMain" />
-->
</manifest>
<fileset dir="${bin.main}" />
<!--
<zipfileset src="${lib.dir}/jar-in-jar-loader.zip"/>
<zipfileset refid="jar_lib" />
-->
</jar>
</target>
<!-- 初始化Release目录结构及文件 -->
<target name="InitReleaseFolder" description="初始化Release目录结构及文件">
<!-- res目录 -->
<copy todir="${dist.release.dir}">
<fileset dir="${res.dir}">
<include name="*" />
<include name="langs/**" />
<include name="template/**" />
<include name="proxy/**" />
<include name="source/**" />
</fileset>
</copy>
<!-- lib目录 -->
<copy todir="${dist.release.dir}/lib">
<fileset dir="${lib.dir}">
<exclude name="libs" />
<exclude name="jar-in-jar-loader.zip" />
</fileset>
</copy>
</target>
<!-- 打包release.zip -->
<target name="ZipRelease" description="打包release.zip">
<zip destfile="${dist.dir}/release.zip" basedir="${dist.release.dir}" includes="**">
</zip>
</target>
<!-- 生成API -->
<target name="GenJavadoc" description="生成API">
<javadoc sourcepath="${src.main.dir}" destdir="${dist.docs.dir}" author="true" version="true" use="true" charset="UTF-8" encoding="UTF-8" docencoding="UTF-8">
<classpath refid="id_classpath" />
<package name="cfg.*" />
</javadoc>
</target>
</project>