-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
270 lines (237 loc) · 12.9 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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<?xml version="1.0" encoding="utf-8"?>
<project name="poema" default="replace">
<description>
</description>
<property name="vendor" value="exponentus.com" />
<!-- Application path -->
<property name="application.dir" value="/home/aida/tmp/testsemantyca" />
<!-- Temporary folder path -->
<property name="tmp.dir" value="tmp" />
<!-- Directory for backup -->
<property name="backup.dir" value="backup" />
<!-- source folders -->
<property name="app_temp_repo.dir" value="." />
<property name="nb_repo.dir" value="${app_temp_repo.dir}/nb/trunk" />
<property name="officeframe_repo.dir" value="${app_temp_repo.dir}/officeframe/trunk" />
<property name="poema_repo.dir" value="${app_temp_repo.dir}/poema/trunk" />
<!-- application folders -->
<property name="application_libs.dir" value="${application.dir}/libs" />
<property name="application_rule.dir" value="${application.dir}/rule" />
<property name="application_webapps.dir" value="${application.dir}/webapps" />
<property name="application_xsl.dir" value="${application.dir}/xsl" />
<property name="application_resources.dir" value="${application.dir}/resources" />
<!-- NextBase core source -->
<property name="app_nb_jar.name" value="nb" />
<property name="nb_prj.dir" value="${nb_repo.dir}" />
<property name="src_nb.dir" value="${nb_prj.dir}/src" />
<property name="libs_nb.dir" value="${nb_prj.dir}/libs" />
<property name="rule_nb.dir" value="${nb_prj.dir}/rule" />
<property name="webapps_nb.dir" value="${nb_prj.dir}/webapps" />
<property name="xsl_nb.dir" value="${nb_prj.dir}/xsl" />
<property name="administrator_src.dir" value="${nb_prj.dir}/rule/Administrator/Resources/scripts" />
<property name="jpa_xml_nb.dir" value="${src_nb.dir}" />
<!-- Officeframe module source -->
<property name="app_officeframe_jar.name" value="officeframe" />
<property name="officeframe_prj.dir" value="${officeframe_repo.dir}" />
<property name="resources_officeframe.dir" value="${officeframe_prj.dir}/resources" />
<property name="rule_officeframe.dir" value="${officeframe_prj.dir}/rule" />
<property name="webapps_officeframe.dir" value="${officeframe_prj.dir}/webapps" />
<property name="reference_src.dir" value="${officeframe_prj.dir}/rule/Reference/Resources/scripts" />
<property name="staff_src.dir" value="${officeframe_prj.dir}/rule/Staff/Resources/scripts" />
<property name="workspace_src.dir" value="${officeframe_prj.dir}/rule/Workspace/Resources/scripts" />
<property name="discussing_src.dir" value="${officeframe_prj.dir}/rule/Discussing/Resources/scripts" />
<property name="jpa_xml_officeframe.dir" value="${officeframe_prj.dir}/src" />
<!-- Poema module source -->
<property name="app_poema_jar.name" value="poema" />
<property name="poema_prj.dir" value="${poema_repo.dir}" />
<property name="resources_poema.dir" value="${poema_prj.dir}/resources" />
<property name="rule_poema.dir" value="${poema_prj.dir}/rule" />
<property name="webapps_poema.dir" value="${poema_prj.dir}/webapps" />
<property name="poema_src.dir" value="${poema_prj.dir}/rule/Projects/Resources/scripts" />
<property name="workflow_src.dir" value="${poema_prj.dir}/rule/Workflow/Resources/scripts"/>
<property name="helpdesk_src.dir" value="${poema_prj.dir}/rule/HelpDesk/Resources/scripts"/>
<property name="jpa_xml_poema.dir" value="${poema_prj.dir}/src" />
<!-- temporary compiled class folders -->
<property name="tmp_rule.dir" value="${tmp.dir}/rule" />
<property name="tmp_webapps.dir" value="${tmp.dir}/webapps" />
<property name="tmp_classes_nb.dir" value="${tmp.dir}/nb/classes" />
<property name="tmp_jar_nb.dir" value="${tmp.dir}/nb/jar" />
<property name="tmp_classes_officeframe.dir" value="${tmp.dir}/officeframe/classes" />
<property name="tmp_jar_officeframe.dir" value="${tmp.dir}/officeframe/jar" />
<property name="tmp_classes_poema.dir" value="${tmp.dir}/poema/classes" />
<property name="tmp_jar_poema.dir" value="${tmp.dir}/poema/jar" />
<!-- compiler options -->
<property name="includeantruntime" value="false" />
<property name="compile.debug" value="true" />
<property name="compile.deprecation" value="false" />
<property name="compile.optimize" value="true" />
<path id="compile_nb.classpath">
<fileset dir="${libs_nb.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<path id="compile_officeframe.classpath">
<fileset dir="${libs_nb.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${tmp_jar_nb.dir}">
<include name="nb.jar" />
</fileset>
</path>
<path id="compile_poema.classpath">
<fileset dir="${libs_nb.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${tmp_jar_nb.dir}">
<include name="nb.jar" />
</fileset>
<fileset dir="${tmp_jar_officeframe.dir}">
<include name="officeframe.jar" />
</fileset>
</path>
<target name="backup" description="Backup settings of the application">
<echo>Making backup original settings files</echo>
<copy overwrite="true" failonerror="false" file="${application.dir}/resources/config.properties" tofile="${backup.dir}/config.properties" />
<copy overwrite="true" failonerror="false" file="${application.dir}/cfg.xml" tofile="${backup.dir}/cfg.xml" />
</target>
<target name="clean" description="Delete generated and temporary directories and files">
<echo>Cleaning application and temporary directories</echo>
<delete quiet="true" dir="${application.dir}" />
<delete quiet="true" dir="${tmp.dir}" />
<!--<delete quiet="true" dir="${app_temp_repo.dir}" />-->
<!--<delete quiet="true" dir="${nb_repo.dir}" />
<delete quiet="true" dir="${officeframe_repo.dir}" />
<delete quiet="true" dir="${poema_repo.dir}" />-->
<property name="nb_repo.dir" value="${app_temp_repo.dir}/nb" />
<property name="officeframe_repo.dir" value="${app_temp_repo.dir}/officeframe" />
<property name="poema_repo.dir" value="${app_temp_repo.dir}/poema" />
</target>
<target name="prepare" description="Create directories and files before compile">
<echo>Prepare the directories</echo>
<mkdir dir="${application.dir}" />
<mkdir dir="${tmp.dir}" />
<mkdir dir="${tmp_classes_nb.dir}" />
<mkdir dir="${tmp_jar_nb.dir}" />
<mkdir dir="${tmp_classes_officeframe.dir}" />
<mkdir dir="${tmp_jar_officeframe.dir}" />
<mkdir dir="${tmp_classes_poema.dir}" />
<mkdir dir="${tmp_jar_poema.dir}" />
</target>
<path id="svnant.classpath">
<fileset dir="/usr/share/ant/lib1">
<include name="**/*.jar" />
</fileset>
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />
<svnSetting svnkit="true" javahl="false" username="" password="" failonerror="true" id="svn.settings" />
<target name="get_from_repo" description="Getting from the repository">
<echo>Check out from GitHub</echo>
<svn refid="svn.settings">
<checkout url="https://github.com/exponentus/nb" revision="HEAD" destPath="${app_temp_repo.dir}/nb" />
<checkout url="https://github.com/exponentus/officeframe" revision="HEAD" destPath="${app_temp_repo.dir}/officeframe" />
<checkout url="https://github.com/exponentus/poema" revision="HEAD" destPath="${app_temp_repo.dir}/poema" />
</svn>
</target>
<target name="compile_nb" depends="backup, clean, prepare, get_from_repo" unless="full" description="Compile Java sources">
<echo>Compiling NextBase core</echo>
<javac srcdir="${src_nb.dir}:${administrator_src.dir}" destdir="${tmp_classes_nb.dir}" debug="${compile.debug}" nowarn="true" deprecation="${compile.deprecation}" optimize="${compile.optimize}" includeantruntime="${includeantruntime}" >
<classpath refid="compile_nb.classpath" />
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xlint:deprecation" />
</javac>
<copy file="${src_nb.dir}/log4j.xml" tofile="${tmp_classes_nb.dir}/log4j.xml" />
<copy overwrite="true" file="${nb_prj.dir}/src/com/exponentus/server/console_commands.txt" tofile="${tmp_classes_nb.dir}/com/exponentus/server/console_commands.txt" />
<tstamp>
<format property="TODAY" pattern="HH:mm d-MMMM-yyyy" locale="en,RU" />
</tstamp>
<pathconvert property="manifest_nb.classpath" pathsep=" " refid="compile_nb.classpath">
<map from='/var/lib/jenkins/jobs/poema/workspace/${libs_nb.dir}/' to='' />
</pathconvert>
<jar destfile="${tmp_jar_nb.dir}/${app_nb_jar.name}.jar">
<fileset dir="${tmp_classes_nb.dir}" />
<manifest>
<attribute name="Implementation-Vendor" value="${vendor}"/>
<attribute name="Built-Date" value="${TODAY}" />
<attribute name="Main-Class" value="com.exponentus.server.Server" />
<attribute name="Class-Path" value="${manifest_nb.classpath} ${app_nb_jar.name}.jar ${app_officeframe_jar.name}.jar ${app_poema_jar.name}.jar" />
</manifest>
</jar>
</target>
<target name="compile_officeframe" depends="compile_nb" description="Create JAR distribution">
<echo>Compiling Officeframe modules</echo>
<javac srcdir="${reference_src.dir}:
${staff_src.dir}:${workspace_src.dir}:${discussing_src.dir}" destdir="${tmp_classes_officeframe.dir}" nowarn="true" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" includeantruntime="${includeantruntime}">
<classpath refid="compile_officeframe.classpath" />
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xlint:deprecation" />
</javac>
<jar destfile="${tmp_jar_officeframe.dir}/${app_officeframe_jar.name}.jar">
<fileset dir="${tmp_classes_officeframe.dir}" />
<manifest>
<attribute name="Built-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
<target name="compile_poema" depends="compile_officeframe" description="Create JAR distribution">
<echo>Compiling poema modules </echo>
<javac srcdir="${poema_src.dir}:${workflow_src.dir}:${helpdesk_src.dir}" destdir="${tmp_classes_poema.dir}" debug="${compile.debug}" nowarn="true" deprecation="${compile.deprecation}" optimize="${compile.optimize}" includeantruntime="${includeantruntime}" >
<classpath refid="compile_poema.classpath" />
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xlint:deprecation" />
<compilerarg value="-XDignore.symbol.file"/>
</javac>
<tstamp>
<format property="TODAY" pattern="HH:mm d-MMMM-yyyy" locale="en,RU" />
</tstamp>
<copy file="${jpa_xml_poema.dir}/META-INF/persistence.xml" tofile="${tmp_classes_poema.dir}/META-INF/persistence.xml" />
<copy file="${jpa_xml_poema.dir}/META-INF/orm.xml" tofile="${tmp_classes_poema.dir}/META-INF/orm.xml" />
<jar destfile="${tmp_jar_poema.dir}/${app_poema_jar.name}.jar">
<fileset dir="${tmp_classes_poema.dir}" />
<manifest>
<attribute name="Built-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
<target name="replace" depends="compile_poema" description="Update of the work system">
<echo>Copying application program files</echo>
<copy overwrite="true" todir="${tmp_rule.dir}">
<fileset dir="${rule_nb.dir}" />
<fileset dir="${rule_officeframe.dir}" />
<fileset dir="${rule_poema.dir}" />
</copy>
<copy overwrite="true" todir="${tmp_webapps.dir}">
<fileset dir="${webapps_nb.dir}" />
<fileset dir="${webapps_officeframe.dir}" />
<fileset dir="${webapps_poema.dir}" />
</copy>
<sync todir="${application_libs.dir}">
<fileset dir="${libs_nb.dir}" />
</sync>
<sync todir="${application_xsl.dir}">
<fileset dir="${xsl_nb.dir}" />
</sync>
<sync todir="${application_rule.dir}">
<fileset dir="${tmp_rule.dir}" casesensitive="yes">
<exclude name="**/*.java" />
</fileset>
</sync>
<sync todir="${application_webapps.dir}">
<fileset dir="${tmp_webapps.dir}" />
</sync>
<sync todir="${application_resources.dir}">
<fileset dir="${resources_poema.dir}" />
</sync>
<echo>Copying application jar files</echo>
<copy overwrite="true" file="${tmp_jar_nb.dir}/${app_nb_jar.name}.jar" tofile="${application.dir}/libs/${app_nb_jar.name}.jar" />
<copy overwrite="true" file="${tmp_jar_officeframe.dir}/${app_officeframe_jar.name}.jar" tofile="${application.dir}/libs/${app_officeframe_jar.name}.jar"/>
<copy overwrite="true" file="${tmp_jar_poema.dir}/${app_poema_jar.name}.jar" tofile="${application.dir}/libs/${app_poema_jar.name}.jar"/>
<echo>Restore original settings files</echo>
<copy overwrite="true" failonerror="false" file="${backup.dir}/config.properties" tofile="${application.dir}/resources/config.properties" />
<copy overwrite="true" failonerror="false" file="${backup.dir}/cfg.xml" tofile="${application.dir}/cfg.xml" />
<echo>Copying additional files</echo>
<copy overwrite="true" file="${nb_prj.dir}/start.bat" tofile="${application.dir}/start.bat" />
<copy overwrite="true" file="${nb_prj.dir}/start.sh" tofile="${application.dir}/start.sh" />
<copy overwrite="true" file="${nb_prj.dir}/tcnative-1.dll" tofile="${application.dir}/tcnative-1.dll" />
<copy overwrite="true" file="${nb_prj.dir}/ip-to-country.bin" tofile="${application.dir}/ip-to-country.bin" />
</target>
</project>