Newer
Older
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="common-modules" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:mcr="antlib:org.mycore.buildtools">
<!-- =================================================================== -->
<!-- Changeable properties -->
<!-- =================================================================== -->
<property name="app.name" value="philae" />
<property name="java.maxmemory" value="1024m" />
<property name="dptbase-common.jar" value="dptbase-common-2023.06-SNAPSHOT.jar" />
<property name="dptbase-agent.jar" value="dptbase-agent-2023.06-SNAPSHOT.jar" />
<property name="mycore-base.jar" value="mycore-base-2023.02-SNAPSHOT.jar" />
<property name="jetty.start.port" value="8961"/>
<property name="jetty.stop.port" value="8962"/>
<property name="jetty.debug.port" value="8964"/>
<property environment="env" />
<property name="stage-one" value="${env.PHILAE_HOME}" />
<!-- =================================================================== -->
<!-- check ant version -->
<!-- =================================================================== -->
<condition property="ant1.10">
<available classname="org.apache.tools.ant.taskdefs.condition.AntVersion" />
</condition>
<fail unless="ant1.10">
<![CDATA[
Ant too old.
Sorry your ant version is too old. You need at least "Ant 1.10.12".
You have: ${ant.version}
]]>
</fail>
<!-- =================================================================== -->
<!-- detecting OS -->
<!-- =================================================================== -->
<condition property="detected.os" value="unix">
<os family="unix" />
</condition>
<condition property="os.is.unix">
<os family="unix" />
</condition>
<!-- =================================================================== -->
<!-- Global properties -->
<!-- =================================================================== -->
<property name="debug" value="on" />
<property name="optimize" value="on" />
<property name="deprecation" value="off" />
<property name="javatarget" value="17" />
<property name="sourcerelease" value="17" />
<property name="sourceencoding" value="UTF-8" />
<property name="stage-one.config" value="${stage-one}/config" />
<property name="stage-one.modules" value="${stage-one}/modules" />
<property name="build" value="${stage-one}/build" />
<property name="build.cli" value="${build}/cli" />
<property name="build.cli.bin" value="${build}/cli/bin" />
<property name="build.cli.classes" value="${build}/cli/classes" />
<property name="build.cli.config" value="${build}/cli/config" />
<property name="build.cli.lib" value="${build}/cli/lib" />
<property name="build.cli.schema" value="${build}/cli/schema" />
<property name="build.cli.xsl" value="${build}/cli/xsl" />
<property name="build.config" value="${build}/config" />
<property name="build.content" value="${build}/content" />
<property name="build.webapps" value="${build}/webapps" />
<!-- =================================================================== -->
<!-- Initalization for ANT -->
<!-- =================================================================== -->
<target name="init">
<path id="build.classpath">
<pathelement location="${build.cli.classes}" />
<pathelement location="${build.cli.config}" />
<pathelement location="${build.cli.schema}" />
<pathelement location="${build.cli.xsl}" />
<fileset dir="${build.cli.lib}" includes="*.jar" />
</path>
<property file="${stage-one.config}/mycore.private.properties" />
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${build.cli.lib}"/>
</classpath>
</taskdef>
<taskdef resource="org/mycore/buildtools/antlib.xml" uri="antlib:org.mycore.buildtools">
<classpath>
<fileset dir="${build.cli.lib}"/>
</classpath>
</taskdef>
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpathref="build.classpath" />
<pathconvert targetos="${detected.os}" property="build.classpath.translated" refid="build.classpath" />
</target>
<!-- =================================================================== -->
<!-- hook definition for stage-one and stage-two -->
<!-- =================================================================== -->
<macrodef name="modulePreHook">
<attribute name="target" />
<sequential>
<echo level="verbose">pre module Hook: @{target}</echo>
<for list="${MCR.Modules.StageOne}" param="module" parallel="false">
<sequential>
<echo level="verbose">check module: @{module}</echo>
<for param="build.file" parallel="false">
<fileset dir="." includes="modules/@{module}/build.xml">
<containsregexp expression="\u003ctarget.*name=\u0022pre.@{target}\u0022" />
</fileset>
<sequential>
<echo level="verbose">running module: @{build.file}</echo>
<java fork="true" classname="org.apache.tools.ant.Main" classpath="${java.class.path}" failonerror="true">
<arg value="-Dant.home=${ant.home}" />
<arg value="-Dant.library.dir=${ant.library.dir}" />
<arg value="-f" />
<arg value="@{build.file}" />
<arg value="pre.@{target}" />
</java>
</sequential>
</for>
</sequential>
</for>
</sequential>
</macrodef>
<macrodef name="moduleHook">
<attribute name="target" />
<sequential>
<echo level="verbose">module Hook: @{target}</echo>
<for list="${MCR.Modules.StageOne}" param="module" parallel="false">
<sequential>
<echo level="verbose">check module: @{module}</echo>
<for param="build.file" parallel="false">
<fileset dir="." includes="modules/@{module}/build.xml">
<containsregexp expression="\u003ctarget.*name=\u0022@{target}\u0022" />
</fileset>
<sequential>
<echo level="verbose">running module: @{build.file}</echo>
<java fork="true" classname="org.apache.tools.ant.Main" classpath="${java.class.path}" failonerror="true">
<arg value="-Dant.home=${ant.home}" />
<arg value="-Dant.library.dir=${ant.library.dir}" />
<arg value="-f" />
<arg value="@{build.file}" />
<arg value="@{target}" />
</java>
</sequential>
</for>
</sequential>
</for>
</sequential>
</macrodef>
<!-- =================================================================== -->
<!-- Initalization for ANT -->
<!-- =================================================================== -->
<target name="initold">
<path id="build.classpath">
<pathelement location="${build.cli.classes}" />
<pathelement location="${build.cli.config}" />
<pathelement location="${build.cli.schema}" />
<pathelement location="${build.cli.xsl}" />
<fileset dir="${build.cli.lib}" includes="*.jar" />
</path>
<property resource="config/mycore.properties" classpathref="build.classpath" />
<path id="script.classpath">
<pathelement location="${build.cli.classes}" />
<pathelement location="${build.cli.config}" />
<pathelement location="${build.cli.lib}" />
</path>
<taskdef resource="net/sf/antcontrib/antlib.xml" onerror="ignore" classpathref="build.classpath" />
<taskdef resource="org/mycore/buildtools/antlib.xml" uri="antlib:org.mycore.buildtools" classpathref="build.classpath"
onerror="fail" />
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpathref="build.classpath" />
<pathconvert targetos="${detected.os}" property="build.classpath.translated" refid="build.classpath" />
<pathconvert targetos="${detected.os}" property="script.classpath.translated" refid="script.classpath" />
</target>
<!-- System CLASSPATH is completely ignored! -->
<property name="build.sysclasspath" value="ignore" />
<!-- =================================================================== -->
<!-- merge the web.xml from core with web.xml of the module -->
<!-- =================================================================== -->
<target name="do.merge" if="web.xml.present">
<xmltask source="${build.webapps}/WEB-INF/web.xml" dest="${build.webapps}/WEB-INF/web.xml">
<insert path="/:web-app/:absolute-ordering" position="after" file="${web.xml.file}" />
</xmltask>
<replace file="${build.webapps}/WEB-INF/web.xml" token='xmlns=""' />
</target>
<!-- =================================================================== -->
<!-- merge module_messages.properties with the message.properties file -->
<!-- in stage-one/config -->
<!-- =================================================================== -->
<target name="messages.merge">
<echo level="info">parameter: ${locale_param} </echo>
<echo level="info">Source path: ${module}</echo>
<echo level="info">Dest path: ${build.webapps}/WEB-INF/classes/messages_${locale_param}.properties</echo>
<echo file="${build.cli.config}/messages_${locale_param}.properties" append="true">
<![CDATA[#Source: ${module}
]]>
</echo>
<concat destfile="${build.cli.config}/messages_${locale_param}.properties" append="true">
<fileset file="${module}" />
</concat>
</target>
<!-- =================================================================== -->
<!-- build schema files from configuration -->
<!-- =================================================================== -->
<target name="datamodel2schema" depends="init">
<basename file="${metadata.schema}" property="baseSchemaName" suffix=".xml" />
<condition property="prefixName" value="datamodel-">
<not>
<contains string="${baseSchemaName}" substring="datamodel-" />
</not>
</condition>
<condition property="prefixName" value="">
<contains string="${baseSchemaName}" substring="datamodel-" />
</condition>
<echo level="info">Transforming ${metadata.schema}...</echo>
<xslt basedir="${build.cli.config}" classpathref="build.classpath" in="${metadata.schema}" style="${build.cli.xsl}/datamodel2schema.xsl" out="${build.cli.schema}/${prefixName}${baseSchemaName}.xsd" />
</target>
<!-- =================================================================== -->
<!-- Invokes the MyCoRe Command Line Interface with a given command -->
<!-- =================================================================== -->
<target name="invoke.cli" depends="init">
<java classname="org.mycore.frontend.cli.MCRCommandLineInterface" dir="${cli.directory}" fork="yes"
maxmemory="${java.maxmemory}" classpathref="build.classpath" failonerror="true">
<arg line="${cli.command}" />
<env key="LIBPATH" value="${env.LIBPATH}" />
<env key="LD_LIBRARY_PATH" value="${env.LD_LIBRARY_PATH}" />
</java>
</target>
</project>