-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbuild.xml
248 lines (210 loc) · 13.4 KB
/
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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<?xml version="1.0"?>
<project name="Database Setup" basedir=".">
<property file="build.properties" />
<path id="svnant.lib" >
<fileset dir="${basedir}/tools/svnant" includes="*.jar" />
</path>
<!-- include ant contrib tasks -->
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<!-- include svn tasks -->
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.lib" />
<!-- EXECUTION TAGS -->
<property name="debug" value="off" />
<property name="verbose" value="no" />
<property name="connfile" value="connfile.sql" />
<property name="locale" value="en_us.utf8" />
<macrodef name="dbaccess">
<attribute name="file"/>
<attribute name="outfile" />
<attribute name="append" />
<attribute name="failonerror" default="${stoponerror}" />
<sequential>
<mkdir dir="logs"/>
<echo message="Processing file @{file}" />
<exec executable="${DBACCESS}"
output="logs/@{outfile}"
append="@{append}"
failonerror="@{failonerror}">
<env key="INFORMIXSERVER" value="${INFORMIXSERVER}"/>
<env key="DB_LOCALE" value="${locale}"/>
<env key="CLIENT_LOCALE" value="${locale}"/>
<env key="INFORMIXDIR" value="${INFORMIXDIR}"/>
<env key="INFORMIXSQLHOSTS" value="${INFORMIXSQLHOSTS}"/>
<arg line="- connfile.sql @{file}" />
</exec>
</sequential>
</macrodef>
<macrodef name="updatetextcolumn">
<attribute name="database"/>
<attribute name="subdir" default="query_tool" />
<attribute name="updatelists" default="queries.txt" />
<attribute name="outfile" />
<attribute name="append" />
<attribute name="failonerror" default="true" />
<sequential>
<echo message="Update text column from file @{database}/@{subdir}/@{updatelists}" />
<java classname="com.topcoder.tools.UpdateTextColumn"
dir="@{database}/@{subdir}"
fork="true"
output="logs/@{outfile}" append="@{append}"
failonerror="@{failonerror}">
<arg line="F jdbc:informix-sqli://${database.server}:${database.port}/@{database}:informixserver=${INFORMIXSERVER};user=${database.username};password=${database.password};DB_LOCALE=${locale};CLIENT_LOCALE=${locale} @{updatelists}"/>
<classpath>
<fileset file="tools/UpdateTextColumn/ifxjdbc.jar"/>
<fileset file="tools/UpdateTextColumn/UpdateTextColumn1.3.jar"/>
</classpath>
</java>
</sequential>
</macrodef>
<macrodef name="downsizeDDL">
<attribute name="database"/>
<attribute name="file"/>
<sequential>
<echo message="Downsizing DDL file @{file}" />
<mkdir dir="downsized_scripts/@{database}"/>
<copy todir="downsized_scripts/@{database}" overwrite="true">
<fileset file="@{file}" />
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
<param type="negate" value="true"/>
<param type="regexp" value="extent size*"/>
</filterreader>
</filterchain>
</copy>
</sequential>
</macrodef>
<target name="tokenize" >
<copy file="${connfile}.example" tofile="${connfile}" />
<replace file="${connfile}" replacefilterfile="build.properties"/>
</target>
<!-- Builds db schema - Loads script to create database -->
<target name="setup_db" depends="update_scripts, tokenize">
<delete dir="logs" />
<!-- create common_oltp -->
<echo message="Creating database common_oltp" />
<downsizeDDL file="common_oltp/01_common_oltp_main_schema.sql" database="common_oltp" />
<dbaccess file="downsized_scripts/common_oltp/01_common_oltp_main_schema.sql" outfile="common_oltp.log" append="false" />
<dbaccess file="common_oltp/02_common_oltp_data_setup.sql" outfile="common_oltp.log" append="true" />
<dbaccess file="common_oltp/03_common_oltp_constraints_and_indexes.sql" outfile="common_oltp.log" append="true" />
<dbaccess file="common_oltp/04_common_oltp_synonyms_procedures_and_triggers.sql" outfile="common_oltp.log" append="true" />
<dbaccess file="common_oltp/05_common_oltp_test_data.sql" outfile="common_oltp.log" append="true" />
<!-- create time_oltp -->
<echo message="Creating database time_oltp" />
<downsizeDDL file="time_oltp/01_time_oltp_main_schema.sql" database="time_oltp" />
<dbaccess file="downsized_scripts/time_oltp/01_time_oltp_main_schema.sql" outfile="time_oltp.log" append="false" />
<dbaccess file="time_oltp/02_time_oltp_data_setup.sql" outfile="time_oltp.log" append="true" />
<dbaccess file="time_oltp/03_time_oltp_constraints_and_indexes.sql" outfile="time_oltp.log" append="true" />
<dbaccess file="time_oltp/04_time_oltp_synonyms_procedures_and_triggers.sql" outfile="time_oltp.log" append="true" />
<dbaccess file="time_oltp/05_time_oltp_test_data.sql" outfile="time_oltp.log" append="true" />
<!-- create corporate_oltp -->
<echo message="Creating database corporate_oltp" />
<downsizeDDL file="corporate_oltp/01_corporate_oltp_main_schema.sql" database="corporate_oltp" />
<dbaccess file="downsized_scripts/corporate_oltp/01_corporate_oltp_main_schema.sql" outfile="corporate_oltp.log" append="false"/>
<dbaccess file="corporate_oltp/02_corporate_oltp_data_setup.sql" outfile="corporate_oltp.log" append="true" />
<dbaccess file="corporate_oltp/03_corporate_oltp_constraints_and_indexes.sql" outfile="corporate_oltp.log" append="true" />
<dbaccess file="corporate_oltp/04_corporate_oltp_synonyms_procedures_and_triggers.sql" outfile="corporate_oltp.log" append="true" />
<!-- started creating jive -->
<echo message="Creating database jive" />
<downsizeDDL file="jive/01_jive_main_schema.sql" database="jive" />
<dbaccess file="downsized_scripts/jive/01_jive_main_schema.sql" outfile="jive.log" append="false" />
<dbaccess file="jive/02_jive_data_setup.sql" outfile="jive.log" append="true" />
<dbaccess file="jive/03_jive_constraints_and_indexes.sql" outfile="jive.log" append="true" />
<!-- started creating studio jive -->
<echo message="Creating database studio jive" />
<downsizeDDL file="studio_jive/01_studio_jive_main_schema.sql" database="studio_jive" />
<dbaccess file="downsized_scripts/studio_jive/01_studio_jive_main_schema.sql" outfile="studio_jive.log" append="false" />
<!-- create tcs_catalog. Must be called before informixoltp is created. -->
<echo message="Creating database tcs_catalog" />
<downsizeDDL file="tcs_catalog/01_tcs_catalog_main_schema.sql" database="tcs_catalog" />
<dbaccess file="downsized_scripts/tcs_catalog/01_tcs_catalog_main_schema.sql" outfile="tcs_catalog.log" append="false" />
<dbaccess file="tcs_catalog/02_tcs_catalog_data_setup.sql" outfile="tcs_catalog.log" append="true" />
<updatetextcolumn database="tcs_catalog" outfile="tcs_catalog.log" append="true" />
<dbaccess file="tcs_catalog/03_tcs_catalog_constraints_and_indexes.sql" outfile="tcs_catalog.log" append="true" />
<!-- create informixoltp -->
<echo message="Creating database informixoltp" />
<downsizeDDL file="informixoltp/01_informixoltp_main_schema.sql" database="informixoltp" />
<dbaccess file="downsized_scripts/informixoltp/01_informixoltp_main_schema.sql" outfile="informixoltp.log" append="false" />
<dbaccess file="informixoltp/02_informixoltp_data_setup.sql" outfile="informixoltp.log" append="true" />
<updatetextcolumn database="informixoltp" outfile="informixoltp.log" append="true" />
<dbaccess file="informixoltp/03_informixoltp_constraints_and_indexes.sql" outfile="informixoltp.log" append="true" />
<dbaccess file="informixoltp/04_informixoltp_synonyms_procedures_and_triggers.sql" outfile="informixoltp.log" append="true" />
<dbaccess file="informixoltp/05_informixoltp_test_data.sql" outfile="informixoltp.log" append="true" />
<updatetextcolumn database="informixoltp" subdir="problem_presetup" updatelists="problem_presetups.txt" outfile="informixoltp.log" append="true" />
<updatetextcolumn database="informixoltp" subdir="contest_presetup" updatelists="contest_presetups.txt" outfile="informixoltp.log" append="true" />
<!-- complete setup tcs_catalog -->
<dbaccess file="tcs_catalog/04_tcs_catalog_synonyms_procedures_and_triggers.sql" outfile="tcs_catalog.log" append="true" />
<dbaccess file="tcs_catalog/05_tcs_catalog_test_data.sql" outfile="tcs_catalog.log" append="true" />
<dbaccess file="tcs_catalog/06_tcs_catalog_test_project_data.sql" outfile="tcs_catalog.log" append="true" />
<!-- create studio_oltp -->
<echo message="Creating database studio_oltp" />
<downsizeDDL file="studio_oltp/01_studio_oltp_main_schema.sql" database="studio_oltp" />
<dbaccess file="downsized_scripts/studio_oltp/01_studio_oltp_main_schema.sql" outfile="studio_oltp.log" append="false" />
<dbaccess file="studio_oltp/02_studio_oltp_data_setup.sql" outfile="studio_oltp.log" append="true" />
<updatetextcolumn database="studio_oltp" outfile="studio_oltp.log" append="true" />
<dbaccess file="studio_oltp/03_studio_oltp_constraints_and_indexes.sql" outfile="studio_oltp.log" append="true" />
<dbaccess file="studio_oltp/04_studio_oltp_synonyms_procedures_and_triggers.sql" outfile="studio_oltp.log" append="true" />
<!-- create common_dw -->
<echo message="Creating database common_dw" />
<downsizeDDL file="common_dw/01_common_dw_main_schema.sql" database="common_dw" />
<dbaccess file="downsized_scripts/common_dw/01_common_dw_main_schema.sql" outfile="common_dw.log" append="false" />
<dbaccess file="common_dw/02_common_dw_data_setup.sql" outfile="common_dw.log" append="true" />
<!-- started creating tcs_dw -->
<echo message="Started creating database tcs_dw" />
<downsizeDDL file="tcs_dw/01_tcs_dw_main_schema.sql" database="tcs_dw" />
<dbaccess file="downsized_scripts/tcs_dw/01_tcs_dw_main_schema.sql" outfile="tcs_dw.log" append="false" />
<!-- create topcoder_dw -->
<echo message="Creating database topcoder_dw" />
<downsizeDDL file="topcoder_dw/01_topcoder_dw_main_schema.sql" database="topcoder_dw" />
<dbaccess file="downsized_scripts/topcoder_dw/01_topcoder_dw_main_schema.sql" outfile="topcoder_dw.log" append="false" />
<dbaccess file="topcoder_dw/02_topcoder_dw_data_setup.sql" outfile="topcoder_dw.log" append="true" />
<updatetextcolumn database="topcoder_dw" outfile="topcoder_dw.log" append="true" />
<dbaccess file="topcoder_dw/03_topcoder_dw_constraints_and_indexes.sql" outfile="topcoder_dw.log" append="true" />
<dbaccess file="topcoder_dw/04_topcoder_dw_synonyms_procedures_and_triggers.sql" outfile="topcoder_dw.log" append="true" />
<!-- completing creating tcs_dw -->
<echo message="Completing creating database tcs_dw" />
<dbaccess file="tcs_dw/02_tcs_dw_data_setup.sql" outfile="tcs_dw.log" append="true" />
<updatetextcolumn database="tcs_dw" outfile="tcs_dw.log" append="true" />
<dbaccess file="tcs_dw/03_tcs_dw_constraints_and_indexes.sql" outfile="tcs_dw.log" append="true" />
<dbaccess file="tcs_dw/04_tcs_dw_synonyms_procedures_and_triggers.sql" outfile="tcs_dw.log" append="true" />
<dbaccess file="tcs_dw/05_tcs_dw_test_data.sql" outfile="tcs_dw.log" append="true" />
<!-- completing creating jive -->
<dbaccess file="jive/04_jive_synonyms_procedures_and_triggers.sql" outfile="jive.log" append="true" />
<dbaccess file="jive/05_jive_test_data.sql" outfile="jive.log" append="true" />
</target>
<!-- Drops db schema -->
<target name="drop_db" if="dropdatabase" depends="tokenize">
<echo message="Dropping all databases" />
<dbaccess file="tools/dropDatabase.sql" outfile="dropDatabase.log" append="false" failonerror="false" />
</target>
<!-- update database scripts -->
<target name="update_scripts" if="svn.update">
<exec executable="svn">
<arg value="update" />
<arg value="--username=${svn.username}" />
<arg value="--password=${svn.password}" />
</exec>
</target>
<!-- Target to automatically stop jboss and reinstall databases. Used for CI mostly -->
<target name="reinstall_db" >
<antcall target="drop_db" />
<antcall target="setup_db" />
</target>
<target name="update_properties" >
<ant antfile="build-configuration.xml" target="update_properties" />
</target>
<target name="query_catalog" description="reload query of tcs_catalog">
<updatetextcolumn database="tcs_catalog" outfile="tcs_catalog.log" append="true" />
</target>
<target name="query_dw" description="reload query of tcs_dw">
<updatetextcolumn database="tcs_dw" outfile="tcs_dw.log" append="true" />
</target>
<target name="query_informixoltp" description="reload query of informixoltp">
<updatetextcolumn database="informixoltp" outfile="informixoltp.log" append="true"/>
</target>
<target name="query_topcoder_dw" description="reload query of topcoder_dw">
<updatetextcolumn database="topcoder_dw" outfile="topcoder_dw.log" append="true"/>
</target>
<target name="problem_presetup" description="problem presetup of informixoltp">
<updatetextcolumn database="informixoltp" subdir="problem_presetup" updatelists="problem_presetups.txt" outfile="informixoltp.log" append="true" />
</target>
</project>