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

Revision 47, 9.5 KB checked in by jdalbey, 10 years ago (diff)

Merge 305 modifications into trunk.

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