source: tmcsimulator/trunk/IDE_metadata/NetBeans/TMCSim/build.xml @ 451

Revision 451, 12.5 KB checked in by jdalbey, 7 years ago (diff)

Enhance build.xml to write revision number for python programs.

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- You may freely edit this file. See commented blocks below for -->
3<!-- some examples of how to customize the build. -->
4<!-- (If you delete it and reopen the project it will be recreated.) -->
5<!-- By default, only the Clean and Build commands use this build script. -->
6<!-- Commands such as Run, Debug, and Test only use this build script if -->
7<!-- the Compile on Save feature is turned off for the project. -->
8<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
9<!-- in the project's Project Properties dialog box.-->
10<project name="TMCSim" default="default" basedir=".">
11    <description>Builds, tests, and runs the project TMCSim.</description>
12    <import file="nbproject/build-impl.xml"/>
13    <property name="workdir" value="../../.."/>
14    <property name="config.dir" value="../../../config"/>
15<!--        SYSTEM TEST SECTION      -->
16    <target description="CAD Server" name="cadserver">
17    <antcall target="run-single">
18       <param name="javac.includes" value="tmcsim/cadsimulator/CADServer.java"/>
19       <param name="run.class" value="tmcsim/cadsimulator/CADServer"/>
20    </antcall>
21    </target>
22    <target description="Visible System Test of CADSimulator"  name="VisibleSystemTest">
23    <antcall target="test-single">
24       <param name="javac.includes" value="tmcsim/cadsimulator/VisibleSystemTest.java"/>
25       <param name="test.includes" value="tmcsim/cadsimulator/VisibleSystemTest.java"/>
26    </antcall>
27    </target>
28    <target description="CAD Server - console" name="cadconsole">
29        <java jar="deploy/CADserver.jar"
30           fork="true">
31         <classpath>
32           <pathelement location="deploy/CADserver.jar"/>
33         </classpath>
34       </java>
35    </target>
36    <target description="CAD Server - GUI" name="cadgui">
37        <java jar="deploy/CADserver.jar"
38           fork="true"><jvmarg value="-version"/>
39         <classpath>
40           <pathelement location="deploy/CADserver.jar"/>
41         </classpath>
42       </java>
43    </target>
44    <target description="Run Paramics Communicator" name="pcomm">
45    <antcall target="run-single">
46       <param name="javac.includes" value="tmcsim/paramicscommunicator/PComm.java"/>
47       <param name="run.class" value="tmcsim/paramicscommunicator/PComm"/>
48    </antcall>
49    </target>
50    <target description="Run Simulation Manager" name="simmgr">
51    <antcall target="run-single">
52       <param name="javac.includes" value="tmcsim/simulationmanager/SimulationManager.java"/>
53       <param name="run.class" value="tmcsim/simulationmanager/SimulationManager"/>
54    </antcall>
55    </target>
56    <target description="Emulate Paramics Modeler" name="emulate">
57        <echo file="${workdir}/paramics_status.xml" append="false">
58            &lt;Paramics&gt; &lt;Network_Status&gt;WARMING&lt;/Network_Status&gt; &lt;Network_ID&gt;1&lt;/Network_ID&gt; &lt;/Paramics&gt;
59        </echo>
60        <sleep seconds="5"/>
61        <echo file="${workdir}/paramics_status.xml" append="false">
62            &lt;Paramics&gt; &lt;Network_Status&gt;LOADED&lt;/Network_Status&gt; &lt;Network_ID&gt;1&lt;/Network_ID&gt; &lt;/Paramics&gt;
63        </echo>
64    </target>
65
66<!--        STORE SUBVERSION BUILD STRING      -->
67<target name="-post-init" description="Sets the buildversion for the current build">
68    <exec outputproperty="svna.version" executable="svnversion">
69        <arg value="-c" />
70        <arg value="${workdir}" />
71        <redirector>
72            <outputfilterchain>
73                <tokenfilter>
74                    <replaceregex pattern="^[0-9]*:?" replace="" flags="g"/>
75                    <replaceregex pattern="M" replace="" flags="g"/>
76                </tokenfilter>
77            </outputfilterchain>
78        </redirector>
79    </exec>
80    <propertyfile file="${src.dir}/tmcsim/application.properties">
81        <entry key="Application.revision" value="${svna.version}" type="int" operation="="/>
82    </propertyfile>
83    <echo file="${config.dir}/application_properties.cfg" append="false">
84[Versions]
85revision_number = ${svna.version}
86    </echo>
87    <!-- Write the version number to a javascript file -->
88    <echo file="${work.dir}/webapps/common/js/revision_number.dat" append="false">
89    var revisionNumber = "${svna.version}";
90    </echo>
91    <echo>Setting SVN version: ${svna.version}</echo>
92</target>
93<target name="-post-jar" description="Sets the buildversion for the current build">
94    <propertyfile file="${src.dir}/tmcsim/application.properties">
95        <entry key="Application.buildnumber" value="1" type="int" operation="+"/>
96    </propertyfile>
97</target>
98<!--
99                =================
100                LOC counter
101                =================
102-->
103<target description="Count Lines of Code in src directory." name="loc">
104        <java classname="textui.LOC"
105              classpath="${workdir}/lib/JavaLOC.jar">
106               <arg line="-r -d ${workdir}/src"/>
107        </java>
108</target>
109<!--
110                =================
111                CHECKSTYLE SECTION
112                =================
113     -->
114<target description="Run checkstyle on src directory." name="checkstyle">
115<taskdef resource="checkstyletask.properties"
116         classpath="${workdir}/lib/customcheckstylechecks.jar;${workdir}/lib/checkstyle-all-4.4.jar"/>
117<checkstyle config="${workdir}/lib/jdstyle.xml" failOnViolation="true">
118            <!-- Specify includes and excludes -->
119            <fileset dir="${workdir}/src/tmcsim" includes="**/*.java"
120            />
121</checkstyle>
122</target>
123<!--
124                =================
125                ZIP for Web-CAT SECTION for CPE 305 assignments
126                =================
127Create a zip file of source to CADSimulator for submission to Web-CAT grader.
128-->
129<target name="webcat-zip" depends="jar">
130
131    <zip destfile="${workdir}/webcatsubmit.zip">
132        <fileset dir="${workdir}/src/">
133                 <include name="tmcsim/cadsimulator/viewer/**/*.java" />
134                 <include name="tmcsim/cadsimulator/viewer/model/**/*.java" />
135                 <include name="tmcsim/cadsimulator/viewer/actions/**/*.java" />
136                 <include name="tmcsim/cadsimulator/videocontrol/**/*.java" />
137                 <exclude name="tmcsim/paramics*/**"/>
138                 <exclude name="tmcsim/simulationmanager/**"/>
139                 <exclude name="tmcsim/cadsimulator/MP3Driver.java"/>
140        </fileset>
141        <!--
142        <fileset dir="${workdir}"  includes="scripts/Cardfile.xml"/>
143        -->
144        <fileset dir="${workdir}/test/">
145                 <include name="tmcsim/cadsimulator/viewer/CADSimulatorViewModelTest.java" />
146        </fileset>
147    </zip>
148</target>
149<!--
150                =================
151                PACKAGE JARS SECTION
152                =================
153-->
154<target description="Build separate jar files for each component of the TMC system."
155        name="package-jars" depends="jar">
156
157    <!--         *** Build a jar with everything ***            -->
158    <property name="deploy.jar.name" value="TMCSimAll"/>
159    <property name="deploy.dir" value="${workdir}/deploy"/>
160    <property name="deploy.jar" value="${deploy.dir}/${deploy.jar.name}.jar"/>
161
162    <echo message="Packaging ${application.title} components into Jar files in deploy folder."/>
163
164    <delete dir="${deploy.dir}"/>
165    <mkdir dir="${deploy.dir}"/>
166    <tstamp>
167        <format property="TODAY" pattern="yyyy.MM.dd HH:mm" />
168    </tstamp>
169    <jar destfile="${deploy.dir}/temp_final.jar" filesetmanifest="skip">
170        <zipgroupfileset dir="dist" includes="*.jar"/>
171        <!-- zipgroupfileset dir="dist/lib" includes="*.jar"/ -->
172        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
173
174        <manifest>
175            <attribute name="Main-Class" value="${main.class}"/>
176        </manifest>
177    </jar>
178
179    <!--zip destfile="${deploy.jar}">
180        <zipfileset src="${deploy.dir}/temp_final.jar"
181        excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
182    </zip-->
183
184    <delete file="${deploy.dir}/temp_final.jar"/>
185
186    <!--                   *** Build CAD Server Only Jar ***         -->
187      <jar destfile="${deploy.dir}/CADserver_r${svna.version}.jar"
188       basedir="${build.dir}/classes"
189       includes="tmcsim/cadsimulator/**, tmcsim/common/**, tmcsim/interfaces/**,
190                 tmcsim/client/cadclientgui/**, tmcsim/cadmodels/**, atmsdriver/model/**,
191                 tmcsim/highwaymodel/**, tmcsim/application.properties"
192       excludes="**/Test.class">
193        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar,jaco-mp3-player-0.9.3.jar"/>
194        <manifest>
195            <attribute name="Main-Class" value="tmcsim.cadsimulator.CADServer"/>
196        </manifest>
197      </jar>
198
199      <!--                   *** Build Sim Manager Only Jar ***         -->
200      <jar destfile="${deploy.dir}/SimManager_r${svna.version}.jar"
201       basedir="${build.dir}/classes"
202       includes="tmcsim/simulationmanager/**, tmcsim/common/**, tmcsim/cadmodels/**,
203            tmcsim/client/cadclientgui/**, tmcsim/interfaces/**,
204            tmcsim/application.properties"
205       excludes="**/Test.class">
206        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar,SimTimeSelector_r28.jar"/>
207        <manifest>
208            <attribute name="Main-Class" value="tmcsim.simulationmanager.SimulationManager"/>
209        </manifest>
210      </jar>
211
212      <!--                   *** Build CAD Client Only Jar ***         -->
213      <jar destfile="${deploy.dir}/CADclient_r${svna.version}.jar"
214       basedir="${build.dir}/classes"
215       includes="tmcsim/client/**, tmcsim/common/**, tmcsim/interfaces/**,
216            tmcsim/cadmodels/**, tmcsim/simulationmanager/model/LogEntryCellRenderer.class">
217      <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
218        <manifest>
219            <attribute name="Main-Class" value="tmcsim.client.CADClient"/>
220            <attribute name="Implementation-Version" value="${TODAY}"/>
221        </manifest>
222      </jar>
223
224      <!--                   *** Build Clock Client Only Jar ***         -->
225      <jar destfile="${deploy.dir}/ClockClient_r${svna.version}.jar"
226       basedir="${build.dir}/classes"
227       includes="tmcsim/client/ClockClient*.class, tmcsim/client/ClockView.class,
228        tmcsim/interfaces/**, tmcsim/cadmodels/**, tmcsim/common/**, tmcsim/client/**">
229      <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
230        <manifest>
231            <attribute name="Main-Class" value="tmcsim.client.ClockClient"/>
232            <attribute name="Implementation-Version" value="${TODAY}"/>
233        </manifest>
234      </jar>
235     
236      <!--                ** Unified Logger Zip file **                      -->
237      <zip destfile="${deploy.dir}/unifiedlogger.zip"
238        basedir="${src.dir}/python/unifiedlogger"
239        excludes="**/pyc, **/package.sh, wing_project.wpr"/>
240     
241      <!--                   *** Traffic Events Animator Only Jar ***         -->
242      <jar destfile="${deploy.dir}/TrafficEventsAnimator.jar"
243       basedir="${build.dir}/classes"
244       includes="atmsdriver/**, atmsdriver/model/**, tmcsim/common/**,
245            tmcsim/cadsimulator/managers/**"
246       excludes="**/Test.class">
247        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
248        <manifest>
249            <attribute name="Main-Class" value="atmsdriver/TrafficEventsAnimator"/>
250        </manifest>
251      </jar>
252      <!--                   *** Spike Only Jar ***         -->
253      <jar destfile="${deploy.dir}/ShowUserDir.jar"
254       basedir="${build.dir}/classes"
255       includes="spikes/**"
256       excludes="**/Test.class">
257        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
258        <manifest>
259            <attribute name="Main-Class" value="spikes/ShowUserDir"/>
260        </manifest>
261      </jar>
262      <!--  Set Executable --> 
263      <chmod file="${deploy.dir}/CADserver_r${svna.version}.jar" perm="a+x"/>
264      <chmod file="${deploy.dir}/SimManager_r${svna.version}.jar" perm="a+x"/>
265      <chmod file="${deploy.dir}/CADclient_r${svna.version}.jar" perm="a+x"/>
266      <chmod file="${deploy.dir}/ClockClient_r${svna.version}.jar" perm="a+x"/>
267      <chmod file="${deploy.dir}/TrafficEventsAnimator.jar" perm="a+x"/>
268      <chmod file="${deploy.dir}/ShowUserDir.jar" perm="a+x"/>
269      <chmod file="${deploy.dir}/unifiedlogger.zip" perm="a+x"/>
270</target>
271
272<target description="Build separate jar files for each component of the TMC system."
273        name="ZipForInstall" depends="package-jars">
274    <!-- Notes:    Create a zip file with jars and all external resources for distributing
275    to other machines.
276    Zip the Jar files.
277    Zip folders for config, images, audio, scripts.
278    Write .bat files and .bash files to launch each app.  Put these in root folder.
279    Zip it all up!
280    -->
281</target>
282
283</project>
Note: See TracBrowser for help on using the repository browser.