root/releases/bedework-3.4.1.1a/build/buildjar.xml

Revision 1134 (checked in by douglm, 7 years ago)

Fixes to timezone stuff

Line 
1 <!-- This file builds a single jar file. It just sets defaults for the java
2      compiler then invokes it.
3
4      This is the only place we compile files.
5
6      On entry we require:
7        build.jar.file        Fully specified name of destination jar file.
8        base.name             Defines the name of the source base.
9        base.java.sources     Defines the java source files
10        base.class.patternset Defines the java class files
11        base.resource.files   Defines extra resources to go in the jar
12
13      We will copy all files defined by base.java.patternset to a temporary
14      location and compile out of that into a temporary classes location.
15
16      We do that to avoid a problematic feature of the java compilers, the
17      tendency to recompile any referenced sources found on the source path.
18
19      So, if we have all our sources under the directory "src" and compile a
20      single package in that tree, all referenced classes will be compiled,
21      even if they exist in a jar file on the class path.
22
23      The other side-effect is that we might compile and include classes we
24      didn't realise we were compiling.
25
26      The downside is that we need to be very specific about the classes we
27      compile for a package and we might need to put classes in
28      base.java.sources which we don't want in the final jar file.
29
30      On exit we will have created classes in the directory
31         ${jar.temp.classes}
32      and a jar file
33         ${build.jar.file}
34
35      Authors: Mike Douglass   douglm@rpi.edu
36 -->
37
38 <project name="buildjar" default="build" >
39   <target name="init">
40     <!--  =================== Compilation Control Options ===============
41       These properties control option settings on the Javac compiler when it
42       is invoked using the <javac> task.
43
44       compile.debug        Should compilation include the debug option?
45       compile.deprecation  Should compilation include the deprecation option?
46       compile.optimize     Should compilation include the optimize option?
47
48       Below are the defaults. They may already be set in the build properties.
49     -->
50
51     <property name="compile.debug" value="true"/>
52     <property name="compile.deprecation" value="false"/>
53     <property name="compile.optimize" value="true"/>
54     <property name="compile.verbose" value="false"/>
55     <property name="compile.listfiles" value="false"/>
56
57     <property name="jar.dest.dir" location="${dist.home}" />
58
59     <property name="jar.temp.sources"
60              location="${jar.dest.dir}/source" />
61     <property name="jar.temp.classes"
62              location="${jar.dest.dir}/classes" />
63   </target>
64
65   <target name="build" depends="init"
66           description="Compile Java sources">
67     <!-- ==============================================================
68           See if the jar is up to date. We recompile if any of the
69           source files or metainf files are newer. We also recompile if
70           any jars on the package classpath are newer.
71          ============================================================== -->
72
73     <uptodate property="build.jar.uptodate"
74               targetfile="${build.jar.file}" >
75       <srcfiles refid="base.java.sources" />
76       <srcfiles refid="base.resource.files"/>
77       <!-- change this to a fileset
78       <srcfiles refid="compile.classpath" />
79       -->
80     </uptodate>
81
82     <if>
83       <isset property="build.jar.uptodate"/>
84       <then>
85         <echo message="**** ${build.jar.file} is up to date" />
86       </then>
87     </if>
88
89     <if>
90       <not>
91         <isset property="build.jar.uptodate"/>
92       </not>
93       <then>
94         <echo message="**** ${build.jar.file} needs rebuilding" />
95
96         <!-- Delete jar file -->
97         <delete file="${build.jar.file}"/>
98
99         <dirname property="build.jar.dir" file="${build.jar.file}"/>
100
101         <mkdir dir="${build.jar.dir}" />
102
103         <!-- ==========================================================
104                           Build the classes
105              ========================================================== -->
106
107         <!-- First copy the sources we are going to compile into a temp
108              directory. -->
109         <mkdir dir="${jar.temp.sources}" />
110         <copy toDir="${jar.temp.sources}">
111           <fileset refid="base.java.sources" />
112           <fileset refid="base.resource.files"/>
113         </copy>
114
115         <mkdir dir="${jar.temp.classes}"/>
116         <echo message="About to build jar ${build.jar.file}"/>
117         <property name="cp" refid="compile.classpath" />
118         <echo message="***************cp: ${cp}"/>
119
120         <javac srcdir="${jar.temp.sources}"
121                destdir="${jar.temp.classes}"
122                debug="${compile.debug}"
123                verbose="${compile.verbose}"
124                listfiles="${compile.listfiles}"
125                deprecation="${compile.deprecation}"
126                optimize="${compile.optimize}">
127           <classpath refid="compile.classpath"/>
128           <include name="**/*.java"/>
129           <compilerarg value="-nowarn" compiler="jikes" />
130         </javac>
131
132         <!-- ==========================================================
133                           Build jar file
134              ========================================================== -->
135
136         <jar jarfile="${build.jar.file}">
137           <fileset dir="${jar.temp.classes}">
138             <patternset refid="base.class.patternset"/>
139           </fileset>
140           <fileset refid="base.resource.files"/>
141         </jar>
142
143         <!-- ==========================================================
144                           Clean up
145              ========================================================== -->
146
147         <delete dir="${jar.temp.sources}" />
148         <delete dir="${jar.temp.classes}"/>
149       </then>
150     </if>
151   </target>
152 </project>
Note: See TracBrowser for help on using the browser.