Update README.md
[sw/motorsim] / build.xml
1 <?xml version="1.0"?>
2
3 <project name="MotorSim" basedir=".">
4         <property name="name" value="MotorSim" />
5
6         <property name="findbugs.root" value="C:\src\Libs\findbugs-1.3.9" />
7
8         <property name="core.src.dir" value="src" />
9         <property name="test.src.dir" value="test" />
10         <property name="gui.src.dir" value="test" />
11         
12         <property name="core.build.dir" value=".classes" />
13         <property name="test.build.dir" value=".tests" />
14         <property name="gui.build.dir" value=".tests" />
15         
16         <property name="dist.dir" value="dist" />
17         <property name="temp.dir" value=".temp" />
18
19         <path id="findbugs.classpath">
20                 <fileset dir="${findbugs.root}/lib">
21                         <include name="*.jar" />
22                 </fileset>
23         </path>
24
25         <path id="core.classpath">
26                 <fileset dir="lib">
27                         <include name="*.jar" />
28                 </fileset>
29         </path>
30         
31         <path id="gui.classpath">
32                 <fileset dir="lib">
33                         <include name="*.jar" />
34                 </fileset>
35                 <fileset dir="dist">
36                         <include name="*.jar" />
37                 </fileset>
38         </path>
39
40         <path id="test.classpath">
41                 <path refid="core.classpath" />
42                 <path refid="gui.classpath" />
43                 <fileset dir="${dist.dir}">
44                         <include name="*.jar" />
45                 </fileset>
46         </path>
47
48         <target name="clean" description="Clean output dirs (build, docs, dist)">
49                 <delete dir="${core.build.dir}" />
50                 <delete dir="${gui.build.dir}" />
51                 <delete dir="${test.build.dir}" />
52                 <delete dir="${dist.dir}" />
53                 <delete dir="${temp.dir}" />
54                 <delete file="${name}-findbugs.xml" />
55                 <delete file="TEST-UnitTests.xml" />
56         </target>
57
58         <target name="core.build" description="Compile main source tree java files into class files.">
59                 <mkdir dir="${core.build.dir}" />
60                 <javac destdir="${core.build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
61                         <src path="${core.src.dir}" />
62                         <classpath refid="core.classpath" />
63                 </javac>
64         </target>
65         
66         <target name="gui.build" depends='core.jarfile' description="Compile main source tree java files into class files.">
67                 <mkdir dir="${gui.build.dir}" />
68                 <javac destdir="${gui.build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
69                         <src path="${gui.src.dir}" />
70                         <classpath refid="gui.classpath" />
71                 </javac>
72         </target>
73                 
74         
75         <target name="core.jarfile" depends="core.build" description="Build the jar file">
76                 <mkdir dir="${dist.dir}" />
77                 <jar jarfile="${dist.dir}/${name}-API.jar" compress="true" basedir="${cure.build.dir}" />
78         </target>
79         
80         <target name="gui.jarfile" depends="gui.build" description="Build the jar file">
81                 <mkdir dir="${dist.dir}" />
82                 <jar jarfile="${dist.dir}/${name}-API.jar" compress="true" basedir="${cure.build.dir}" />
83         </target>
84
85 <!--
86
87         <taskdef resource="net/sf/antcontrib/antcontrib.properties">
88                 <classpath>
89                         <fileset dir="ant/">
90                                 <include name="*.jar" />
91                         </fileset>
92                 </classpath>
93         </taskdef>
94
95         <target name="dist" depends="Fat-Jar">
96                 <delete quiet='true'>
97                         <fileset dir="${dist.dir}/installers" includes="*"/>
98                 </delete>
99                 <mkdir dir="${dist.dir}" />
100                 <mkdir dir="${dist.dir}/installers" />
101
102
103                 <ant dir="RPM" target="dist" inheritAll='false' />
104                 <ant target="One-Jar"/>
105                 <trycatch>
106                         <try>
107                                 <ant dir="MSI" target="dist" inheritAll='false' />
108                         </try>
109                         <catch><echo>Skipping MSI</echo></catch>
110                 </trycatch>
111         </target>
112
113
114
115
116         <taskdef name="one-jar" classname="com.simontuffs.onejar.ant.OneJarTask">
117                 <classpath>
118                         <fileset dir="ant">
119                                 <include name="*.jar" />
120                         </fileset>
121                 </classpath>
122         </taskdef>
123         <target name='One-Jar' depends='jarfile-main, jarfile-api'>\r
124                 <property file=".classes/MarProbe.version.properties" />
125                 <property name="destfilename" value="${name}-${version}.jar"/>
126                 <one-jar destfile="${dist.dir}/installers/${destfilename}" manifest="manifest.mf">
127                         <main>
128                                 <fileset dir="${src.dir}">
129                                         <include name="log4j.properties" />
130                                         <include name="martello.pem" />
131                                         <include name="MartelloKey.der" />
132                                 </fileset>
133                         </main>
134                         <lib>
135                                 <fileset dir="${dist.dir}">
136                                         <include name="${name}.jar" />
137                                         <include name="${name}-API.jar" />
138                                 </fileset>
139                                 <fileset dir="lib/build">
140                                         <include name="*.jar" />
141                                 </fileset>
142                                 <fileset dir="lib/runtime">
143                                         <include name="*.jar" />
144                                 </fileset>
145                         </lib>
146                         <fileset dir="${build.dir}">
147                                 <include name="com/martellotech/Diagnostic*.class" />
148                         </fileset>
149                 </one-jar>
150         </target>
151
152
153         <target name="Fat-Jar" depends="jarfile-main, jarfile-api">
154                 <delete dir="${temp.dir}" quiet="true" />
155                 <unjar dest="${temp.dir}">
156                         <fileset dir="lib/build">
157                                 <include name="**/*.jar" />
158                         </fileset>
159                         <fileset dir="lib/runtime">
160                                 <include name="**/*.jar" />
161                         </fileset>
162                 </unjar>
163                 <unjar dest="${temp.dir}">
164                         <fileset dir="lib/build">
165                                 <include name="**/Martello-*.jar" />
166                         </fileset>
167                         <fileset dir="lib/runtime">
168                                 <include name="**/Martello-*.jar" />
169                         </fileset>
170                 </unjar>
171                 <unjar dest="${temp.dir}">
172                         <fileset dir="${dist.dir}">
173                                         <include name="${name}.jar" />
174                                         <include name="${name}-API.jar" />
175                         </fileset>
176                 </unjar>
177                 <delete dir='${temp.dir}/META-INF'/>
178                 <jar jarfile="${dist.dir}/${name}-Fat.jar" basedir="${temp.dir}" includes="**/*.*" update="false" compress="true">
179                         <fileset dir="${src.dir}">
180                                 <include name="log4j.properties" />
181                                 <include name="martello.pem" />
182                                 <include name="MartelloKey.der" />
183                         </fileset>
184                 </jar>
185         </target>
186         
187         
188
189         <target name="findbugs" depends="jarfile-main, jarfile-api">
190
191                 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.classpath" />
192
193                 <findbugs home="${findbugs.root}" output="xml" outputFile="${name}-findbugs.xml">
194                         <auxClasspath refid="test-classpath" />
195                         <sourcePath path="${src.dir}" />
196                         <class location="${dist.dir}/${name}.jar" />
197                 </findbugs>
198         </target>
199
200
201         <target name="test" depends="dist">
202                 <mkdir dir="${test.build.dir}" />
203                 <javac destdir="${test.build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
204                         <src path="${test.src.dir}" />
205                         <classpath refid="test-classpath" />
206                 </javac>
207                 <copy todir="${test.build.dir}">
208                         <fileset dir="${test.src.dir}">
209                                 <include name="**/*.xml" />
210                                 <include name="**/*.properties" />
211                         </fileset>
212                 </copy>
213                 <mkdir dir="${dist.dir}" />
214                 <jar jarfile="${dist.dir}/${name}-tests.jar" compress="true" basedir="${test.build.dir}" />
215                 <junit printsummary="yes" fork="yes" haltonfailure="no" haltonerror="false" showoutput="yes">
216
217
218                         <classpath refid="test-classpath" />
219
220
221                         <formatter type="xml" />
222
223
224                         <test name="UnitTests" />
225                 </junit>
226
227         </target>       -->
228
229 </project>