forked from svn2github/fleXive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.macros.xml
209 lines (193 loc) · 10.4 KB
/
build.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
<?xml version="1.0" encoding="UTF-8"?>
<project>
<macrodef name="javac-call" description="Invokes the Java compiler for flexive sources. The classpath can be set with nested classpath elements.">
<attribute name="srcdir"/>
<attribute name="destdir"/>
<attribute name="excludes" default="NONE"/>
<attribute name="includes" default="**/*.java"/>
<element name="args" optional="true" implicit="true"/>
<sequential>
<mkdir dir="@{destdir}"/>
<javac srcdir="@{srcdir}"
destdir="@{destdir}"
debug="${compiler.debug}"
deprecation="${compiler.deprecation}"
optimize="${compiler.optimize}"
includes="@{includes}"
excludes="@{excludes}"
source="${compiler.source}"
target="${compiler.target}"
includeantruntime="false"
fork="${compiler.fork}">
<args/>
</javac>
</sequential>
</macrodef>
<!-- ==================== Some common macros ==================== -->
<macrodef name="replaceBuildProperties" description="Replaces build properties of the current build (subversion number, build user, timestamp) in a text file.">
<attribute name="file" description="The text file to be processed."/>
<attribute name="buildnumber" description="The build number to be inserted"/>
<attribute name="buildtime" description="The build time to be inserted"/>
<sequential>
<replace file="@{file}">
<replacefilter token="@@@build.number@@@" value="@{buildnumber}"/>
<replacefilter token="@@@build.user@@@" value="${user.name}"/>
<replacefilter token="@@@build.date@@@" value="@{buildtime}"/>
</replace>
</sequential>
</macrodef>
<macrodef name="buildScriptIndex">
<attribute name="dir" description="The scripts base directory. Should include subfolders runonce, startup and library."/>
<sequential>
<scriptIndexBuilder indexFile="@{dir}/runonce/scriptindex.flexive" scriptDir="@{dir}/runonce"/>
<scriptIndexBuilder indexFile="@{dir}/library/scriptindex.flexive" scriptDir="@{dir}/library"/>
<scriptIndexBuilder indexFile="@{dir}/startup/scriptindex.flexive" scriptDir="@{dir}/startup"/>
</sequential>
</macrodef>
<!-- ==================== UI plugin/component macros ==================== -->
<macrodef name="buildPluginJar" description="Package a plugin JAR file">
<attribute name="name"/>
<attribute name="srcdir"/>
<attribute name="builddir"/>
<attribute name="jarfile"/>
<element name="jar-elements" optional="true"/>
<sequential>
<makeMessages srcdir="@{srcdir}/resources/messages" dest="@{builddir}/PluginMessages"/>
<copy todir="@{builddir}/component-config/@{name}">
<fileset dir="@{srcdir}/resources" includes="META-INF/**,templates/**/*,flexive-application.properties" excludes="META-INF/resources/**"/>
<fileset dir="@{builddir}" includes="*.properties"/>
<filterset >
<filter token="FLEXIVE_VERSION" value="${flexive.version}"/>
</filterset>
</copy>
<mkdir dir="@{srcdir}/resources/scripts"/> <!-- ensure script exists for zipfileset -->
<jar jarfile="@{jarfile}">
<fileset dir="@{builddir}/component-config/@{name}" includes="**/*"/>
<fileset dir="@{builddir}/classes"/>
<fileset dir="@{srcdir}/resources/weblets" includes="**/*"/>
<fileset dir="@{srcdir}/web" includes="**/*"/>
<zipfileset dir="@{srcdir}/resources/META-INF/resources" prefix="META-INF/resources" includes="**/*"/>
<zipfileset dir="@{srcdir}/resources/scripts" prefix="scripts" includes="**/*"/>
<jar-elements/>
</jar>
</sequential>
</macrodef>
<macrodef name="compilePlugin" description="Compile the plugin sources">
<attribute name="srcdir"/>
<attribute name="builddir"/>
<attribute name="classpathref"/>
<sequential>
<mkdir dir="@{builddir}/classes"/>
<javac-call
srcdir="@{srcdir}/src/java"
destdir="@{builddir}/classes">
<classpath refid="@{classpathref}"/>
</javac-call>
</sequential>
</macrodef>
<macrodef name="buildStorage" description="Compile storage sources and package them">
<attribute name="vendor" description="Name of the vendor"/>
<attribute name="srcdir" description="Base directory of the storage"/>
<attribute name="builddir" description="Directory to generate the artifacts at"/>
<attribute name="classpathref" description="Reference to the [fleXive] classpath"/>
<attribute name="jarfile" description="Resulting jar file"/>
<sequential>
<mkdir dir="@{builddir}/classes"/>
<javac-call
srcdir="@{srcdir}/java"
destdir="@{builddir}/classes">
<classpath refid="@{classpathref}"/>
</javac-call>
<scriptIndexBuilder indexFile="@{builddir}/resources/patch-@{vendor}/resourceindex.flexive"
scriptDir="@{srcdir}/resources/patch"
copyFiles="true"/>
<copy todir="@{builddir}/resources">
<fileset dir="@{srcdir}/resources" includes="**/*" excludes="patch, patch/**/*"/>
</copy>
<scriptIndexBuilder indexFile="@{builddir}/resources/storageindex-@{vendor}.flexive"
scriptDir="@{builddir}/resources"
recursive="true" copyFiles="false"/>
<jar jarfile="@{jarfile}">
<fileset dir="@{builddir}/classes"/>
<zipfileset dir="@{srcdir}/resources" includes="**/*properties"/>
<zipfileset dir="@{builddir}/resources" prefix="resources" includes="**/*"/>
</jar>
</sequential>
</macrodef>
<!-- ========================= Deployment ========================== -->
<macrodef name="deployToJetty" description="Deploy an EAR file to a Jetty installation">
<attribute name="earfile"/>
<attribute name="jettydir"/>
<sequential >
<!-- Clear EJB deployment directory -->
<delete dir="@{jettydir}/lib/ext/flexive"/>
<!-- Unzip EJBs and libraries to lib/ext -->
<unzip dest="@{jettydir}/lib/ext/flexive" overwrite="true" src="@{earfile}">
<patternset>
<include name="lib/**"/>
<include name="*-ejb.jar"/>
<include name="lib/*-ejb.jar"/>
</patternset>
</unzip>
<!-- Install WAR applications to webapps -->
<unzip dest="@{jettydir}/webapps" overwrite="true" src="@{earfile}">
<patternset>
<include name="*.war"/>
</patternset>
</unzip>
<!-- Install JSF runtime -->
<copy todir="@{jettydir}/lib/ext/flexive-environment">
<fileset dir="${dist.basedir}/extlib" includes="jsf-api.jar,jsf-impl.jar,el-api.jar,el-ri.jar"/>
</copy>
</sequential>
</macrodef>
<macrodef name="runJetty" description="Launch Jetty with OpenEJB">
<attribute name="jettydir"/>
<sequential >
<java dir="@{jettydir}" fork="true" jar="@{jettydir}/start.jar">
<!-- Don't force -server because default Java installations may not have the server VM -->
<!--<jvmarg value="-server"/>-->
<jvmarg value="-Xmx200m"/>
<jvmarg value="-Dopenejb.configuration=openejb.conf.xml"/>
</java>
</sequential>
</macrodef>
<macrodef name="createFlatStorage" description="Create a new flat storage table">
<attribute name="jar" description="Path to flatStorageCreator.jar"/>
<attribute name="lib" description="Path to the folder containing the shared flexive libraries (flexive-shared.jar)"/>
<attribute name="extlib" description="Path to external library directory containing the dependencies for FlatStorageCreator.java"/>
<attribute name="connectionUrl" description="The database connection URL"/>
<attribute name="schema" description="Database schema (not applicable to all DB vendors)"/>
<attribute name="tableName" description="Name of the table to be created"/>
<attribute name="overwrite" default="false" description="If an existing table should be overwritten (true or false)"/>
<attribute name="user" description="The database user"/>
<attribute name="password" description="The database password"/>
<attribute name="nstring" default="20" description="Number of STRING columns"/>
<attribute name="ntext" default="10" description="Number of TEXT columns"/>
<attribute name="nbigint" default="10" description="Number of BIGINT columns"/>
<attribute name="ndouble" default="10" description="Number of DOUBLE columns"/>
<attribute name="nselect" default="10" description="Number of SELECT columns"/>
<sequential >
<path id="createFlatStorage.classpath">
<fileset file="@{jar}"/>
<fileset dir="@{extlib}" includes="*.jar"/>
<fileset dir="@{lib}" includes="*.jar"/>
</path>
<java fork="true" classpathref="createFlatStorage.classpath" classname="com.flexive.tools.FlatStorageCreator">
<arg line="-u @{user}"/>
<arg line="--password=@{password}"/>
<arg value="-o"/>
<arg line="-nstring @{nstring}"/>
<arg line="-ntext @{ntext}"/>
<arg line="-nbigint @{nbigint}"/>
<arg line="-ndouble @{ndouble}"/>
<arg line="-nselect @{nselect}"/>
<arg value="@{connectionUrl}"/>
<arg value="@{schema}"/>
<arg value="@{tableName}"/>
<jvmarg value="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger"/>
<jvmarg value="-Dlog4j.configuration=flatStorageLog4j.xml"/>
</java>
</sequential>
</macrodef>
</project>