|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <project name="com.nokia.s60tools.remotecontrol" default="cc" basedir="."> |
|
3 |
|
4 <property name="basews" value="${ws}"/> |
|
5 <property name="baseos" value="${os}"/> |
|
6 <property name="basearch" value="${arch}"/> |
|
7 <property name="basenl" value="${nl}"/> |
|
8 |
|
9 <!-- Compiler settings --> |
|
10 <property name="javacFailOnError" value="true"/> |
|
11 <property name="javacDebugInfo" value="on"/> |
|
12 <property name="javacVerbose" value="false"/> |
|
13 <property name="logExtension" value=".log"/> |
|
14 <property name="compilerArg" value=""/> |
|
15 <property name="javacSource" value="5"/> |
|
16 <property name="javacTarget" value="5"/> |
|
17 |
|
18 <property name="bootclasspath" refid="path_bootclasspath"/> |
|
19 <property name="bundleJavacSource" value="${javacSource}"/> |
|
20 <property name="bundleJavacTarget" value="${javacTarget}"/> |
|
21 <property name="bundleBootClasspath" value="${bootclasspath}"/> |
|
22 |
|
23 <property name="help.project.name" value="${ant.project.name}.help"/> |
|
24 <property name="feature.project.folder" location="../com.nokia.carbide.extensions.remotecontrol"/> |
|
25 <property name="feature.project.name" value="com.nokia.carbide.extensions.remotecontrol"/> |
|
26 <property name="feature.name" value="RemoteControl"/> |
|
27 |
|
28 <property name="jar.filename" value="${ant.project.name}.jar"/> |
|
29 <property name="help.jar.filename" value="${help.project.name}.jar"/> |
|
30 |
|
31 <!-- Folder definitions --> |
|
32 <property name="carbide.int.folder" location="c:/Carbide_internal/plugins"/> |
|
33 <property name="carbide.dev.folder" location="c:/Carbide_development/plugins"/> |
|
34 <property name="test.folder" location="../com.nokia.s60tools.remotecontrol.tests"/> |
|
35 <property name="binaries.folder" location="../${feature.name}.binaries"/> |
|
36 <property name="reports.folder" location="reports"/> |
|
37 <property name="reports.emma" location="${reports.folder}/emma"/> |
|
38 <property name="instr.folder" location="instr"/> |
|
39 |
|
40 |
|
41 <!-- EMMA configuration --> |
|
42 <path id="emma.lib" > |
|
43 <pathelement location="${ant.home}/lib/emma.jar" /> |
|
44 <pathelement location="${ant.home}/lib/emma_ant.jar" /> |
|
45 </path> |
|
46 |
|
47 <taskdef resource="emma_ant.properties" classpathref="emma.lib" /> |
|
48 |
|
49 <!-- PMD configuration --> |
|
50 <path id="pmd.lib" > |
|
51 <pathelement location="${ant.home}/lib/pmd-4.2.jar" /> |
|
52 <pathelement location="${ant.home}/lib/asm-3.1.jar" /> |
|
53 <pathelement location="${ant.home}/lib/jaxen-1.1.1.jar" /> |
|
54 </path> |
|
55 |
|
56 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib" /> |
|
57 |
|
58 <path id="path_bootclasspath"> |
|
59 <fileset dir="${java.home}/lib"> |
|
60 <include name="*.jar"/> |
|
61 </fileset> |
|
62 </path> |
|
63 |
|
64 <path id="build_classpath"> |
|
65 <path refid="carbide_classpath"/> |
|
66 </path> |
|
67 |
|
68 <path id="carbide_classpath"> |
|
69 <fileset dir="${carbide.dev.folder}" includes="**/*.jar" /> |
|
70 </path> |
|
71 |
|
72 <target name="properties" if="eclipse.running"> |
|
73 <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> |
|
74 </target> |
|
75 |
|
76 <!-- Initialization --> |
|
77 <target name="init" depends="properties"> |
|
78 <condition property="pluginTemp" value="${buildTempFolder}/plugins"> |
|
79 <isset property="buildTempFolder"/> |
|
80 </condition> |
|
81 <property name="pluginTemp" value="${basedir}"/> |
|
82 <condition property="build.result.folder" value="${pluginTemp}/${ant.project.name}"> |
|
83 <isset property="buildTempFolder"/> |
|
84 </condition> |
|
85 <property name="build.result.folder" value="${basedir}"/> |
|
86 <property name="temp.folder" value="${basedir}/temp.folder"/> |
|
87 <property name="plugin.destination" value="${basedir}"/> |
|
88 |
|
89 <property name="jar.filename" value="${ant.project.name}.jar"/> |
|
90 |
|
91 <delete dir="${temp.folder}"/> |
|
92 <mkdir dir="${temp.folder}"/> |
|
93 |
|
94 <delete dir="${temp.folder}/bin"/> |
|
95 <mkdir dir="${temp.folder}/bin"/> |
|
96 |
|
97 <delete dir="${reports.folder}"/> |
|
98 <mkdir dir="${reports.folder}"/> |
|
99 |
|
100 <exec executable="svn" dir="../."> |
|
101 <arg line="up"/> |
|
102 </exec> |
|
103 </target> |
|
104 |
|
105 <!-- Build target --> |
|
106 <target name="build" depends="init" description="Build the source"> |
|
107 <!-- Build the source --> |
|
108 <javac destdir="${temp.folder}/bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}"> |
|
109 <compilerarg line="${compilerArg}" compiler="${build.compiler}"/> |
|
110 <classpath refid="build_classpath" /> |
|
111 <src path="src/" /> |
|
112 <src path="../com.nokia.s60tools.remotecontrol.help/src/"/> |
|
113 <compilerarg value="@${basedir}/javaCompiler...args" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/> |
|
114 <compilerarg line="-log '${temp.folder}/bin${logExtension}'" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/> |
|
115 </javac> |
|
116 |
|
117 <!-- Copy necessary resources --> |
|
118 <copy todir="${temp.folder}/bin" failonerror="true" overwrite="false"> |
|
119 <fileset dir="src/" excludes="**/*.java, **/package.htm*" /> |
|
120 </copy> |
|
121 |
|
122 <!-- Create build result folder --> |
|
123 <mkdir dir="${build.result.folder}"/> |
|
124 |
|
125 <!-- Copy classes from the temporary folder to bin --> |
|
126 <copy todir="${build.result.folder}" failonerror="true" overwrite="false"> |
|
127 <fileset dir="${temp.folder}/bin" /> |
|
128 </copy> |
|
129 |
|
130 <!-- Delete temporary folder --> |
|
131 <delete dir="${temp.folder}"/> |
|
132 </target> |
|
133 |
|
134 <!-- Clean target --> |
|
135 <target name="clean" description="Clean" depends="clean-test"> |
|
136 <delete dir="${build.result.folder}" /> |
|
137 <delete> |
|
138 <fileset dir="${binaries.folder}" includes="*.jar"/> |
|
139 </delete> |
|
140 </target> |
|
141 |
|
142 <!-- Analyze target --> |
|
143 <target name="analyze"> |
|
144 <!-- PMD --> |
|
145 <pmd> |
|
146 <!-- Rules --> |
|
147 <ruleset>basic</ruleset> |
|
148 <ruleset>codesize</ruleset> |
|
149 <ruleset>coupling</ruleset> |
|
150 <ruleset>design</ruleset> |
|
151 <ruleset>strictexception</ruleset> |
|
152 <ruleset>strings</ruleset> |
|
153 <ruleset>sunsecure</ruleset> |
|
154 |
|
155 <!-- XML output --> |
|
156 <formatter type="xml" toFile="${reports.folder}/report.pmd.xml"/> |
|
157 |
|
158 <!-- Files to analyze --> |
|
159 <fileset dir="src/"> |
|
160 <include name="**/*.java"/> |
|
161 </fileset> |
|
162 </pmd> |
|
163 </target> |
|
164 |
|
165 <!-- Instrumentation target, depends on JAR --> |
|
166 <target name="instr" depends="jar"> |
|
167 <!-- Instrument the source code --> |
|
168 <emma> |
|
169 <instr instrpath="${binaries.folder}/${jar.filename}" destdir="${instr.folder}" metadatafile="${reports.emma}/metadata.emma" merge="true"/> |
|
170 </emma> |
|
171 </target> |
|
172 |
|
173 <!-- JAR target --> |
|
174 <target name="jar" depends="build" description="Create JAR"> |
|
175 |
|
176 <delete dir="binaries"/> |
|
177 <mkdir dir="binaries"/> |
|
178 <delete dir="${help.project.name}/com/nokia/s60tools/remotecontrol/help"/> |
|
179 <mkdir dir="${help.project.name}/com/nokia/s60tools/remotecontrol/help"/> |
|
180 |
|
181 <copy todir="../${help.project.name}/com/nokia/s60tools/remotecontrol/help" failonerror="true" overwrite="true"> |
|
182 <fileset dir="${build.result.folder}/com/nokia/s60tools/remotecontrol/help" /> |
|
183 </copy> |
|
184 <delete dir="${build.result.folder}/com/nokia/s60tools/remotecontrol/help"/> |
|
185 |
|
186 |
|
187 <copy todir="binaries" failonerror="true" overwrite="false"> |
|
188 <fileset dir="${build.result.folder}"> |
|
189 <include name="com/**"/> |
|
190 <include name="icons/**"/> |
|
191 <include name="META-INF/**"/> |
|
192 <include name="plugin.xml"/> |
|
193 <include name="about.html"/> |
|
194 <include name="about.ini"/> |
|
195 <include name="about.mappings"/> |
|
196 <include name="about.properties"/> |
|
197 </fileset> |
|
198 </copy> |
|
199 |
|
200 <!-- Create JAR --> |
|
201 <zip destfile="${binaries.folder}/${jar.filename}" basedir="binaries" /> |
|
202 |
|
203 <delete dir="binaries"/> |
|
204 <delete dir="com"/> |
|
205 </target> |
|
206 |
|
207 <!-- Feature target --> |
|
208 <target name="feature" depends="jar" description="Create feature"> |
|
209 <property name="feature.folder" location="${binaries.folder}/feature"/> |
|
210 |
|
211 <mkdir dir="${feature.folder}"/> |
|
212 <mkdir dir="${feature.folder}/plugins"/> |
|
213 <mkdir dir="${feature.folder}/features/${feature.project.name}"/> |
|
214 |
|
215 <!-- Create help JAR --> |
|
216 <zip destfile="${feature.folder}/plugins/${help.jar.filename}" basedir="../${help.project.name}" excludes="src/,.*"/> |
|
217 |
|
218 <!-- Copy feature stuff to the temp folder --> |
|
219 <copy todir="${feature.folder}/features/${feature.project.name}" file="${feature.project.folder}/feature.xml"/> |
|
220 <copy todir="${feature.folder}/features/${feature.project.name}" file="${feature.project.folder}/license.txt"/> |
|
221 |
|
222 <!-- Copy the actual plug-in to the temp folder --> |
|
223 <copy todir="${feature.folder}/plugins" file="${binaries.folder}/${jar.filename}"/> |
|
224 |
|
225 <!-- Copy the actual plug-ins to the carbide folders --> |
|
226 <copy todir="${carbide.int.folder}" failonerror="true" overwrite="true"> |
|
227 <fileset dir="${feature.folder}/plugins"/> |
|
228 </copy> |
|
229 <copy todir="${carbide.dev.folder}" failonerror="true" overwrite="true"> |
|
230 <fileset dir="${feature.folder}/plugins"/> |
|
231 </copy> |
|
232 |
|
233 <!-- Create the feature zip --> |
|
234 <zip destfile="${binaries.folder}/${feature.name}.zip" basedir="${feature.folder}"/> |
|
235 |
|
236 <deltree dir="${feature.folder}"/> |
|
237 |
|
238 <!-- Nightly build --> |
|
239 <tstamp> |
|
240 <format property="timestamp" pattern="dd-MM-yyyy" /> |
|
241 </tstamp> |
|
242 |
|
243 <copy tofile="../../../nightly_builds/${feature.name}/${feature.name}-${timestamp}.zip" file="${binaries.folder}/${feature.name}.zip"/> |
|
244 </target> |
|
245 |
|
246 <!-- Clean tests target --> |
|
247 <target name="clean-test" description="Clean test"> |
|
248 <delete> |
|
249 <fileset dir="${test.folder}" includes="**/*.class" /> |
|
250 </delete> |
|
251 <delete dir="${instr.folder}"/> |
|
252 <delete dir="${reports.folder}"/> |
|
253 </target> |
|
254 |
|
255 <!-- Test target, depends on instrumentation and analyze --> |
|
256 <target name="test" depends="instr" description="Run unit tests"> |
|
257 <!-- Test classpath --> |
|
258 <path id="test_classpath"> |
|
259 <!-- Test classes --> |
|
260 <pathelement location="${test.folder}/src"/> |
|
261 |
|
262 <!-- Instrumented class files --> |
|
263 <pathelement location="${instr.folder}"/> |
|
264 |
|
265 <!-- EMMA --> |
|
266 <pathelement path="${ant.home}/lib/emma.jar"/> |
|
267 |
|
268 <path refid="build_classpath" /> |
|
269 </path> |
|
270 |
|
271 <!-- Compile the tests --> |
|
272 <javac srcdir="${test.folder}" verbose="${javacVerbose}"> |
|
273 <classpath refid="test_classpath"/> |
|
274 </javac> |
|
275 |
|
276 <!-- Run JUnit --> |
|
277 <junit printsummary="yes" fork="yes" haltonfailure="yes"> |
|
278 <classpath refid="test_classpath" /> |
|
279 |
|
280 <!-- Plain format and XML --> |
|
281 <formatter type="plain" /> |
|
282 <formatter type="xml" /> |
|
283 |
|
284 <!-- Instrumentation arguments to JVM --> |
|
285 <jvmarg value="-Demma.coverage.out.file=${reports.emma}/coverage.emma" /> |
|
286 <jvmarg value="-Demma.coverage.out.merge=true" /> |
|
287 |
|
288 <!-- Test classes --> |
|
289 <test name="com.nokia.s60tools.remotecontrol.tests.AllJUnitPlugInTests" todir="${reports.folder}"/> |
|
290 </junit> |
|
291 |
|
292 <!-- Create EMMA report --> |
|
293 <emma> |
|
294 <report sourcepath="src/" > |
|
295 <fileset dir="${reports.emma}" > |
|
296 <include name="*.emma" /> |
|
297 </fileset> |
|
298 <xml outfile="${reports.emma}/coverage.xml" /> |
|
299 </report> |
|
300 </emma> |
|
301 </target> |
|
302 |
|
303 <target name="cc" depends="jar, analyze, feature" description="Build, instrument, run unit tests and analyze code"/> |
|
304 </project> |