| 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 | <!-- Store the Subversion version string every time you do clean/build. --> |
|---|
| 16 | <target name="-pre-compile"> |
|---|
| 17 | <exec executable="svnversion" osfamily="unix" |
|---|
| 18 | output="${workdir}/config/svn-version.txt"/> |
|---|
| 19 | <echo file="${workdir}/config/svn-version.txt" append="true"> |
|---|
| 20 | # Do not edit. This file is autogenerated by the Ant build script # |
|---|
| 21 | </echo> |
|---|
| 22 | </target> |
|---|
| 23 | <!-- |
|---|
| 24 | ================= |
|---|
| 25 | LOC counter |
|---|
| 26 | ================= |
|---|
| 27 | --> |
|---|
| 28 | <target description="Count Lines of Code in src directory." name="loc"> |
|---|
| 29 | <java classname="textui.LOC" |
|---|
| 30 | classpath="${workdir}/lib/JavaLOC.jar"> |
|---|
| 31 | <arg line="-r -d ${workdir}/src"/> |
|---|
| 32 | </java> |
|---|
| 33 | </target> |
|---|
| 34 | <!-- |
|---|
| 35 | ================= |
|---|
| 36 | CHECKSTYLE SECTION |
|---|
| 37 | ================= |
|---|
| 38 | --> |
|---|
| 39 | <target description="Run checkstyle on src directory." name="checkstyle"> |
|---|
| 40 | <taskdef resource="checkstyletask.properties" |
|---|
| 41 | classpath="${workdir}/lib/customcheckstylechecks.jar;${workdir}/lib/checkstyle-all-4.4.jar"/> |
|---|
| 42 | <checkstyle config="${workdir}/lib/jdstyle.xml" failOnViolation="true"> |
|---|
| 43 | <!-- Specify includes and excludes --> |
|---|
| 44 | <fileset dir="${workdir}/src/tmcsim" includes="**/*.java" |
|---|
| 45 | /> |
|---|
| 46 | </checkstyle> |
|---|
| 47 | </target> |
|---|
| 48 | |
|---|
| 49 | <!-- |
|---|
| 50 | ================= |
|---|
| 51 | PACKAGE JARS SECTION |
|---|
| 52 | ================= |
|---|
| 53 | --> |
|---|
| 54 | <target description="Build separate jar files for each component of the TMC system." |
|---|
| 55 | name="package-jars" depends="jar"> |
|---|
| 56 | |
|---|
| 57 | <!-- *** Build a jar with everything *** --> |
|---|
| 58 | <property name="deploy.jar.name" value="TMCSimAll"/> |
|---|
| 59 | <property name="deploy.dir" value="deploy"/> |
|---|
| 60 | <property name="deploy.jar" value="${deploy.dir}/${deploy.jar.name}.jar"/> |
|---|
| 61 | |
|---|
| 62 | <echo message="Packaging ${application.title} into a single JAR at ${deploy.jar}"/> |
|---|
| 63 | |
|---|
| 64 | <delete dir="${deploy.dir}"/> |
|---|
| 65 | <mkdir dir="${deploy.dir}"/> |
|---|
| 66 | |
|---|
| 67 | <jar destfile="${deploy.dir}/temp_final.jar" filesetmanifest="skip"> |
|---|
| 68 | <zipgroupfileset dir="dist" includes="*.jar"/> |
|---|
| 69 | <!-- zipgroupfileset dir="dist/lib" includes="*.jar"/ --> |
|---|
| 70 | <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/> |
|---|
| 71 | |
|---|
| 72 | <manifest> |
|---|
| 73 | <attribute name="Main-Class" value="${main.class}"/> |
|---|
| 74 | </manifest> |
|---|
| 75 | </jar> |
|---|
| 76 | |
|---|
| 77 | <zip destfile="${deploy.jar}"> |
|---|
| 78 | <zipfileset src="${deploy.dir}/temp_final.jar" |
|---|
| 79 | excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/> |
|---|
| 80 | </zip> |
|---|
| 81 | |
|---|
| 82 | <delete file="${deploy.dir}/temp_final.jar"/> |
|---|
| 83 | |
|---|
| 84 | <!-- *** Build CAD Server Only Jar *** --> |
|---|
| 85 | <jar destfile="${deploy.dir}/CADserver.jar" |
|---|
| 86 | basedir="${build.dir}/classes" |
|---|
| 87 | includes="tmcsim/cadsimulator/**, tmcsim/common/**, tmcsim/interfaces/**, |
|---|
| 88 | tmcsim/client/cadclientgui/**, tmcsim/cadmodels/**" |
|---|
| 89 | excludes="**/Test.class"> |
|---|
| 90 | <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/> |
|---|
| 91 | <manifest> |
|---|
| 92 | <attribute name="Main-Class" value="tmcsim.cadsimulator.CADSimulator"/> |
|---|
| 93 | </manifest> |
|---|
| 94 | </jar> |
|---|
| 95 | |
|---|
| 96 | <!-- *** Build Sim Manager Only Jar *** --> |
|---|
| 97 | <jar destfile="${deploy.dir}/SimManager.jar" |
|---|
| 98 | basedir="${build.dir}/classes" |
|---|
| 99 | includes="tmcsim/simulationmanager/**, tmcsim/common/**, tmcsim/cadmodels/**, |
|---|
| 100 | tmcsim/client/cadclientgui/**, tmcsim/interfaces/**" |
|---|
| 101 | excludes="**/Test.class"> |
|---|
| 102 | <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/> |
|---|
| 103 | <manifest> |
|---|
| 104 | <attribute name="Main-Class" value="tmcsim.simulationmanager.SimulationManager"/> |
|---|
| 105 | </manifest> |
|---|
| 106 | </jar> |
|---|
| 107 | |
|---|
| 108 | <!-- *** Build CAD Client Only Jar *** --> |
|---|
| 109 | <jar destfile="${deploy.dir}/CADClient.jar" |
|---|
| 110 | basedir="${build.dir}/classes" |
|---|
| 111 | includes="tmcsim/client/**, tmcsim/common/**, tmcsim/interfaces/**, |
|---|
| 112 | tmcsim/cadmodels/**"> |
|---|
| 113 | <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/> |
|---|
| 114 | <manifest> |
|---|
| 115 | <attribute name="Main-Class" value="tmcsim.client.CADClient"/> |
|---|
| 116 | </manifest> |
|---|
| 117 | </jar> |
|---|
| 118 | <!-- Remove the following line when we get CADClient to run |
|---|
| 119 | <delete file="${deploy.dir}/CADClient.jar"/>--> |
|---|
| 120 | |
|---|
| 121 | <!-- *** Build Paramics Communicator Only Jar *** --> |
|---|
| 122 | <jar destfile="${deploy.dir}/ParamicsCommunicator.jar" |
|---|
| 123 | basedir="${build.dir}/classes" |
|---|
| 124 | includes="tmcsim/paramicscommunicator/**, tmcsim/common/**, |
|---|
| 125 | tmcsim/paramicslog/**" |
|---|
| 126 | excludes="**/Test.class"> |
|---|
| 127 | <zipgroupfileset dir="dist/lib" includes="xercesImpl.jar"/> |
|---|
| 128 | <manifest> |
|---|
| 129 | <attribute name="Main-Class" value="tmcsim.paramicscommunicator.ParamicsCommunicator"/> |
|---|
| 130 | </manifest> |
|---|
| 131 | </jar> |
|---|
| 132 | </target> |
|---|
| 133 | <!-- |
|---|
| 134 | |
|---|
| 135 | There exist several targets which are by default empty and which can be |
|---|
| 136 | used for execution of your tasks. These targets are usually executed |
|---|
| 137 | before and after some main targets. They are: |
|---|
| 138 | |
|---|
| 139 | -pre-init: called before initialization of project properties |
|---|
| 140 | -post-init: called after initialization of project properties |
|---|
| 141 | -pre-compile: called before javac compilation |
|---|
| 142 | -post-compile: called after javac compilation |
|---|
| 143 | -pre-compile-single: called before javac compilation of single file |
|---|
| 144 | -post-compile-single: called after javac compilation of single file |
|---|
| 145 | -pre-compile-test: called before javac compilation of JUnit tests |
|---|
| 146 | -post-compile-test: called after javac compilation of JUnit tests |
|---|
| 147 | -pre-compile-test-single: called before javac compilation of single JUnit test |
|---|
| 148 | -post-compile-test-single: called after javac compilation of single JUunit test |
|---|
| 149 | -pre-jar: called before JAR building |
|---|
| 150 | -post-jar: called after JAR building |
|---|
| 151 | -post-clean: called after cleaning build products |
|---|
| 152 | |
|---|
| 153 | (Targets beginning with '-' are not intended to be called on their own.) |
|---|
| 154 | |
|---|
| 155 | Example of inserting an obfuscator after compilation could look like this: |
|---|
| 156 | |
|---|
| 157 | <target name="-post-compile"> |
|---|
| 158 | <obfuscate> |
|---|
| 159 | <fileset dir="${build.classes.dir}"/> |
|---|
| 160 | </obfuscate> |
|---|
| 161 | </target> |
|---|
| 162 | |
|---|
| 163 | For list of available properties check the imported |
|---|
| 164 | nbproject/build-impl.xml file. |
|---|
| 165 | |
|---|
| 166 | |
|---|
| 167 | Another way to customize the build is by overriding existing main targets. |
|---|
| 168 | The targets of interest are: |
|---|
| 169 | |
|---|
| 170 | -init-macrodef-javac: defines macro for javac compilation |
|---|
| 171 | -init-macrodef-junit: defines macro for junit execution |
|---|
| 172 | -init-macrodef-debug: defines macro for class debugging |
|---|
| 173 | -init-macrodef-java: defines macro for class execution |
|---|
| 174 | -do-jar-with-manifest: JAR building (if you are using a manifest) |
|---|
| 175 | -do-jar-without-manifest: JAR building (if you are not using a manifest) |
|---|
| 176 | run: execution of project |
|---|
| 177 | -javadoc-build: Javadoc generation |
|---|
| 178 | test-report: JUnit report generation |
|---|
| 179 | |
|---|
| 180 | An example of overriding the target for project execution could look like this: |
|---|
| 181 | |
|---|
| 182 | <target name="run" depends="TMCSim-impl.jar"> |
|---|
| 183 | <exec dir="bin" executable="launcher.exe"> |
|---|
| 184 | <arg file="${dist.jar}"/> |
|---|
| 185 | </exec> |
|---|
| 186 | </target> |
|---|
| 187 | |
|---|
| 188 | Notice that the overridden target depends on the jar target and not only on |
|---|
| 189 | the compile target as the regular run target does. Again, for a list of available |
|---|
| 190 | properties which you can use, check the target you are overriding in the |
|---|
| 191 | nbproject/build-impl.xml file. |
|---|
| 192 | |
|---|
| 193 | --> |
|---|
| 194 | </project> |
|---|