| 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 | tmcsim/application.properties" |
|---|
| 104 | excludes="**/Test.class"> |
|---|
| 105 | <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/> |
|---|
| 106 | <manifest> |
|---|
| 107 | <attribute name="Main-Class" value="tmcsim.cadsimulator.CADSimulator"/> |
|---|
| 108 | </manifest> |
|---|
| 109 | </jar> |
|---|
| 110 | |
|---|
| 111 | <!-- *** Build Sim Manager Only Jar *** --> |
|---|
| 112 | <jar destfile="${deploy.dir}/SimManager.jar" |
|---|
| 113 | basedir="${build.dir}/classes" |
|---|
| 114 | includes="tmcsim/simulationmanager/**, tmcsim/common/**, tmcsim/cadmodels/**, |
|---|
| 115 | tmcsim/client/cadclientgui/**, tmcsim/interfaces/**" |
|---|
| 116 | excludes="**/Test.class"> |
|---|
| 117 | <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/> |
|---|
| 118 | <manifest> |
|---|
| 119 | <attribute name="Main-Class" value="tmcsim.simulationmanager.SimulationManager"/> |
|---|
| 120 | </manifest> |
|---|
| 121 | </jar> |
|---|
| 122 | |
|---|
| 123 | <!-- *** Build CAD Client Only Jar *** --> |
|---|
| 124 | <jar destfile="${deploy.dir}/CADClient.jar" |
|---|
| 125 | basedir="${build.dir}/classes" |
|---|
| 126 | includes="tmcsim/client/**, tmcsim/common/**, tmcsim/interfaces/**, |
|---|
| 127 | tmcsim/cadmodels/**"> |
|---|
| 128 | <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/> |
|---|
| 129 | <manifest> |
|---|
| 130 | <attribute name="Main-Class" value="tmcsim.client.CADClient"/> |
|---|
| 131 | </manifest> |
|---|
| 132 | </jar> |
|---|
| 133 | <!-- Remove the following line when we get CADClient to run |
|---|
| 134 | <delete file="${deploy.dir}/CADClient.jar"/>--> |
|---|
| 135 | |
|---|
| 136 | <!-- *** Build Paramics Communicator Only Jar *** --> |
|---|
| 137 | <jar destfile="${deploy.dir}/ParamicsCommunicator.jar" |
|---|
| 138 | basedir="${build.dir}/classes" |
|---|
| 139 | includes="tmcsim/paramicscommunicator/**, tmcsim/common/**, tmcsim/interfaces/**, |
|---|
| 140 | tmcsim/client/cadclientgui/**, tmcsim/cadmodels/**, tmcsim/paramicslog/**" |
|---|
| 141 | excludes="**/Test.class"> |
|---|
| 142 | <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/> |
|---|
| 143 | <manifest> |
|---|
| 144 | <attribute name="Main-Class" value="tmcsim.paramicscommunicator.ParamicsCommunicator"/> |
|---|
| 145 | </manifest> |
|---|
| 146 | </jar> |
|---|
| 147 | </target> |
|---|
| 148 | |
|---|
| 149 | <target description="Build separate jar files for each component of the TMC system." |
|---|
| 150 | name="ZipForInstall" depends="package-jars"> |
|---|
| 151 | <!-- Notes: Create a zip file with jars and all external resources for distributing |
|---|
| 152 | to other machines. |
|---|
| 153 | Zip the Jar files. |
|---|
| 154 | Zip folders for config, images, audio, scripts. |
|---|
| 155 | Write .bat files and .bash files to launch each app. Put these in root folder. |
|---|
| 156 | Zip it all up! |
|---|
| 157 | --> |
|---|
| 158 | </target> |
|---|
| 159 | |
|---|
| 160 | <!-- |
|---|
| 161 | |
|---|
| 162 | There exist several targets which are by default empty and which can be |
|---|
| 163 | used for execution of your tasks. These targets are usually executed |
|---|
| 164 | before and after some main targets. They are: |
|---|
| 165 | |
|---|
| 166 | -pre-init: called before initialization of project properties |
|---|
| 167 | -post-init: called after initialization of project properties |
|---|
| 168 | -pre-compile: called before javac compilation |
|---|
| 169 | -post-compile: called after javac compilation |
|---|
| 170 | -pre-compile-single: called before javac compilation of single file |
|---|
| 171 | -post-compile-single: called after javac compilation of single file |
|---|
| 172 | -pre-compile-test: called before javac compilation of JUnit tests |
|---|
| 173 | -post-compile-test: called after javac compilation of JUnit tests |
|---|
| 174 | -pre-compile-test-single: called before javac compilation of single JUnit test |
|---|
| 175 | -post-compile-test-single: called after javac compilation of single JUunit test |
|---|
| 176 | -pre-jar: called before JAR building |
|---|
| 177 | -post-jar: called after JAR building |
|---|
| 178 | -post-clean: called after cleaning build products |
|---|
| 179 | |
|---|
| 180 | (Targets beginning with '-' are not intended to be called on their own.) |
|---|
| 181 | |
|---|
| 182 | Example of inserting an obfuscator after compilation could look like this: |
|---|
| 183 | |
|---|
| 184 | <target name="-post-compile"> |
|---|
| 185 | <obfuscate> |
|---|
| 186 | <fileset dir="${build.classes.dir}"/> |
|---|
| 187 | </obfuscate> |
|---|
| 188 | </target> |
|---|
| 189 | |
|---|
| 190 | For list of available properties check the imported |
|---|
| 191 | nbproject/build-impl.xml file. |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | Another way to customize the build is by overriding existing main targets. |
|---|
| 195 | The targets of interest are: |
|---|
| 196 | |
|---|
| 197 | -init-macrodef-javac: defines macro for javac compilation |
|---|
| 198 | -init-macrodef-junit: defines macro for junit execution |
|---|
| 199 | -init-macrodef-debug: defines macro for class debugging |
|---|
| 200 | -init-macrodef-java: defines macro for class execution |
|---|
| 201 | -do-jar-with-manifest: JAR building (if you are using a manifest) |
|---|
| 202 | -do-jar-without-manifest: JAR building (if you are not using a manifest) |
|---|
| 203 | run: execution of project |
|---|
| 204 | -javadoc-build: Javadoc generation |
|---|
| 205 | test-report: JUnit report generation |
|---|
| 206 | |
|---|
| 207 | An example of overriding the target for project execution could look like this: |
|---|
| 208 | |
|---|
| 209 | <target name="run" depends="TMCSim-impl.jar"> |
|---|
| 210 | <exec dir="bin" executable="launcher.exe"> |
|---|
| 211 | <arg file="${dist.jar}"/> |
|---|
| 212 | </exec> |
|---|
| 213 | </target> |
|---|
| 214 | |
|---|
| 215 | Notice that the overridden target depends on the jar target and not only on |
|---|
| 216 | the compile target as the regular run target does. Again, for a list of available |
|---|
| 217 | properties which you can use, check the target you are overriding in the |
|---|
| 218 | nbproject/build-impl.xml file. |
|---|
| 219 | |
|---|
| 220 | --> |
|---|
| 221 | </project> |
|---|