-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
177 lines (142 loc) · 7.36 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="xal.core">
<import file="../config/config.xml"/>
<description>Builds Open XAL Core</description>
<target name="init">
<property name="srcroot" value="." />
<property name="core.compile.root" value="${build.intermediates.core}/compile" />
<property name="core.intermediates.resources" value="${core.compile.root}" />
<mkdir dir="${build.root}" />
</target>
<!-- Build the core and run the tests. -->
<target name="run-tests" depends="all">
<subant target="run-tests">
<fileset dir="test">
<include name="build.xml" />
</fileset>
</subant>
</target>
<!-- Macro to compile the core XAL classes using the specified compiler flag -->
<macrodef name="compile-flagged">
<attribute name="flag" default="-Xlint:none" />
<sequential>
<mkdir dir="${core.compile.root}" />
<javac debug="true" source="${build.compile.java.source}" target="${build.compile.java.target}" bootclasspath="${xal.bootclasspath}" includeAntRuntime="no" deprecation="true" destdir="${core.compile.root}" srcdir="${srcroot}/${source.code.dir}" includes="**" sourcepath="">
<classpath>
<pathelement location="${build.intermediates.core}/lib.jar" />
</classpath>
<compilerarg value="@{flag}" />
</javac>
<!-- Copy the service's resources into the compile directory -->
<mkdir dir="${core.intermediates.resources}" />
<copy todir="${core.intermediates.resources}" quiet="true" failonerror="false">
<fileset dir="${srcroot}/resources" />
</copy>
<!-- Copy the core's site specific resources into the compile directory -->
<copy todir="${core.intermediates.resources}" quiet="true" failonerror="false" overwrite="true">
<fileset dir="${site.core.root}/resources" />
</copy>
</sequential>
</macrodef>
<!-- Compile the core XAL classes using the lint flag to report all recommended warnings -->
<target name="compile" depends="init, jar-lib" >
<compile-flagged flag="-Xlint" />
</target>
<!-- Compile the core XAL classes using the lint flag to report all recommended warnings -->
<target name="compile-warn-all" depends="init, jar-lib" >
<compile-flagged flag="-Xlint" />
</target>
<!-- Compile the core XAL classes reporting on the mandatory warnings -->
<target name="compile-warn-mandatory" depends="init, jar-lib" >
<compile-flagged />
</target>
<!-- Jar the core resources plus those of any subdirectory -->
<target name="jar-resources" depends="init">
<mkdir dir="${build.intermediates.core}" />
<jar compress="true" jarfile="${build.intermediates.core}/resources.jar" index="true" duplicate="preserve">
<fileset dir="${site.core.root}/resources" erroronmissingdir="false" /> <!-- site resources first since duplicate flag preserves the first version encountered -->
<fileset dir="resources" />
</jar>
<!-- jar resources for any sub directories that support it -->
<subant target="jar-resources">
<fileset dir=".">
<include name="test/build.xml" />
</fileset>
</subant>
</target>
<!-- Join the third party jars into a common external jar file -->
<target name="jar-lib" depends="init">
<mkdir dir="${build.intermediates.core}" />
<jar compress="true" jarfile="${build.intermediates.core}/lib.jar" index="true" duplicate="preserve">
<zipgroupfileset dir="lib">
<patternset>
<include name="*.jar" />
</patternset>
</zipgroupfileset>
</jar>
</target>
<!-- Merge the core compiled classes, core resources.jar and core lib.jar -->
<target name="jar-core" depends="init, compile">
<mkdir dir="${core.compile.root}" />
<mkdir dir="${build.intermediates.shared}" />
<jar compress="true" jarfile="${build.intermediates.shared}/xal-core.jar" index="true" basedir="${core.compile.root}" includes="xal/**/*">
<zipgroupfileset dir="${build.intermediates.core}">
<patternset>
<include name="*.jar" />
</patternset>
</zipgroupfileset>
</jar>
</target>
<!-- merge the external jars and build XAL core -->
<target name="all" depends="jar-lib,jar-core" description="Build everything." >
<echo message="Everything built. " />
</target>
<!-- Javadoc the XAL core and place the documentation under core intermediates -->
<target name="doc" depends="init, jar-core" description="Javadoc XAL core." >
<mkdir dir="${build.intermediates.core}/doc" />
<javadoc destdir="${build.intermediates.core}/doc" packagenames="xal.*" author="false" version="false" maxmemory="512m">
<sourcepath>
<pathelement location="${srcroot}/${source.code.dir}" />
</sourcepath>
<classpath>
<pathelement location="${build.intermediates.shared}/xal-core.jar" />
</classpath>
</javadoc>
</target>
<!-- clean compiled products -->
<target name="clean" depends="init" description="Clean all build products." >
<delete dir="${core.compile.root}" quiet="true" />
<delete dir="${build.intermediates.core}" quiet="true" />
<delete file="${build.intermediates.shared}/xal-core.jar" quiet="true" />
<subant target="clean">
<fileset dir=".">
<include name="test/build.xml" />
</fileset>
</subant>
<echo message="Core cleaned!" />
</target>
<!-- purge core build intermediates -->
<target name="purge-intermediates" description="Purge core build intermediates." >
<delete dir="${build.intermediates.core}" />
<echo message="Purged the core build intermediates directory!" />
</target>
<!-- provide guidance on the various targets -->
<target name="help">
<echo message="Build the XAL core" />
<echo message="Usage: ant [ant options] target1 [target2 | target3 | ... ]" />
<echo message="" />
<echo message=" where target(s) can be:" />
<echo message=" help ....................... Print this message." />
<echo message=" all ........................ Compile the core XAL classes and assemble the jar products." />
<echo message=" clean ...................... Clean compiled classes and intermediate build products" />
<echo message=" compile .................... Compile the core XAL classes reporting all recommended warnings." />
<echo message=" compile-warn-all ........... Compile the core XAL classes reporting all recommended warnings." />
<echo message=" compile-warn-mandatory ..... Compile the core XAL classes reporting only mandated warnings." />
<echo message=" doc ........................ Generate documentation for the core and place in intermediates." />
<echo message=" jar-core ................... Assemble the core XAL classes and resources and libraries into the intermediate shared xal-core.jar" />
<echo message=" jar-lib .................... Assemble the external jar files into a single library, xal-lib.jar" />
<echo message=" jar-resources .............. Assemble the core resources into an intermediate core jar file, resources.jar" />
<echo message=" purge-intermediates ........ Purge the core build intermediates." />
<echo message=" run-tests .................. Build and run the test cases." />
</target>
</project>