-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.xml
More file actions
109 lines (89 loc) · 4.71 KB
/
build.xml
File metadata and controls
109 lines (89 loc) · 4.71 KB
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
<?xml version="1.0"?>
<project name="main" xmlns="antlib:org.apache.tools.ant" basedir="." default="setup" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="antcc/main.xml" />
<!-- standard header start -->
<dirname file="${ant.file.main}" property="project.dir" />
<property name="build.dir" location="${project.dir}/build" />
<property name="install.dir" location="/opt/softwareag" />
<property environment="env" />
<target name="_localinit" depends=""></target>
<target name="_localclean" depends="sagenv.clean">
</target>
<target name="setup" depends="setup_noclean, _localclean" />
<target name="setup_noclean" depends="waitForTargetNodeUp,templateApply" />
<target name="setup_withccestart" depends="startcc,setup" />
<target name="templateApply" description="Apply $CC_TEMPLATE" depends="waitcc,_localinit" >
<property name="template.path" value="templates/${env.CC_TEMPLATE}" />
<antcall target="sagenv.apply">
<param name="t" value="${template.path}"/>
</antcall>
</target>
<target name="waitForTargetNodeUp" description="Wait for target node up" depends="_localinit">
<!-- if host defined -->
<set-property-if-nonempty name="socketcheck.target.host" if-property-isset="env.SOCKET_CHECK_TARGET_HOST" />
<set-property-if-nonempty name="socketcheck.target.port" if-property-isset="env.SOCKET_CHECK_TARGET_PORT" />
<!-- check target host connectivity -->
<antcall target="_waitForSocketConnect">
<param name="wait.host" value="${socketcheck.target.host}" if:set="socketcheck.target.host" />
<param name="wait.port" value="${socketcheck.target.port}" if:set="socketcheck.target.port"/>
</antcall>
<!-- if host2 defined -->
<set-property-if-nonempty name="socketcheck.target.host2" if-property-isset="env.SOCKET_CHECK_TARGET_HOST2" />
<set-property-if-nonempty name="socketcheck.target.port2" if-property-isset="env.SOCKET_CHECK_TARGET_PORT2" />
<!-- check target host connectivity -->
<antcall target="_waitForSocketConnect">
<param name="wait.host" value="${socketcheck.target.host2}" if:set="socketcheck.target.host2" />
<param name="wait.port" value="${socketcheck.target.port2}" if:set="socketcheck.target.port2"/>
</antcall>
<!-- if host3 defined -->
<set-property-if-nonempty name="socketcheck.target.host3" if-property-isset="env.SOCKET_CHECK_TARGET_HOST3" />
<set-property-if-nonempty name="socketcheck.target.port3" if-property-isset="env.SOCKET_CHECK_TARGET_PORT3" />
<!-- check target host connectivity -->
<antcall target="_waitForSocketConnect">
<param name="wait.host" value="${socketcheck.target.host3}" if:set="socketcheck.target.host3" />
<param name="wait.port" value="${socketcheck.target.port3}" if:set="socketcheck.target.port3"/>
</antcall>
</target>
<target name="_waitForSocketConnect" description="Wait for socker host:port is accessible">
<condition property="wait.enabled">
<and>
<isset property="wait.host" />
<isset property="wait.port" />
</and>
</condition>
<property name="wait.enabled" value="false"/>
<echo message="Checking connectivity to ${wait.host}:${wait.port}" if:true="${wait.enabled}"/>
<waitfor maxwait="600" maxwaitunit="second" checkevery="5" checkeveryunit="second" if:true="${wait.enabled}">
<socket server="${wait.host}" port="${wait.port}"/>
</waitfor>
</target>
<target name="_tryRandom">
<randomint max="100000000" property="random_prop" />
<echo message="my random number: ${random_prop}" />
</target>
<macrodef name="set-property-if-nonempty">
<attribute name="name" />
<attribute name="if-property-isset" />
<attribute name="value" default="${@{if-property-isset}}" />
<sequential>
<condition property="@{name}" value="@{value}">
<and>
<isset property="@{if-property-isset}" />
<not>
<equals arg1="${@{if-property-isset}}" arg2="" />
</not>
</and>
</condition>
</sequential>
</macrodef>
<scriptdef language="javascript" name="randomint">
<attribute name="max" />
<attribute name="property" />
<![CDATA[
project.setProperty(attributes.get("property"), getRandomInt(attributes.get("max")));
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
]]>
</scriptdef>
</project>