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

Revision 56, 9.6 KB checked in by jdalbey, 9 years ago (diff)

build.xml fix svnversion, CADSimulatorClient fix err msg

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<!--        STORE SUBVERSION BUILD STRING      -->
15<target name="-post-init" description="Sets the buildversion for the current build">
16    <exec outputproperty="svna.version" executable="svnversion">
17        <arg value="-c" />
18        <arg value="${workdir}" />
19        <redirector>
20            <outputfilterchain>
21                <tokenfilter>
22                    <replaceregex pattern="^[0-9]*:?" replace="" flags="g"/>
23                    <replaceregex pattern="M" replace="" flags="g"/>
24                </tokenfilter>
25            </outputfilterchain>
26        </redirector>
27    </exec>
28    <propertyfile file="${src.dir}/tmcsim/application.properties">
29        <entry key="Application.revision" value="${svna.version}" type="int" operation="="/>
30    </propertyfile>
31    <echo>Setting SVN version: ${svna.version}</echo>
32</target>
33<target name="-post-jar" description="Sets the buildversion for the current build">
34    <propertyfile file="${src.dir}/tmcsim/application.properties">
35        <entry key="Application.buildnumber" value="1" type="int" operation="+"/>
36    </propertyfile>
37</target>
38<!--
39                =================
40                LOC counter
41                =================
42-->
43<target description="Count Lines of Code in src directory." name="loc">
44        <java classname="textui.LOC"
45              classpath="${workdir}/lib/JavaLOC.jar">
46               <arg line="-r -d ${workdir}/src"/>
47        </java>   
48</target>   
49<!--
50                =================
51                CHECKSTYLE SECTION
52                =================
53     -->
54<target description="Run checkstyle on src directory." name="checkstyle">
55<taskdef resource="checkstyletask.properties"
56         classpath="${workdir}/lib/customcheckstylechecks.jar;${workdir}/lib/checkstyle-all-4.4.jar"/>
57<checkstyle config="${workdir}/lib/jdstyle.xml" failOnViolation="true">
58            <!-- Specify includes and excludes -->
59            <fileset dir="${workdir}/src/tmcsim" includes="**/*.java"
60            />
61</checkstyle>
62</target>     
63   
64<!--
65                =================
66                PACKAGE JARS SECTION
67                =================
68-->
69<target description="Build separate jar files for each component of the TMC system." 
70        name="package-jars" depends="jar">
71
72    <!--         *** Build a jar with everything ***            -->
73    <property name="deploy.jar.name" value="TMCSimAll"/>
74    <property name="deploy.dir" value="${workdir}/deploy"/>
75    <property name="deploy.jar" value="${deploy.dir}/${deploy.jar.name}.jar"/>
76
77    <echo message="Packaging ${application.title} into a single JAR at ${deploy.jar}"/>
78
79    <delete dir="${deploy.dir}"/>
80    <mkdir dir="${deploy.dir}"/>
81
82    <jar destfile="${deploy.dir}/temp_final.jar" filesetmanifest="skip">
83        <zipgroupfileset dir="dist" includes="*.jar"/>
84        <!-- zipgroupfileset dir="dist/lib" includes="*.jar"/ -->
85        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
86
87        <manifest>
88            <attribute name="Main-Class" value="${main.class}"/>
89        </manifest>
90    </jar>
91
92    <zip destfile="${deploy.jar}">
93        <zipfileset src="${deploy.dir}/temp_final.jar"
94        excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
95    </zip>
96
97    <delete file="${deploy.dir}/temp_final.jar"/>
98
99    <!--                   *** Build CAD Server Only Jar ***         -->
100      <jar destfile="${deploy.dir}/CADserver.jar"
101       basedir="${build.dir}/classes"
102       includes="tmcsim/cadsimulator/**, tmcsim/common/**, tmcsim/interfaces/**,
103                 tmcsim/client/cadclientgui/**, tmcsim/cadmodels/**,
104                 tmcsim/application.properties"
105       excludes="**/Test.class">
106        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
107        <manifest>
108            <attribute name="Main-Class" value="tmcsim.cadsimulator.CADSimulator"/>
109        </manifest>
110      </jar>
111
112      <!--                   *** Build Sim Manager Only Jar ***         -->
113      <jar destfile="${deploy.dir}/SimManager.jar"
114       basedir="${build.dir}/classes"
115       includes="tmcsim/simulationmanager/**, tmcsim/common/**, tmcsim/cadmodels/**,
116            tmcsim/client/cadclientgui/**, tmcsim/interfaces/**"
117       excludes="**/Test.class">
118        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
119        <manifest>
120            <attribute name="Main-Class" value="tmcsim.simulationmanager.SimulationManager"/>
121        </manifest>
122      </jar>
123
124      <!--                   *** Build CAD Client Only Jar ***         -->
125      <jar destfile="${deploy.dir}/CADClient.jar"
126       basedir="${build.dir}/classes"
127       includes="tmcsim/client/**, tmcsim/common/**, tmcsim/interfaces/**,
128            tmcsim/cadmodels/**">
129        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
130        <manifest>
131            <attribute name="Main-Class" value="tmcsim.client.CADClient"/>
132        </manifest>
133      </jar>
134      <!-- Remove the following line when we get CADClient to run
135      <delete file="${deploy.dir}/CADClient.jar"/>-->
136     
137      <!--                   *** Build Paramics Communicator Only Jar ***         -->
138      <jar destfile="${deploy.dir}/ParamicsCommunicator.jar"
139       basedir="${build.dir}/classes"
140       includes="tmcsim/paramicscommunicator/**, tmcsim/common/**, tmcsim/interfaces/**,
141                 tmcsim/client/cadclientgui/**, tmcsim/cadmodels/**, tmcsim/paramicslog/**"
142       excludes="**/Test.class">
143        <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/>
144        <manifest>
145            <attribute name="Main-Class" value="tmcsim.paramicscommunicator.ParamicsCommunicator"/>
146        </manifest>
147      </jar>
148</target>
149
150<target description="Build separate jar files for each component of the TMC system." 
151        name="ZipForInstall" depends="package-jars">
152    <!-- Notes:    Create a zip file with jars and all external resources for distributing
153    to other machines.
154    Zip the Jar files.
155    Zip folders for config, images, audio, scripts.
156    Write .bat files and .bash files to launch each app.  Put these in root folder.
157    Zip it all up!
158    -->
159</target>
160
161    <!--
162
163    There exist several targets which are by default empty and which can be
164    used for execution of your tasks. These targets are usually executed
165    before and after some main targets. They are:
166
167      -pre-init:                 called before initialization of project properties
168      -post-init:                called after initialization of project properties
169      -pre-compile:              called before javac compilation
170      -post-compile:             called after javac compilation
171      -pre-compile-single:       called before javac compilation of single file
172      -post-compile-single:      called after javac compilation of single file
173      -pre-compile-test:         called before javac compilation of JUnit tests
174      -post-compile-test:        called after javac compilation of JUnit tests
175      -pre-compile-test-single:  called before javac compilation of single JUnit test
176      -post-compile-test-single: called after javac compilation of single JUunit test
177      -pre-jar:                  called before JAR building
178      -post-jar:                 called after JAR building
179      -post-clean:               called after cleaning build products
180
181    (Targets beginning with '-' are not intended to be called on their own.)
182
183    Example of inserting an obfuscator after compilation could look like this:
184
185        <target name="-post-compile">
186            <obfuscate>
187                <fileset dir="${build.classes.dir}"/>
188            </obfuscate>
189        </target>
190
191    For list of available properties check the imported
192    nbproject/build-impl.xml file.
193
194
195    Another way to customize the build is by overriding existing main targets.
196    The targets of interest are:
197
198      -init-macrodef-javac:     defines macro for javac compilation
199      -init-macrodef-junit:     defines macro for junit execution
200      -init-macrodef-debug:     defines macro for class debugging
201      -init-macrodef-java:      defines macro for class execution
202      -do-jar-with-manifest:    JAR building (if you are using a manifest)
203      -do-jar-without-manifest: JAR building (if you are not using a manifest)
204      run:                      execution of project
205      -javadoc-build:           Javadoc generation
206      test-report:              JUnit report generation
207
208    An example of overriding the target for project execution could look like this:
209
210        <target name="run" depends="TMCSim-impl.jar">
211            <exec dir="bin" executable="launcher.exe">
212                <arg file="${dist.jar}"/>
213            </exec>
214        </target>
215
216    Notice that the overridden target depends on the jar target and not only on
217    the compile target as the regular run target does. Again, for a list of available
218    properties which you can use, check the target you are overriding in the
219    nbproject/build-impl.xml file.
220
221    -->
222</project>
Note: See TracBrowser for help on using the repository browser.