-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathbuild-configuration.xml
More file actions
127 lines (116 loc) · 3.92 KB
/
build-configuration.xml
File metadata and controls
127 lines (116 loc) · 3.92 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<project name="TopCoder Configuration Scripts" basedir="." default="update_properties">
<property file="build.properties"/>
<path id="svnant.lib" >
<fileset dir="${basedir}/tools/svnant" includes="*.jar" />
</path>
<!-- subversion tasks -->
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.lib"/>
<!-- ant contrib tasks (if, then)-->
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<!-- base svn path to checkout *.properties files -->
<property name="base_url" value="https://coder.topcoder.com/internal/app_configs/database" />
<!-- directory to checkout *.properties files -->
<property name="prop_dir" value="properties" />
<!-- supported environments -->
<property name="env_vm" value="vm" />
<property name="env_ci" value="ci" />
<target name="update_properties">
<if>
<not>
<isset property="env"/>
</not>
<then>
<fail>You must specify target environemt by adding -Denv=some_env. Supported environments:${env_vm}, ${env_ci}</fail>
</then>
<else>
<if>
<not>
<or>
<equals arg1="${env}" arg2="${env_vm}" />
<equals arg1="${env}" arg2="${env_ci}" />
</or>
</not>
<then>
<fail>Unsupported environment</fail>
</then>
<else>
<checkout_properties url="${base_url}/${env}" />
<copy todir="${basedir}" overwrite="true" >
<fileset dir="${prop_dir}">
<include name="**/*.properties" />
<include name="**/*.xml" />
</fileset>
</copy>
</else>
</if>
</else>
</if>
</target>
<!-- this macro synchronizes properties directory with svn repository and copies *.properties to proper locations. -->
<macrodef name="checkout_properties" >
<attribute name="url" />
<sequential>
<if>
<available file="${prop_dir}"/>
<then>
<svnex>
<info target="${prop_dir}" />
</svnex>
<if>
<not>
<equals arg1="${svn.info.url}" arg2="@{url}"/>
</not>
<then>
<echo message="-------------------- Switching to url: @{url}"/>
<svnex>
<switch path="${prop_dir}" url="@{url}" />
</svnex>
</then>
<else>
<echo message="-------------------- Updating: @{url}"/>
<svnex>
<update dir="${prop_dir}" />
</svnex>
</else>
</if>
</then>
<!-- if not checkout the project -->
<else>
<echo message="-------------------- Checking out: ${prop_dir}"/>
<svnex>
<checkout destPath="${prop_dir}" url="@{url}" />
</svnex>
</else>
</if>
</sequential>
</macrodef>
<!-- This tasks execute svn operations against cached credentials,
or prompt for password if svn.username property is set. -->
<macrodef name="svnex">
<!-- the operations to be performed via subversion -->
<element name="operation" implicit="true"/>
<sequential>
<if>
<isset property="svn.username"/>
<then>
<if>
<not>
<isset property="svn.password"/>
</not>
<then>
<input addproperty="svn.password" message="Please enter svn password: "/>
</then>
</if>
<svn javahl="false" username="${svn.username}" password="${svn.password}">
<operation />
</svn>
</then>
<else>
<svn javahl="false">
<operation />
</svn>
</else>
</if>
</sequential>
</macrodef>
</project>