/[volute]/trunk/projects/theory/snapdm/build_java.xml
ViewVC logotype

Contents of /trunk/projects/theory/snapdm/build_java.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 360 - (show annotations)
Mon May 5 18:18:10 2008 UTC (12 years, 6 months ago) by bourges.laurent
File MIME type: text/xml
File size: 8802 byte(s)
runtime properties are given in properties/jpa-config.properties (jdbc.url, username, password, database)
persistence.xml is generated from an xml template in res/persistence.xml
1 <!--
2 build_java.xml file : specific targets for java code
3 -->
4 <property name="jalopyConvention" location="${libs}/ant/jalopy-java-laurent.xml" />
5
6 <!-- class paths for base classes -->
7 <path id="project.class.path">
8 <pathelement location="${libs}/commons-logging-1.1.jar" />
9 <pathelement location="${libs}/log4j-1.2.15.jar" />
10 <pathelement location="${libs}/eclipselink.jar" />
11 <pathelement location="${libs}/persistence.jar" />
12 </path>
13
14 <!-- class paths for generated classes -->
15 <path id="infrastructure.class.path">
16 <path refid="project.class.path" />
17 <pathelement location="${dist}/${build.file}" />
18 <pathelement location="${libs}/jdbc/postgresql-8.3-603.jdbc3.jar" />
19 <pathelement location="${libs}/jdbc/sqljdbc-2005-1.2.jar" />
20 </path>
21
22
23 <!-- checks if build is necessary : java source code & libraries -->
24 <uptodate property="build.base.notRequired">
25 <srcfiles dir= "${root}" includes="build.properties"/>
26 <srcfiles dir= "${sources}" includes="**/*"/>
27 <srcfiles dir= "${libs}" includes="**/*.jar"/>
28 <mapper type="merge" to="${dist}/${build.file}"/>
29 </uptodate>
30
31
32 <!-- defines Jalopy task -->
33 <taskdef name="jalopy"
34 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
35 <classpath>
36 <pathelement location="${libs}/ant/jalopy.jar" />
37 <pathelement location="${libs}/ant/jalopy-ant.jar" />
38 <pathelement location="${libs}/log4j-1.2.15.jar"/>
39 </classpath>
40 </taskdef>
41
42
43
44
45 <!-- target makeJava : cleans, compiles java code -->
46 <target name="makeJava" depends="compile">
47 <echo>makeJava : done.</echo>
48 </target>
49
50
51
52
53 <!-- target cleanJava : clean build files -->
54 <target name="cleanJava" depends="init, cleanDist">
55 <echo>cleaning directory : ${build} ...</echo>
56
57 <delete includeemptydirs="false" verbose="true">
58 <fileset dir="${build}" includes="**/*"/>
59 </delete>
60
61 <echo>cleaned directory : ${build} : done.</echo>
62 </target>
63
64
65
66
67 <!-- target cleanDist : clean build files -->
68 <target name="cleanDist" depends="init">
69 <echo>cleaning directory : ${dist} ...</echo>
70
71 <delete includeemptydirs="false" verbose="true">
72 <fileset dir="${dist}" includes="**/*"/>
73 </delete>
74
75 <echo>cleaned directory : ${dist} : done.</echo>
76 </target>
77
78
79
80
81
82 <!-- Compile java files and jar them -->
83 <target name="compile" depends="cleanJava">
84 <echo>compile ${base.title} ...</echo>
85 <echo>compile from : ${sources}</echo>
86 <echo>compile to : ${build.src}</echo>
87
88 <mkdir dir="${build.src}"/>
89
90 <javac sourcepath="" srcdir="${sources}" destdir="${build.src}" listfiles="false"
91 fork="true" verbose="false" encoding="UTF-8"
92 debug="on" deprecation="on" optimize="on" casesensitive="true"
93 source="1.5" target="1.5">
94
95 <classpath refid="project.class.path" />
96
97 <include name="**/*.java"/>
98 </javac>
99
100 <pathconvert pathsep=" " property="jar.classpath">
101 <path refid="project.class.path"/>
102 <map from="${root}/" to=""/>
103 </pathconvert>
104
105 <jar jarfile="${dist}/${build.file}" compress="true">
106 <fileset dir="${build.src}" />
107 <fileset file="${properties}/global.properties" />
108 <fileset file="${properties}/log4j.*" />
109
110 <manifest>
111 <attribute name="Built-By" value="${build.by}"/>
112 <attribute name="Built-Date" value="${build.date}"/>
113
114 <attribute name="Build-Jdk" value="${java.vm.version}"/>
115 <attribute name="Build-Os" value="${os.name} ${os.version} - ${os.arch}"/>
116
117 <attribute name="Class-Path" value="${jar.classpath}"/>
118
119 <section name="Common">
120 <attribute name="Specification-Title" value="${base.title}"/>
121 <attribute name="Specification-Version" value="${version}"/>
122 <attribute name="Specification-Vendor" value="${vendor}"/>
123 <attribute name="Implementation-Title" value="${base.title}"/>
124 <attribute name="Implementation-Version" value="${version} - ${build.date}"/>
125 </section>
126 </manifest>
127
128 </jar>
129
130 <delete dir="${build.src}"/>
131
132 <echo>compile ${base.title} : done.</echo>
133 </target>
134
135
136
137
138 <!-- target makeOutput : compiles generated java code and javadoc -->
139 <target name="makeOutput" depends="makeJava, compileOutput, format, makeJavaDoc">
140 <echo>makeOutput : done.</echo>
141 </target>
142
143
144
145
146 <!-- Compile generated java files -->
147 <target name="compileOutput">
148 <echo>compile ${gen.title} ...</echo>
149 <echo>compile from : ${sources.gen}</echo>
150 <echo>compile to : ${build.gen}</echo>
151
152 <mkdir dir="${build.gen}"/>
153
154 <javac sourcepath="" srcdir="${sources.gen}" destdir="${build.gen}" listfiles="false"
155 fork="true" verbose="false" encoding="UTF-8"
156 debug="on" deprecation="on" optimize="on" casesensitive="true"
157 source="1.5" target="1.5">
158
159 <classpath refid="infrastructure.class.path" />
160
161 <include name="**/*.java"/>
162 </javac>
163
164 <pathconvert pathsep=" " property="jar.gen.classpath">
165 <path refid="infrastructure.class.path"/>
166 <map from="${dist}/" to=""/>
167 </pathconvert>
168
169 <jar jarfile="${sources.gen.dist}/${build.gen.file}" compress="true">
170 <fileset dir="${build.gen}" />
171 <fileset dir="${outputJava}">
172 <include name="META-INF/*.*"/>
173 </fileset>
174
175 <manifest>
176 <attribute name="Built-By" value="${build.by}"/>
177 <attribute name="Built-Date" value="${build.date}"/>
178
179 <attribute name="Build-Jdk" value="${java.vm.version}"/>
180 <attribute name="Build-Os" value="${os.name} ${os.version} - ${os.arch}"/>
181
182 <attribute name="Class-Path" value="${jar.gen.classpath}"/>
183
184 <section name="Common">
185 <attribute name="Specification-Title" value="${gen.title}"/>
186 <attribute name="Specification-Version" value="${version}"/>
187 <attribute name="Specification-Vendor" value="${vendor}"/>
188 <attribute name="Implementation-Title" value="${gen.title}"/>
189 <attribute name="Implementation-Version" value="${version} - ${build.date}"/>
190 </section>
191 </manifest>
192
193 </jar>
194
195 <!-- remove to avoid classes in svn -->
196 <delete dir="${build.gen}"/>
197
198 <echo>compile ${gen.title} : done.</echo>
199 </target>
200
201
202
203
204 <!-- target makeJavaDoc : creates javadoc from source code -->
205 <target name="makeJavaDoc">
206 <echo>making generated Java classes javadoc ...</echo>
207
208 <mkdir dir="${sources.gen.docs}"/>
209
210 <javadoc additionalparam="-notimestamp"
211 destdir="${sources.gen.docs}"
212 access="private"
213 author="true"
214 encoding="UTF-8"
215 use="false"
216 windowtitle="${source} : ${gen.title}" >
217
218 <classpath refid="project.class.path" />
219
220 <fileset dir="${sources}" defaultexcludes="yes" includes="**/*.java" />
221 <fileset dir="${sources.gen}" defaultexcludes="yes" includes="**/*.java" />
222
223 </javadoc>
224
225 <echo>generated Java classes javadoc : done.</echo>
226 </target>
227
228
229
230
231 <!-- target format : formats all generated java sources -->
232 <target name="format">
233 <!--
234 Invokes Jalopy as follows:
235
236 - All formatted files will have unix fileformat (\n)
237 - Load your code convention from the given url
238 - Override the convention to use loglevel "info"
239 - Override the convention to use 2 threads
240 - The import optimization feature will work (if enabled in the active
241 convention), because a classpath reference is specified
242
243 Don't forget to setup an include pattern as Jalopy truly expects
244 valid Java source files as input!
245
246
247 -->
248 <jalopy fileformat="unix"
249 convention="${jalopyConvention}"
250 encoding="UTF-8"
251 failonerror="false"
252 history="NONE"
253 loglevel="warn"
254 threads="1"
255 classpathref="infrastructure.class.path">
256 <fileset dir="${sources.gen}">
257 <include name="**/*.java" />
258 </fileset>
259 </jalopy>
260 </target>
261
262
263
264
265 <!-- target run : launches deployed application on Unix environment (bash used) -->
266 <target name="run">
267 <echo message="running ${gen.title} ..."/>
268
269 <delete file="${build}/root.log" />
270
271 <java classname="org.ivoa.test.Main" dir="${build}" fork="true" failonerror="true">
272 <jvmarg value="-Xms128m"/>
273 <jvmarg value="-Xmx384m"/>
274 <classpath>
275 <pathelement location="${dist}/${build.file}"/>
276 <pathelement location="${sources.gen.dist}/${build.gen.file}"/>
277 <pathelement location="${properties}"/>
278 </classpath>
279 </java>
280
281 <echo message="run ${gen.title} : terminated."/>
282 </target>
283
284
285 <!-- end of build_java.xml -->

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26