|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <!-- |
|
3 ============================================================================ |
|
4 Name : ido-prep.ant.xml |
|
5 Part of : Helium |
|
6 |
|
7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
8 All rights reserved. |
|
9 This component and the accompanying materials are made available |
|
10 under the terms of the License "Eclipse Public License v1.0" |
|
11 which accompanies this distribution, and is available |
|
12 at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
13 |
|
14 Initial Contributors: |
|
15 Nokia Corporation - initial contribution. |
|
16 |
|
17 Contributors: |
|
18 |
|
19 Description: |
|
20 |
|
21 ============================================================================ |
|
22 --> |
|
23 <project name="ido-prep" xmlns:hlm="http://www.nokia.com/helium"> |
|
24 <description> |
|
25 IDO related targets. |
|
26 * Build area preparation |
|
27 * Codescanner integration |
|
28 * Cenrep generation (old way) |
|
29 * IBY export (old way) |
|
30 </description> |
|
31 |
|
32 <property name="ado.mapping.file" location="${build.output.dir}/build/ado_mapping.ini"/> |
|
33 <property name="ado.quality.mapping.file" location="${build.output.dir}/build/ado_quality_mapping.ini"/> |
|
34 <property name="ido.romtree" location="${build.drive}${env.EPOCROOT}/epoc32/rom/include" /> |
|
35 <property name="ido.cenrep.root" location="${build.drive}${env.EPOCROOT}/epoc32/tools/cenrep/ido/src" /> |
|
36 <property name="ido.cenrep.target" value="${build.drive}${env.EPOCROOT}/epoc32/data/z/private/10202be9" /> |
|
37 <property name="ido.codescanner.output.dir" location="${build.output.dir}/${build.id}_codescanner"/> |
|
38 |
|
39 <!-- Internal target that generates the '''ado.mapping.file'''. |
|
40 It is a INI file that contains ADO location as a key and target location as value. |
|
41 --> |
|
42 <target name="ido-create-ado-mapping"> |
|
43 <mkdir dir="${build.output.dir}/build"/> |
|
44 <mkdir dir="${temp.build.dir}"/> |
|
45 <tempfile property="prep.dynamic.sysdef.config" suffix=".txt" deleteonexit="false" destdir="${temp.build.dir}"/> |
|
46 <hlm:referenceToFileMacro refid="system.definition.files" output="${prep.dynamic.sysdef.config}"/> |
|
47 <trycatch> |
|
48 <try> |
|
49 <pathconvert pathsep="," property="ado.quality.dirs.path"> |
|
50 <dirset refid="ado.quality.dirs"/> |
|
51 </pathconvert> |
|
52 </try> |
|
53 </trycatch> |
|
54 <script language="jython" setbeans="false"> |
|
55 import os |
|
56 import ant |
|
57 import shutil |
|
58 import fileutils |
|
59 import ido |
|
60 |
|
61 input = open(project.getProperty(r"prep.dynamic.sysdef.config"), 'r') |
|
62 output = open(project.getProperty(r"ado.mapping.file"), 'w') |
|
63 outputquality = open(project.getProperty(r"ado.quality.mapping.file"), 'w') |
|
64 components = {} |
|
65 for sysdef in input.readlines(): |
|
66 sysdef = sysdef.strip() |
|
67 if len(sysdef) > 0: |
|
68 print "Checking %s" % sysdef |
|
69 os.path.dirname(sysdef) |
|
70 location = ido.get_sysdef_location(sysdef) |
|
71 if location != None: |
|
72 sysdef = os.path.dirname(sysdef).replace('\\','/').replace(':','\\:') |
|
73 component = os.path.normpath(os.path.join(project.getProperty(r"build.drive"), os.environ['EPOCROOT'], location)).replace('\\','/').replace(':','\\:') |
|
74 print "%s=%s\n" % (sysdef, component) |
|
75 output.write("%s=%s\n" % (sysdef, component)) |
|
76 |
|
77 if project.getProperty("ado.quality.dirs.path") == None: |
|
78 outputquality.write("%s=%s\n" % (sysdef, component)) |
|
79 else: |
|
80 for dir in project.getProperty("ado.quality.dirs.path").split(','): |
|
81 if os.path.normpath(dir) == os.path.normpath(os.path.join(project.getProperty(r"build.drive"), os.environ['EPOCROOT'], location)): |
|
82 outputquality.write("%s=%s\n" % (sysdef, component)) |
|
83 outputquality.close() |
|
84 output.close() |
|
85 input.close() |
|
86 </script> |
|
87 </target> |
|
88 |
|
89 |
|
90 <!-- Target that uses the information from the system.definition.files to prepare the IDO build area. |
|
91 It relies on the fact that layer_real_source_path entity is declared in each ADO configuration. |
|
92 |
|
93 By default it deletes the previous content. If you want to backup what was previoulsy used please |
|
94 defined '''ido.keep.old''' property. |
|
95 --> |
|
96 <target name="ido-prep-copy" depends="ido-create-ado-mapping"> |
|
97 <mkdir dir="${temp.build.dir}"/> |
|
98 <tempfile property="prep.dynamic.config" suffix=".xml" deleteonexit="false" destdir="${temp.build.dir}"/> |
|
99 |
|
100 <!-- new implementation that only rely on Ant --> |
|
101 <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-ant-delete.xml.ftl" |
|
102 outputFile="${prep.dynamic.config}.clean.xml"> |
|
103 <data expandProperties="yes"> |
|
104 inputfile: antProperty(ado.mapping.file) |
|
105 ant: antProperties() |
|
106 data: eval(' |
|
107 java.io.FileInputStream pin = new java.io.FileInputStream(filename); |
|
108 java.util.Properties props = new java.util.Properties(); |
|
109 props.load(pin); |
|
110 return props; |
|
111 ', {filename:get(inputfile)}) |
|
112 </data> |
|
113 </fmpp> |
|
114 <ant antfile="${prep.dynamic.config}.clean.xml"/> |
|
115 |
|
116 <!-- new implementation that only rely on Ant --> |
|
117 <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-ant-copy.xml.ftl" |
|
118 outputFile="${prep.dynamic.config}"> |
|
119 <data expandProperties="yes"> |
|
120 inputfile: antProperty(ado.mapping.file) |
|
121 ant: antProperties() |
|
122 data: eval(' |
|
123 java.io.FileInputStream pin = new java.io.FileInputStream(filename); |
|
124 java.util.Properties props = new java.util.Properties(); |
|
125 props.load(pin); |
|
126 return props; |
|
127 ', {filename:get(inputfile)}) |
|
128 </data> |
|
129 </fmpp> |
|
130 <ant antfile="${prep.dynamic.config}"/> |
|
131 </target> |
|
132 |
|
133 |
|
134 <!-- |
|
135 Run cleanup system definition configuration. The configuration name are |
|
136 generated from the '''sysdef.configurations.list''' property, appending '_clean' |
|
137 at the end of each configuration also reversing their build order. |
|
138 if '''sysdef.clean.configurations.list''' is defined it overrides |
|
139 the previous beharvious and is used to cleanup the environment. |
|
140 --> |
|
141 <target name ="ido-prep-clean"> |
|
142 <if> |
|
143 <not> |
|
144 <isset property="sysdef.clean.configurations.list"/> |
|
145 </not> |
|
146 <then> |
|
147 <if> |
|
148 <isset property="sysdef.configurations.list"/> |
|
149 <then> |
|
150 <script language="jython" setbeans="false"> |
|
151 rev_names = "" |
|
152 for sysdef in project.getProperty("sysdef.configurations.list").split(","): |
|
153 rev_names = sysdef + "_clean," + rev_names; |
|
154 project.setProperty("sysdef.clean.configurations.list", rev_names) |
|
155 </script> |
|
156 </then> |
|
157 <else> |
|
158 <fail message="You should either define sysdef.clean.configurations.list or sysdef.configurations.list."/> |
|
159 </else> |
|
160 </if> |
|
161 </then> |
|
162 </if> |
|
163 |
|
164 <antcall target="compile-main"> |
|
165 <param name="sysdef.configurations.list" value="${sysdef.clean.configurations.list}"/> |
|
166 <param name="compile.signal.input" value="compileCleanSignalInput"/> |
|
167 <param name="compile.discard.result" value="true"/> |
|
168 <param name="compile.cmd.clean" value="true"/> |
|
169 </antcall> |
|
170 </target> |
|
171 |
|
172 |
|
173 |
|
174 <!-- |
|
175 Internal target that set an intermediate property to disable codescanner execution. |
|
176 --> |
|
177 <target name="ido-codescanner-skip"> |
|
178 <if> |
|
179 <istrue value="${skip.codescanner}"/> |
|
180 <then> |
|
181 <property name="do.skip.codescanner" value="1"/> |
|
182 </then> |
|
183 </if> |
|
184 </target> |
|
185 |
|
186 <!-- |
|
187 This targets run the codescanner application on each discovered ADO. |
|
188 The location of the output is defined byt '''ido.codescanner.output.dir''' property. |
|
189 And the type is defined by '''ido.codescanner.output.type''' (default is HTML). |
|
190 --> |
|
191 <target name="ido-codescanner" depends="ido-create-ado-mapping,ido-codescanner-skip" unless="do.skip.codescanner"> |
|
192 <!--hlm:iniKeys2Path ini="${ado.mapping.file}" pathid="ado.src.path"/--> |
|
193 <property name="ido.codescanner.output.type" value="html"/> |
|
194 <script language="jython" setbeans="false"> |
|
195 """ internal.codescanner.drive """ |
|
196 import os |
|
197 import fileutils |
|
198 import configuration |
|
199 import pathaddition.relative |
|
200 |
|
201 config = configuration.PropertiesConfiguration(stream=open(str(project.getProperty("ado.quality.mapping.file")), 'r')) |
|
202 prefix = pathaddition.relative.commonprefix(config.keys()) |
|
203 if not os.path.exists(prefix): |
|
204 raise Exception("Could not find common prefix for the following paths:\n" + "\n".join(config.keys())) |
|
205 self.log(str('Substing %s' % prefix)) |
|
206 drive = fileutils.get_next_free_drive() |
|
207 fileutils.subst(drive, prefix) |
|
208 project.setProperty('internal.codescanner.drive', drive) |
|
209 |
|
210 # creating the structure form subst drive. |
|
211 path = project.createDataType("path") |
|
212 for location in config.keys(): |
|
213 self.log(str("From %s" % location)) |
|
214 location = drive + os.sep + pathaddition.relative.abs2rel(location, prefix) |
|
215 self.log(str("To %s" % location)) |
|
216 pe = path.createPathElement() |
|
217 pe.setPath(location) |
|
218 project.addReference('substed.ado.src.path', path) |
|
219 </script> |
|
220 <hlm:codescanner dest="${ido.codescanner.output.dir}" |
|
221 format="${ido.codescanner.output.type}" |
|
222 configuration="${ido.codescanner.config}"> |
|
223 <path refid="substed.ado.src.path"/> |
|
224 </hlm:codescanner> |
|
225 <hlm:unsubst drive="${internal.codescanner.drive}"/> |
|
226 </target> |
|
227 |
|
228 <!-- CMT Tool target. Complexity tool measures. Supported options for cmt tool macro is |
|
229 1. input - files to be measured |
|
230 2. output - output xml file (file size is huge 68MB for JAVA IDO, if this needs to be send, need to consider |
|
231 3. config - input config . |
|
232 --> |
|
233 <target name="ido-cmt" depends="ido-create-ado-mapping" if="enable.cmt"> |
|
234 <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-cmt-ant.xml.ftl" |
|
235 outputFile="${temp.build.dir}/ido-cmt.ant.xml"> |
|
236 <data expandProperties="yes"> |
|
237 inputfile: antProperty(ado.quality.mapping.file) |
|
238 ant: antProperties() |
|
239 data: eval(' |
|
240 java.io.FileInputStream pin = new java.io.FileInputStream(filename); |
|
241 java.util.Properties props = new java.util.Properties(); |
|
242 props.load(pin); |
|
243 return props; |
|
244 ', {filename:get(inputfile)}) |
|
245 </data> |
|
246 </fmpp> |
|
247 <ant antfile="${temp.build.dir}/ido-cmt.ant.xml"/> |
|
248 </target> |
|
249 |
|
250 |
|
251 <!-- Internal target that generates a temporary file that allow the |
|
252 either export of iby or either key*.xls. The generated Ant build file |
|
253 contains two targets with copy insturctions and generic set of fileset rules. |
|
254 --> |
|
255 <target name="ido-create-copy-file" depends="ido-create-ado-mapping"> |
|
256 <tempfile property="copyfile.dynamic.config" suffix=".ant.xml" deleteonexit="false" destdir="${temp.build.dir}"/> |
|
257 <fmpp sourceFile="${helium.dir}/tools/common/templates/ido/ido-export.ant.xml.ftl" |
|
258 outputFile="${copyfile.dynamic.config}"> |
|
259 <data expandProperties="yes"> |
|
260 inputfile: antProperty(ado.mapping.file) |
|
261 ant: antProperties() |
|
262 data: eval(' |
|
263 java.io.FileInputStream pin = new java.io.FileInputStream(filename); |
|
264 java.util.Properties props = new java.util.Properties(); |
|
265 props.load(pin); |
|
266 return props; |
|
267 ', {filename:get(inputfile)}) |
|
268 </data> |
|
269 </fmpp> |
|
270 </target> |
|
271 |
|
272 <!-- Do the export of the ibys from ADO work area level to epoc32 tree. --> |
|
273 <target name="ido-copy-iby" depends="ido-create-copy-file"> |
|
274 <ant antfile="${copyfile.dynamic.config}" target="ido-copy-iby"/> |
|
275 </target> |
|
276 |
|
277 <!-- Do the export of the Excel keys*.xls from ADO work area level to |
|
278 epoc32 tree. |
|
279 --> |
|
280 <target name="ido-copy-cenrep" depends="ido-create-copy-file"> |
|
281 <delete dir="${ido.cenrep.root}"/> |
|
282 <mkdir dir="${ido.cenrep.root}"/> |
|
283 <ant antfile="${copyfile.dynamic.config}" target="ido-copy-cenrep"/> |
|
284 </target> |
|
285 |
|
286 <!-- Generated cenrep from exported keys*.xls files. --> |
|
287 <target name="ido-create-cenrep" depends="ido-copy-cenrep"> |
|
288 <delete dir="${ido.cenrep.root}/../data"/> |
|
289 <mkdir dir="${ido.cenrep.root}/../data"/> |
|
290 <exec executable="perl" dir="${ido.cenrep.root}" failonerror="true"> |
|
291 <arg value="${build.drive}/epoc32/tools/cenrep/generate_cenrep_inifile.pl"/> |
|
292 <arg value="-r"/> |
|
293 <arg value="${ido.cenrep.platform}"/> |
|
294 <arg value="-d"/> |
|
295 <arg value="${ido.cenrep.root}"/> |
|
296 <arg value="-rd"/> |
|
297 <arg value="${ido.cenrep.root}/../data"/> |
|
298 </exec> |
|
299 <!-- Copy generated files to target path --> |
|
300 <copy todir="${ido.cenrep.target}" verbose="true" flatten="true" overwrite="true"> |
|
301 <fileset dir="${ido.cenrep.root}/../data"> |
|
302 <include name="*.txt"/> |
|
303 </fileset> |
|
304 </copy> |
|
305 |
|
306 </target> |
|
307 |
|
308 <!-- Gets the contents from GRACE / Dragonfly --> |
|
309 <target name="ido-check-latest-release" depends="ido-check-latest-release-grace" unless="env.HLM_SUBCON"> |
|
310 <runtarget target="ido-check-latest-release-dragonfly"/> |
|
311 </target> |
|
312 |
|
313 <!-- Checks the contents from GRACE release. Mainly used by IDOs. But could be |
|
314 extended to product builds.--> |
|
315 <target name="ido-check-latest-release-grace" unless="use.dragonfly"> |
|
316 <script language="jython" setbeans="false"> |
|
317 import re |
|
318 import os |
|
319 import symrec |
|
320 import logging |
|
321 import traceback |
|
322 import ant |
|
323 |
|
324 if not project.getProperty('s60.grace.server'): |
|
325 raise Exception("Property 's60.grace.server' is not defined.") |
|
326 if not project.getProperty('s60.grace.service'): |
|
327 raise Exception("Property 's60.grace.service' is not defined.") |
|
328 if not project.getProperty('s60.grace.product'): |
|
329 raise Exception("Property 's60.grace.product' is not defined.") |
|
330 if not project.getProperty('s60.grace.release'): |
|
331 raise Exception("Property 's60.grace.release' is not defined.") |
|
332 grace = project.getProperty('s60.grace.server') |
|
333 service = project.getProperty('s60.grace.service') |
|
334 product = project.getProperty('s60.grace.product') |
|
335 release = project.getProperty('s60.grace.release') |
|
336 revision = r'(_\d{3})?' |
|
337 if project.getProperty('s60.grace.revision') != None: |
|
338 revision = project.getProperty('s60.grace.revision') |
|
339 |
|
340 # Get the cache filename. |
|
341 cachefilename = project.getProperty('s60.grace.cache') |
|
342 if cachefilename: |
|
343 self.log(str("Using cache file: %s" % cachefilename)) |
|
344 |
|
345 checkmd5 = False |
|
346 if project.getProperty('s60.grace.checkmd5') != None: |
|
347 checkmd5 = str(project.getProperty('s60.grace.checkmd5')).lower() |
|
348 checkmd5 = ((checkmd5 == "true") or (checkmd5 == "1") or (checkmd5 == "on")) |
|
349 |
|
350 branch = os.path.join(grace, service, product) |
|
351 if not os.path.exists(branch): |
|
352 raise Exception("Error occurred: Could not find directory %s" % branch) |
|
353 |
|
354 result = [] |
|
355 for rel in os.listdir(branch): |
|
356 relpath = os.path.join(branch, rel) |
|
357 self.log("Checking: %s" % str(relpath)) |
|
358 res = re.match(r"%s%s$" % (release, revision), rel, re.I) |
|
359 if res != None: |
|
360 self.log("Found: %s" % str(relpath)) |
|
361 result.append(relpath) |
|
362 result.sort(reverse=True) |
|
363 use_tickler = False |
|
364 tickler_validation = str(project.getProperty('s60.grace.usetickler')).lower() |
|
365 if tickler_validation != None: |
|
366 use_tickler = ((tickler_validation == "true") or (tickler_validation == "1")) |
|
367 validresults = [] |
|
368 for rel in result: |
|
369 try: |
|
370 metadata_filename = symrec.find_latest_metadata(str(rel)) |
|
371 if metadata_filename is not None and os.path.exists(metadata_filename): |
|
372 self.log(str("Validating: %s" % metadata_filename)) |
|
373 if (use_tickler): |
|
374 validator = symrec.ValidateTicklerReleaseMetadata(metadata_filename, cachefilename) |
|
375 else: |
|
376 validator = symrec.ValidateReleaseMetadataCached(metadata_filename, cachefilename) |
|
377 if validator.is_valid(checkmd5): |
|
378 self.log(str("%s is valid." % rel)) |
|
379 validresults.append(rel) |
|
380 break |
|
381 else: |
|
382 self.log(str("%s is not a valid release." % rel)) |
|
383 elif metadata_filename is None: |
|
384 self.log(str("Could not find the release metadata file under %s" % rel)) |
|
385 except Exception, e: |
|
386 self.log(str("WARNING: %s: %s" % (rel , e))) |
|
387 self.log(str("%s is not a valid release." % rel)) |
|
388 traceback.print_exc() |
|
389 |
|
390 result = validresults |
|
391 if len(result) == 0: |
|
392 raise Exception("Error finding GRACE release.") |
|
393 print result[0] |
|
394 resultname = os.path.basename(result[0]) |
|
395 vfile = os.path.join(project.getProperty('build.drive') + os.sep, 's60_version.txt') |
|
396 if (os.path.exists(vfile)): |
|
397 self.log("Are we still up-to-date compare to %s" % str(vfile)) |
|
398 f = open(str(vfile), 'r') |
|
399 version = f.readline() |
|
400 self.log(str("'%s' == '%s'" % (version, resultname))) |
|
401 project.setProperty('s60.getenv.path', str(result[0])) |
|
402 project.setProperty('s60.getenv.release', str(resultname)) |
|
403 if version.strip() != resultname: |
|
404 project.setProperty('s60.getenv.update', "1") |
|
405 f.close() |
|
406 else: |
|
407 self.log("Version file not found getting new environment...") |
|
408 project.setProperty('s60.getenv.path', str(result[0])) |
|
409 project.setProperty('s60.getenv.release', str(resultname)) |
|
410 project.setProperty('s60.getenv.update', "1") |
|
411 </script> |
|
412 </target> |
|
413 |
|
414 <!-- Updates the build area from either GRACE / dragonfly server.--> |
|
415 <target name="ido-update-build-area" depends="backup-subst-drives,ido-update-build-area-grace" unless="env.HLM_SUBCON"> |
|
416 <runtarget target="ido-update-build-area-dragonfly"/> |
|
417 </target> |
|
418 |
|
419 <!-- Creates the build area by getting the contents from GRACE release.--> |
|
420 <target name="ido-update-build-area-grace" if="s60.getenv.update" depends="ido-check-latest-release" unless="use.dragonfly"> |
|
421 <!-- We must update the build area so let's get rid of the old one. --> |
|
422 <hlm:unsubst drive="${build.drive}" failonerror="false"/> |
|
423 |
|
424 <!-- Just get S60 for IDOs --> |
|
425 <echo>Location of the new S60 release:${s60.getenv.path}</echo> |
|
426 <tstamp> |
|
427 <format property="getenv.tstamp" pattern="yyyyMMddHHmmss"/> |
|
428 </tstamp> |
|
429 <antcall target="init-drive"> |
|
430 <param name="prep.build.dir" location="${prep.root.dir}/${getenv.tstamp}_${s60.getenv.release}"/> |
|
431 </antcall> |
|
432 <antcall target="preparation-getenv"> |
|
433 <param name="base_release.path" value="${s60.getenv.path}"/> |
|
434 </antcall> |
|
435 <antcall target="ido-prep-variant"/> |
|
436 |
|
437 <if> |
|
438 <not> |
|
439 <hlm:hasSeverity severity="error" file="${build.cache.log.dir}/${build.id}_getenv.log.xml" /> |
|
440 </not> |
|
441 <then> |
|
442 <hlm:python> |
|
443 from path import path |
|
444 print "Writing version file...." |
|
445 vfile = path(r'${build.drive}'+"/").joinpath('s60_version.txt') |
|
446 f = open(str(vfile), 'w') |
|
447 f.write(path(r'${s60.getenv.path}').name) |
|
448 f.close() |
|
449 </hlm:python> |
|
450 </then> |
|
451 </if> |
|
452 </target> |
|
453 |
|
454 <!-- Gets the Contents for particular variant, by unpacking the variant zip from the metadata file.--> |
|
455 <target name="ido-prep-variant" if="ido.variant"> |
|
456 <script language="jython" setbeans="false"> |
|
457 import re |
|
458 import os |
|
459 import symrec |
|
460 from com.nokia.ant.util import Helper |
|
461 rel_path = Helper.getProperty(project, 's60.getenv.path') |
|
462 metadata = symrec.find_latest_metadata(str(rel_path)) |
|
463 self.log(str("Release metadata file: %s." % metadata)) |
|
464 rel_metadata = symrec.ReleaseMetadata(metadata) |
|
465 variant_pkg = rel_metadata.getVariantPackage(project.getProperty('ido.variant')) |
|
466 project.setProperty('ido.variant.package', os.path.join(rel_path, variant_pkg)) |
|
467 </script> |
|
468 <unzip src="${ido.variant.package}" dest="${build.drive}${env.EPOCROOT}"/> |
|
469 </target> |
|
470 |
|
471 |
|
472 <!-- This target will help CI tool to trigger a build by updating a 's60.getenv.trigger.location' file timestamp. --> |
|
473 <target name="ido-latest-release-trigger" if="s60.getenv.update" depends="ido-check-latest-release"> |
|
474 <if> |
|
475 <isset property="s60.getenv.trigger.location"/> |
|
476 <then> |
|
477 <echo>Touching the trigger.</echo> |
|
478 <touch file="${s60.getenv.trigger.location}"/> |
|
479 </then> |
|
480 <else> |
|
481 <echo>Property s60.getenv.trigger.location is not defined, trigger will not get updated.</echo> |
|
482 </else> |
|
483 </if> |
|
484 </target> |
|
485 |
|
486 <!-- Convert keys of an ini file into a path structure. |
|
487 e.g: <pre><hlm:iniKeys2Path ini="${ado.mapping.file}" pathid="ado.src.path"/></pre> |
|
488 |
|
489 Usage example: |
|
490 <pre> |
|
491 <target name="test-iniKeys2Path" depends="ido-create-ado-mapping"> |
|
492 <hlm:iniKeys2Path ini="${ado.mapping.file}" pathid="ado.src.path"/> |
|
493 <hlm:codescanner dest="${build.drive}/codescanner"> |
|
494 <path refid="ado.src.path"/> |
|
495 </hlm:codescanner> |
|
496 </target> |
|
497 </pre> |
|
498 --> |
|
499 <scriptdef name="iniKeys2Path" language="beanshell" uri="http://www.nokia.com/helium"> |
|
500 <attribute name="ini"/> |
|
501 <attribute name="pathid"/> |
|
502 if (attributes.get("ini") == null) |
|
503 throw new org.apache.tools.ant.BuildException("ini is not defined"); |
|
504 if (attributes.get("pathid") == null) |
|
505 throw new org.apache.tools.ant.BuildException("pathid is not defined"); |
|
506 try { |
|
507 java.io.FileInputStream pin = new java.io.FileInputStream(attributes.get("ini")); |
|
508 java.util.Properties props = new java.util.Properties(); |
|
509 props.load(pin); |
|
510 org.apache.tools.ant.types.Path path = project.createDataType("path"); |
|
511 for (java.util.Iterator i = props.stringPropertyNames().iterator(); i.hasNext() ; ) { |
|
512 org.apache.tools.ant.types.Path.PathElement pe = (org.apache.tools.ant.types.Path.PathElement)path.createPathElement(); |
|
513 pe.setPath(i.next()); |
|
514 } |
|
515 self.log("Creating reference: " + attributes.get("pathid")); |
|
516 project.addReference(attributes.get("pathid"), path); |
|
517 } catch (Exception e) { |
|
518 throw new org.apache.tools.ant.BuildException(e); |
|
519 } |
|
520 </scriptdef> |
|
521 |
|
522 <!-- Target to get the Substituted drives information--> |
|
523 <target name="backup-subst-drives"> |
|
524 <exec dir="${cache.dir}" executable="subst.exe" osfamily="windows" output="${cache.dir}\hlmsubsteddrives.bat" failonerror="false"/> |
|
525 <trycatch property="backup-subst-drives.exception"> |
|
526 <try> |
|
527 <if> |
|
528 <available file="${cache.dir}/hlmsubsteddrives.bat" type="file"/> |
|
529 <then> |
|
530 <replaceregexp file="${cache.dir}\hlmsubsteddrives.bat" match="\\: => " replace=" " flags="g" byline="true"/> |
|
531 <replaceregexp file="${cache.dir}\hlmsubsteddrives.bat" match="\A" replace="subst.exe " byline="true"/> |
|
532 <replaceregexp file="${cache.dir}\hlmsubsteddrives.bat" match="UNC" replace="\\\\" byline="true"/> |
|
533 </then> |
|
534 </if> |
|
535 </try> |
|
536 <catch> |
|
537 <echo>${backup-subst-drives.exception}</echo> |
|
538 </catch> |
|
539 </trycatch> |
|
540 </target> |
|
541 |
|
542 <import file="ci.ant.xml"/> |
|
543 </project> |
|
544 |
|
545 |
|
546 |
|
547 |