-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
155 lines (132 loc) · 5.88 KB
/
Copy pathbuild.xml
File metadata and controls
155 lines (132 loc) · 5.88 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!--
Copyright 2005-2006 Seth Fitzsimmons <seth@mojodna.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Sprout" default="war">
<!-- Java compilation options -->
<property name="compile.debug" value="true" />
<property name="compile.deprecation" value="true" />
<property name="compile.optimize" value="true" />
<!-- Source directories -->
<property name="src.dir" value="src/" />
<property name="src.java" value="${src.dir}/java/" />
<property name="src.web" value="${src.dir}/web/" />
<!-- Doc directory and packages that go in there -->
<property name="doc.dir" value="doc/"/>
<!-- where all the library files are kept, plus what to include/exclude when building -->
<property name="lib.dir" value="${src.dir}/web/WEB-INF/lib/" />
<property name="lib.build" value="lib/" />
<!-- application information -->
<property name="app.name" value="sprout" />
<property name="app.version" value="0.9.1" />
<!-- The base directory for distribution targets -->
<property name="dist.dir" value="dist/" />
<property name="build.dir" value="build" />
<property name="build.target" value="${build.dir}/target" />
<property name="javadoc.packages" value="net.mojodna.sprout.*" />
<!-- The name of the web application archive file to be produced -->
<property name="app.jar" value="${app.name}-${app.version}.jar" />
<property name="app.war" value="${app.name}-${app.version}-example.war" />
<property name="release.zip" value="${app.name}-${app.version}.zip" />
<path id="lib.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="build.classpath">
<fileset dir="${lib.build}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="init">
<echo message="Processing build.target init ${app.name}"/>
<available file="${src.java}" property="src.java.present"/>
<available file="${lib.dir}" property="lib.dir.present"/>
</target>
<target name="clean"
description="Clean build and distribution directories">
<echo message="Processing build.target clean ${app.name}"/>
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="prepare" depends="init, clean"
description="Prepare target directory">
<echo message="Processing app ${app.name}"/>
<mkdir dir="${build.dir}" />
<mkdir dir="${build.target}" />
<mkdir dir="${dist.dir}" />
</target>
<target name="release" depends="clean, jar, war, javadoc"
description="Creates a release">
<echo message="Creating ${app.version} release" />
<zip destfile="${release.zip}"
compress="true">
<zipfileset dir="${src.dir}" prefix="${app.name}-${app.version}/src" />
<zipfileset dir="${doc.dir}" prefix="${app.name}-${app.version}/doc" />
<zipfileset dir="${lib.build}" prefix="${app.name}-${app.version}/lib" />
<zipfileset dir="${dist.dir}" prefix="${app.name}-${app.version}/dist" />
<zipfileset dir="." includes="build.xml" prefix="${app.name}-${app.version}" />
</zip>
</target>
<target name="compile" depends="prepare" description="Compile Java sources">
<echo message="Processing app ${app.name}"/>
<echo message="Source ${src.java}"/>
<echo message="Target ${build.target}"/>
<javac srcdir="${src.java}"
destdir="${build.target}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="lib.classpath"/>
<classpath refid="build.classpath"/>
</javac>
<copy todir="${build.target}">
<fileset dir="${src.java}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="javadoc" depends="init" description="Builds the javadoc for the project.">
<mkdir dir="${doc.dir}/api"/>
<delete includeEmptyDirs="true" >
<fileset dir="${doc.dir}/api"/>
</delete>
<mkdir dir="${doc.dir}/api"/>
<javadoc packagenames="${javadoc.packages}"
sourcepath="${src.java}"
destdir="${doc.dir}/api"
author="true"
version="true"
private="false"
doctitle="${app.name} Version ${app.version}">
<classpath refid="lib.classpath" />
<classpath refid="build.classpath" />
</javadoc>
</target>
<target name="jar" depends="compile"
description="Create jar">
<echo message="Processing jarfile ${app.name}"/>
<jar jarfile="${dist.dir}/${app.jar}"
basedir="${build.target}" >
<exclude name="**/*.html"/>
</jar>
</target>
<target name="war" depends="jar">
<delete file="${dist.dir}/${app.war}"/>
<war destfile="${dist.dir}/${app.war}" webxml="${src.web}/WEB-INF/web.xml">
<lib dir="${lib.dir}" />
<lib dir="${dist.dir}" />
<classes dir="${src.dir}" includes="applicationContext.xml, log4j.properties" />
<webinf dir="${src.web}/WEB-INF/" includes="*.xml" excludes="web.xml"/>
<fileset dir="${src.web}" includes="**/*" excludes="WEB-INF/**" />
</war>
</target>
</project>