forked from AFaust/alfresco-form-model-management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.xml
279 lines (246 loc) · 13.5 KB
/
macros.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
271
272
273
274
275
276
277
278
279
<project name="macros">
<!-- **************************************************************************** -->
<!-- ** This file contains the macro definitions used by the main build script ** -->
<!-- **************************************************************************** -->
<macrodef name="clean" description="Cleans the given project">
<attribute name="projectdir" />
<sequential>
<delete includeEmptyDirs="true" quiet="yes" dir="@{projectdir}/${dir.name.build}/${dir.name.classes}" />
<delete includeEmptyDirs="true" quiet="yes" dir="@{projectdir}/${dir.name.build}/${dir.name.dist}" />
<delete includeEmptyDirs="true" quiet="yes" dir="@{projectdir}/${dir.name.build}/${dir.name.lib}" />
<delete includeEmptyDirs="true" quiet="yes" dir="@{projectdir}/${dir.name.build}/${dir.name.assemble}" />
<delete includeEmptyDirs="true" quiet="yes" dir="@{projectdir}/${dir.name.build}/${dir.name.test.results}" />
<delete includeEmptyDirs="true" quiet="yes" dir="@{projectdir}/${dir.name.build}/${dir.name.docs}" />
</sequential>
</macrodef>
<macrodef name="compile-java" description="Compiles Java source files in the given project">
<attribute name="projectdir" />
<attribute name="compileExcludes" default="" />
<sequential>
<mkdir dir="@{projectdir}/${dir.name.build}/${dir.name.classes}" />
<javac destdir="@{projectdir}/${dir.name.build}/${dir.name.classes}" fork="true"
memoryMaximumSize="${mem.size.max}" deprecation="${javac.deprecation}"
debug="${javac.debug}" target="${javac.target}" source="${javac.source}" encoding="${javac.encoding}"
excludes="@{compileExcludes}" >
<src path="@{projectdir}/${dir.name.source}/${dir.name.java}" />
<classpath refid="classpath.compile" />
<!-- To run javac with Xlint:unchecked, uncomment the line below -->
<!-- <compilerarg value="-Xlint:unchecked"/> -->
</javac>
<copy todir="@{projectdir}/${dir.name.build}/${dir.name.classes}">
<fileset dir="@{projectdir}/${dir.name.source}/${dir.name.java}">
<patternset>
<exclude name="**/*.java" />
<exclude name="log4j.properties" />
</patternset>
</fileset>
</copy>
</sequential>
</macrodef>
<macrodef name="compile-java-inc-generated"
description="Compiles Java source files and generated Java files in the given project">
<attribute name="projectdir" />
<sequential>
<mkdir dir="@{projectdir}/${dir.name.build}/${dir.name.classes}" />
<javac destdir="@{projectdir}/${dir.name.build}/${dir.name.classes}" fork="true"
memoryMaximumSize="${mem.size.max}" deprecation="${javac.deprecation}"
debug="${javac.debug}" target="${javac.target}" source="${javac.source}" encoding="${javac.encoding}">
<src path="@{projectdir}/${dir.name.source}/${dir.name.java}" />
<src path="@{projectdir}/${dir.name.source}/${dir.name.generated}" />
<classpath refid="classpath.compile" />
</javac>
<copy todir="@{projectdir}/${dir.name.build}/${dir.name.classes}">
<fileset dir="@{projectdir}/${dir.name.source}/${dir.name.java}">
<patternset>
<exclude name="**/*.java" />
<exclude name="log4j.properties" />
</patternset>
</fileset>
</copy>
</sequential>
</macrodef>
<macrodef name="generate-javadocs">
<attribute name="projectdir" />
<attribute name="documenttitle" />
<attribute name="windowtitle" />
<sequential>
<mkdir dir="@{projectdir}/${dir.name.build}/${dir.name.docs}/${dir.name.java}" />
<javadoc maxmemory="${mem.size.max}" author="true" version="true"
sourcepath="@{projectdir}/${dir.name.source}/${dir.name.java}"
destdir="@{projectdir}/${dir.name.build}/${dir.name.docs}/${dir.name.java}"
packagenames="${javadoc.packages.include}"
excludepackagenames="${javadoc.packages.exclude}"
bottom="${javadoc.copyright}"
doctitle="@{documenttitle}"
windowtitle="@{windowtitle}"
classpathref="classpath.javadoc">
<!-- doclet that hides public classes/members via @exclude -->
<doclet name="ExcludeDoclet" path="${dir.project.3rdparty.lib}/${dir.name.devenv}/exclude-doclet.jar"/>
</javadoc>
</sequential>
</macrodef>
<macrodef name="generate-generated-javadocs">
<attribute name="projectdir" />
<attribute name="documenttitle" />
<attribute name="windowtitle" />
<sequential>
<mkdir dir="@{projectdir}/${dir.name.build}/${dir.name.docs}/${dir.name.java}" />
<javadoc maxmemory="${mem.size.max}" author="true" version="true"
sourcepath="@{projectdir}/${dir.name.source}/${dir.name.generated}"
destdir="@{projectdir}/${dir.name.build}/${dir.name.docs}/${dir.name.java}"
packagenames="${javadoc.packages.include}"
excludepackagenames="${javadoc.packages.exclude}"
bottom="${javadoc.copyright}"
doctitle="@{documenttitle}"
windowtitle="@{windowtitle}"
classpathref="classpath.javadoc">
<!-- doclet that hides public classes/members via @exclude -->
<doclet name="ExcludeDoclet" path="${dir.project.3rdparty.lib}/${dir.name.devenv}/exclude-doclet.jar"/>
</javadoc>
</sequential>
</macrodef>
<macrodef name="run-tests" description="Runs the tests for the given project">
<attribute name="projectdir" />
<sequential>
<mkdir dir="@{projectdir}/${dir.name.build}/${dir.name.test.results}" />
<junit printsummary="yes" fork="yes" maxmemory="${mem.size.max}" haltonfailure="yes" dir="@{projectdir}">
<jvmarg value="-server"/>
<classpath refid="classpath.unit.test" />
<formatter type="xml" />
<batchtest todir="@{projectdir}/${dir.name.build}/${dir.name.test.results}">
<fileset dir="@{projectdir}/${dir.name.source}/${dir.name.java}">
<patternset refid="files.tests" />
</fileset>
</batchtest>
</junit>
</sequential>
</macrodef>
<macrodef name="deploy-virtual-tomcat"
description="Deploys the files required for the virtualisation server to the given location">
<attribute name="location" />
<sequential>
<copy todir="@{location}/server/lib" file="${dir.project.3rdparty.lib}/spring-2.0.2.jar"/>
<copy todir="@{location}/server/lib" file="${dir.project.3rdparty.lib}/hibernate-3.2.1-patched.jar"/>
<copy todir="@{location}/server/lib" file="${dir.project.catalinavirtual.dist}/${file.name.jar.catalinavirtual}"/>
<copy todir="@{location}/common/lib" file="${dir.project.jndi.dist}/${file.name.jar.jndi}"/>
<copy todir="@{location}/common/lib" file="${dir.project.repository.dist}/${file.name.jar.repository}"/>
<copy todir="@{location}/common/lib" file="${dir.project.core.dist}/${file.name.jar.core}"/>
<copy todir="@{location}/conf" file="${dir.project.repository.config}/alfresco/alfresco-shared.properties"/>
<copy todir="@{location}/conf" file="${dir.project.repository.config}/alfresco/alfresco-jmxrmi.password"/>
<copy todir="@{location}/conf" file="${dir.project.repository.config}/alfresco/alfresco-jmxrmi.access"/>
<copy todir="@{location}/conf" file="${dir.project.jndi.config}/alfresco-virtserver-context.xml"/>
<copy todir="@{location}/conf" file="${dir.project.jndi.config}/alfresco-virtserver.properties"/>
<copy todir="@{location}/conf" file="${dir.project.catalinavirtual.config}/server.xml" overwrite="yes"/>
<copy todir="@{location}/conf" file="${dir.project.catalinavirtual.config}/web.xml" overwrite="yes"/>
</sequential>
</macrodef>
<macrodef name="install-amp" description="Installs an AMP file into the given WAR file">
<attribute name="ampfile" />
<attribute name="warfile" />
<sequential>
<java dir="." fork="true" classname="org.alfresco.repo.module.tool.ModuleManagementTool">
<classpath refid="classpath.compile"/>
<arg line="install @{ampfile} @{warfile} -force -verbose -nobackup"/>
</java>
</sequential>
</macrodef>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wrapper that brings the Alfresco webapp and the virtualization
server up (if they weren't already up) to execute the Ant target
specified by the 'target' parameter. After the command has
completed, both servers are stopped if this wrappper was
responsible for starting them (otherwise, they're left up).
Example:
<target name="moo">
<alfresco-virtual-antcall target="_moo"/>
</target>
<target name="_moo">
<echo>Alfresco webapp + virtual tomcat are both up</echo>
</target>
This makes it easy to run tests that need both servers when you're
you're doing iterative development work & don't want to wait for
heavy processes to start/stop every time... yet it accommodates the
need to automatically start/stop servers when in a "clean" test
environment (all it assumes is that both servers are installed).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<macrodef name="alfresco-virtual-antcall">
<attribute name="target"/>
<sequential>
<default-if-not-set propname ="tomcat.home"
propvalue="${env.TOMCAT_HOME}"/>
<default-if-not-set propname ="virtual.tomcat.home"
propvalue="${env.VIRTUAL_TOMCAT_HOME}"/>
<check-server-status propname="virtual.tomcat.previously.started"
server ="localhost"
port ="8180"/>
<check-server-status propname="tomcat.previously.started"
server ="localhost"
port ="8080"/>
<parallel>
<antcall target="start-tomcat-if-necessary"/>
<antcall target="start-virtual-tomcat-if-necessary"/>
<sequential>
<echo>Waiting for Alfresco Tomcat...</echo>
<antcall target="wait-for-alfresco"/>
<echo>Alfresco's Tomcat is up</echo>
<echo>Waiting for Virtual Tomcat...</echo>
<antcall target="wait-for-virtual-tomcat"/>
<echo>Virtual Tomcat is up</echo>
<antcall target="@{target}"/>
<antcall target="virtual-tomcat-stop-if-necessary"/>
<antcall target="tomcat-stop-if-necessary"/>
</sequential>
</parallel>
</sequential>
</macrodef>
<macrodef name="default-if-not-set">
<attribute name="propname"/>
<attribute name="propvalue"/>
<sequential>
<condition property= "@{propname}" value="@{propvalue}">
<not> <isset property="@{propname}"/> </not>
</condition>
</sequential>
</macrodef>
<macrodef name="check-server-status">
<attribute name="propname"/>
<attribute name="server"/>
<attribute name="port"/>
<sequential>
<condition property="@{propname}">
<socket server="@{server}" port="@{port}"/>
</condition>
</sequential>
</macrodef>
<macrodef name="tomcat-start">
<attribute name="heapmax" default="-Xmx512M"/>
<sequential>
<echo>Starting Alfresco Tomcat: ${tomcat.home}</echo>
<java jar="${tomcat.home}/bin/bootstrap.jar"
fork="true">
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
<jvmarg value="-Dcatalina.base=${tomcat.home}"/>
<jvmarg value="-server"/>
<jvmarg value="@{heapmax}"/>
<jvmarg value="-Djava.io.tmpdir=${tomcat.home}/temp"/>
<jvmarg value="-Djava.security.policy=${tomcat.home}/conf/catalina.policy"/>
</java>
</sequential>
</macrodef>
<macrodef name="virtual-tomcat-start">
<attribute name="heapmax" default="-Xmx512M"/>
<sequential>
<antcall target="wait-for-alfresco"/>
<echo>Starting Virtual Tomcat: ${virtual.tomcat.home}</echo>
<java jar="${virtual.tomcat.home}/bin/bootstrap.jar"
fork="true">
<jvmarg value="-Dcatalina.home=${virtual.tomcat.home}"/>
<jvmarg value="-Dcatalina.base=${virtual.tomcat.home}"/>
<jvmarg value="-server"/>
<jvmarg value="@{heapmax}"/>
<jvmarg value="-Djava.io.tmpdir=${virtual.tomcat.home}/temp"/>
<jvmarg value="-Djava.security.policy=${virtual.tomcat.home}/conf/catalina.policy"/>
</java>
</sequential>
</macrodef>
</project>