-
Notifications
You must be signed in to change notification settings - Fork 11
/
git-build.xml
50 lines (46 loc) · 1.42 KB
/
git-build.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
<project name="Ant Build Script with Git Support">
<macrodef name="git">
<attribute name="command" />
<attribute name="options" default="" />
<attribute name="dir" default="" />
<attribute name="failerror" default="false" />
<element name="args" optional="true" />
<sequential>
<echo message="git dir @{dir}" />
<echo message="git @{command}" />
<exec executable="git" dir="@{dir}" failonerror="@{failerror}">
<arg line="@{command} @{options}" />
<args />
</exec>
</sequential>
</macrodef>
<macrodef name="git-checkout-local">
<attribute name="branch" />
<attribute name="dir" />
<attribute name="options" default="" />
<attribute name="failerror" default="false" />
<sequential>
<git command="checkout" dir="@{dir}" options="@{options}" failerror="@{failerror}" >
<args>
<arg value="@{branch}" />
</args>
</git>
<waitfor maxwait="15" maxwaitunit="second" timeoutproperty="build.timeout">
<resourcecontains resource=".git/HEAD" substring="@{branch}" />
</waitfor>
</sequential>
</macrodef>
<macrodef name="git-tag">
<attribute name="tagName" />
<attribute name="dir" />
<attribute name="options" default="-f" />
<attribute name="failerror" default="false" />
<sequential>
<git command="tag" dir="@{dir}" options="@{options}" failerror="@{failerror}" >
<args>
<arg value="@{tagName}" />
</args>
</git>
</sequential>
</macrodef>
</project>