author | Maciej Seroka <maciejs@symbian.org> |
Wed, 01 Sep 2010 15:03:56 +0100 | |
changeset 1239 | 26eb00e6cbb9 |
parent 977 | 293f16b1c667 |
permissions | -rw-r--r-- |
977
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
1 |
<?xml version="1.0"?> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
2 |
<project name="SF-RETRY" default="all" xmlns:hlm="http://www.nokia.com/helium"> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
3 |
|
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
4 |
<dirname property="sf.retry.dir" file="${ant.file.SF-RETRY}"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
5 |
|
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
6 |
<macrodef name="retry"> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
7 |
<attribute name="tries" default="3" description="How many times to try the nested script"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
8 |
<attribute name="uniquename" description="An identifier specific to this thread, or a constant for single-threaded contexts"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
9 |
<attribute name="failonerror" default="true" description="Set to false to avoid an abort after all attempts"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
10 |
<element name="sequential" description="The tasks to retry"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
11 |
<element name="cleanup" optional="true" description="Tasks to run to clean up after a failed try"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
12 |
<sequential> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
13 |
<trycatch reference="exception.@{uniquename}.ref" property="exception.@{uniquename}.prop"> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
14 |
<try> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
15 |
<sequential/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
16 |
</try> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
17 |
<catch> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
18 |
<math result="newtries.@{uniquename}" operation="-" operand2="@{tries}" operand1="1" datatype="int"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
19 |
<if> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
20 |
<not> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
21 |
<equals arg1="${newtries.@{uniquename}}" arg2="0"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
22 |
</not> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
23 |
<then> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
24 |
<!-- Clean up ready to try again --> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
25 |
<cleanup/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
26 |
<sleep seconds="1"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
27 |
<!-- Recurse (via helper) --> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
28 |
<retry-helper tries="${newtries.@{uniquename}}" uniquename="@{uniquename}" failonerror="@{failonerror}"> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
29 |
<sequence> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
30 |
<sequential/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
31 |
</sequence> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
32 |
<cleanup-helper> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
33 |
<cleanup/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
34 |
</cleanup-helper> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
35 |
</retry-helper> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
36 |
</then> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
37 |
<else> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
38 |
<if> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
39 |
<istrue value="@{failonerror}"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
40 |
<then> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
41 |
<throw refid="exception.@{uniquename}.ref"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
42 |
</then> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
43 |
</if> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
44 |
</else> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
45 |
</if> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
46 |
</catch> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
47 |
</trycatch> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
48 |
</sequential> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
49 |
</macrodef> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
50 |
<macrodef name="retry-helper" description="Don't use this directly, use 'retry'"> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
51 |
<attribute name="tries"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
52 |
<attribute name="uniquename"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
53 |
<attribute name="failonerror"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
54 |
<element name="sequence"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
55 |
<element name="cleanup-helper"/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
56 |
<sequential> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
57 |
<retry tries="@{tries}" uniquename="@{uniquename}" failonerror="@{failonerror}"> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
58 |
<sequential> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
59 |
<sequence/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
60 |
</sequential> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
61 |
<cleanup> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
62 |
<cleanup-helper/> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
63 |
</cleanup> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
64 |
</retry> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
65 |
</sequential> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
66 |
</macrodef> |
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
67 |
|
293f16b1c667
Retry "module" for ant scripts, initially used by source syncing operations.
Simon Howkins <simonh@symbian.org>
parents:
diff
changeset
|
68 |
</project> |