-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
160 lines (141 loc) · 5.57 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
157
158
159
160
<project name="jcrawler" basedir="." default="compile">
<!-- Project settings -->
<property name="project.title" value="JCrawler"/>
<property name="project.distname" value="jcrawler"/>
<property name="project.version" value="1.0"/>
<property name="lib" location="./lib"/>
<property name="classes" location="./classes"/>
<property name="src" location="./src"/>
<property name="test" location="./test"/>
<property name="etc" location="./etc"/>
<!-- Path settings -->
<property name="doc.path" value="./doc/api"/>
<property name="doc.src" value="./src/java"/>
<property name="distpath.project" value="./dist"/>
<property name="debug" value="true"/>
<path id="compile.classpath">
<fileset dir="${lib}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>
<path id="run.classpath">
<pathelement location="${classes}"/>
<pathelement location="${etc}"/>
<fileset dir="${lib}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>
<!-- Check timestamp on files -->
<target name="prepare">
<tstamp/>
<mkdir dir="${classes}"/>
<mkdir dir="${distpath.project}"/>
</target>
<!-- Copy any resource or configuration files -->
<target name="resources">
<copy todir="${classes}" includeEmptyDirs="no">
<fileset dir="${src}">
<patternset>
<include name="**/*.conf"/>
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.xsl"/>
</patternset>
</fileset>
</copy>
</target>
<target name="testResources">
<copy todir="${classes}" includeEmptyDirs="no">
<fileset dir="${test}">
<patternset>
<include name="**/*.conf"/>
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.ccf"/>
<include name="**/*.xsl"/>
</patternset>
</fileset>
</copy>
</target>
<!-- Developer compilation of the application -->
<target name="compile" depends="prepare,resources">
<javac srcdir="${src}" destdir="${classes}" deprecation="on" debug="${debug}">
<classpath refid="compile.classpath"/>
</javac>
<copy file="misc/log4j.properties" todir="${classes}"/>
</target>
<target name="testCompile" depends="compile, testResources">
<javac srcdir="${test}" destdir="${classes}" deprecation="on" debug="${debug}">
<classpath refid="compile.classpath"/>
</javac>
</target>
<!-- Remove classes directory for clean build -->
<target name="clean" description="Prepare for clean build">
<delete dir="${classes}"/>
<delete dir="${doc.path}"/>
<delete dir="${distpath.project}"/>
</target>
<!-- Build Javadoc documentation -->
<target name="javadoc" description="Generate JavaDoc API docs">
<delete dir="${doc.path}"/>
<mkdir dir="${doc.path}"/>
<javadoc sourcepath="${src}" destdir="${doc.path}" packagenames="*" author="true" private="true" version="true" windowtitle="${project.title} API Documentation" doctitle="<h1>${project.title} Documentation (Version ${project.version})</h1>">
<classpath refid="compile.classpath"/>
</javadoc>
</target>
<!-- Build entire project -->
<target name="project" depends="clean,prepare,compile,javadoc"/>
<!-- Clean the distribution directories to prevent dist from failing the second time around -->
<target name="cleanDist">
<tstamp/>
<delete dir="${distpath.project}"/>
</target>
<!-- Create binary distribution -->
<target name="dist" description="Create binary distribution" depends="cleanDist, compile">
<mkdir dir="${distpath.project}"/>
<jar jarfile="${distpath.project}/${project.distname}.jar" basedir="${classes}"/>
<copy file="${distpath.project}/${project.distname}.jar" todir="${distpath.project}"/>
<copy file="misc/run.bat" todir="${distpath.project}"/>
<copy file="misc/run.sh" todir="${distpath.project}"/>
<copy file="misc/log4j.properties" todir="${distpath.project}"/>
<copy file="conf/crawlerConfig.xml" todir="${distpath.project}/conf"/>
<copy todir="${distpath.project}/lib" includeEmptyDirs="no">
<fileset dir="${lib}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</copy>
</target>
<!-- Create binary distribution -->
<target name="build" description="Creat Binary Distribution (Alias)" depends="dist" />
<!--
This needs junit.jar to be put under ANT. Useful for integration with JIRA or
some other reporting/monitoring tool
-->
<target name="junit" depends="testCompile">
<junit printsummary="yes" haltonfailure="yes" showoutput="yes" reloading="true">
<classpath refid="run.classpath"/>
<formatter type="xml"/>
<formatter type="plain"/>
<test name="com.jcrawler.test.AllTests" haltonfailure="no" outfile="test_result"/>
</junit>
</target>
<!-- Text-mode Unit-test runner -->
<target name="runtests" depends="testCompile">
<java fork="yes" classname="junit.textui.TestRunner" taskname="junit" failonerror="true">
<arg value="com.jcrawler.test.AllTests"/>
<classpath refid="run.classpath"/>
</java>
</target>
<!-- GUI (Swing) mode Unit-test runner -->
<target name="runtestsgui" depends="testCompile">
<java fork="yes" classname="junit.swingui.TestRunner" taskname="junit" failonerror="true">
<arg value="com.jcrawler.test.AllTests"/>
<classpath refid="run.classpath"/>
</java>
</target>
<!-- Build project and create distribution-->
<target name="all" depends="project,dist"/>
</project>