-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbootstrap.xml
157 lines (141 loc) · 5.86 KB
/
bootstrap.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?xml version="1.0" encoding="UTF-8"?>
<project name="SF-BOOTSTRAP" default="bootstrap" xmlns:hlm="http://www.nokia.com/helium">
<property environment="env"/>
<dirname property="sf.bootstrap.dir" file="${ant.file.SF-CONFIG}"/>
<property name="build.drive" value="Setting this property stops helium reporting that it will use the Z: drive when it won't."/>
<import file="${helium.dir}/helium.ant.xml" />
<!-- target dir -->
<property name="bootstrap.base.dir" value="D:\fbf_project"/> <!-- old name -->
<property name="sf.target.dir" value="${bootstrap.base.dir}"/>
<!-- config -->
<property name="sf.config.repo" value=""/>
<property name="sf.config.rev" value="default"/>
<property name="sf.config.dir" value=""/>
<!-- project -->
<property name="sf.project.repo" value=""/>
<property name="sf.project.rev" value="default"/>
<property name="sf.project.dir" value=""/>
<!-- Sanity check the supplied properties -->
<fail message="Must specify property sf.config.repo or sf.config.dir">
<condition>
<and>
<equals arg1="${sf.config.repo}" arg2=""/>
<equals arg1="${sf.config.dir}" arg2=""/>
</and>
</condition>
</fail>
<fail message="Must specify property sf.project.repo or sf.project.dir">
<condition>
<and>
<equals arg1="${sf.project.repo}" arg2=""/>
<equals arg1="${sf.project.dir}" arg2=""/>
</and>
</condition>
</fail>
<target name="bootstrap" depends="init,get-sf-config,get-sf-project" description="Target for executing the bootstrap">
<stopwatch name="bootstrap" action="elapsed"/>
</target>
<target name="init">
<stopwatch name="bootstrap"/>
<mkdir dir="${sf.target.dir}" />
<mkdir dir="${sf.target.dir}/build" />
<echo message="config: repo=${sf.config.repo} rev=${sf.config.rev}"/>
<echo message="project: repo=${sf.project.repo} rev=${sf.project.rev}"/>
</target>
<target name="clean-env">
<echo message="cleaning up the environment" />
<delete dir="${sf.target.dir}/" />
</target>
<target name="get-sf-config">
<antcall target="get-repo">
<param name="stopwatch.name" value="get-sf-config"/>
<param name="subdir.name" value="sf-config"/>
<param name="repo.dir" value="${sf.config.dir}"/>
<param name="repo.url" value="${sf.config.repo}"/>
<param name="repo.rev" value="${sf.config.rev}"/>
</antcall>
</target>
<target name="get-sf-project">
<antcall target="get-repo">
<param name="stopwatch.name" value="get-sf-project"/>
<param name="subdir.name" value="build/config"/>
<param name="repo.dir" value="${sf.project.dir}"/>
<param name="repo.url" value="${sf.project.repo}"/>
<param name="repo.rev" value="${sf.project.rev}"/>
</antcall>
</target>
<target name="get-repo">
<stopwatch name="${stopwatch.name}"/>
<if>
<not>
<equals arg1="${repo.dir}" arg2=""/>
</not>
<then>
<echo message="Getting FBF configuration from dir ${repo.dir}"/>
<copy todir="${sf.target.dir}/${subdir.name}">
<fileset dir="${repo.dir}"/>
</copy>
</then>
<else>
<echo message="Getting ${repo.url}"/>
<if>
<available file="${sf.target.dir}/${subdir.name}/.hg" type="dir"/>
<then>
<echo message="Updating ${sf.target.dir}/${subdir.name}"/>
<exec executable="hg" dir="${sf.target.dir}/${subdir.name}">
<arg value="pull"/>
<arg value="${repo.url}"/>
</exec>
<exec executable="hg" dir="${sf.target.dir}/${subdir.name}">
<arg value="up"/>
<arg value="${repo.rev}"/>
<arg value="-C"/>
</exec>
</then>
<else>
<echo message="Cloning ${repo.url}#${repo.rev} to ${sf.target.dir}/${subdir.name}"/>
<trycatch>
<try>
<exec failonerror="true" executable="hg" dir="${sf.target.dir}">
<arg value="clone"/>
<arg value="-r${repo.rev}"/>
<arg value="${repo.url}"/>
<arg value="${subdir.name}"/>
</exec>
</try>
<catch>
<echo message="Clone failed, retry in 120 seconds"/>
<sleep seconds="120"/>
<delete dir="${sf.target.dir}/${subdir.name}" quiet="true"/>
<echo message="Cloning ${repo.url}#${repo.rev} to ${sf.target.dir}/${subdir.name}"/>
<trycatch>
<try>
<exec failonerror="true" executable="hg" dir="${sf.target.dir}">
<arg value="clone"/>
<arg value="-r${repo.rev}"/>
<arg value="${repo.url}"/>
<arg value="${subdir.name}"/>
</exec>
</try>
<catch>
<echo message="Clone failed, retry in 120 seconds"/>
<sleep seconds="120"/>
<delete dir="${sf.target.dir}/${subdir.name}" quiet="true"/>
<echo message="Cloning ${repo.url}#${repo.rev} to ${sf.target.dir}/${subdir.name}"/>
<exec failonerror="true" executable="hg" dir="${sf.target.dir}">
<arg value="clone"/>
<arg value="-r${repo.rev}"/>
<arg value="${repo.url}"/>
<arg value="${subdir.name}"/>
</exec>
</catch>
</trycatch>
</catch>
</trycatch>
</else>
</if>
</else>
</if>
<stopwatch name="${stopwatch.name}" action="elapsed"/>
</target>
</project>