This repository has been archived by the owner on Aug 26, 2023. It is now read-only.
forked from liferay/liferay-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-common.xml
247 lines (212 loc) · 7.09 KB
/
build-common.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
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="build-common">
<dirname file="${ant.file.build-common}" property="sdk.dir" />
<property environment="env" />
<path id="lib.classpath">
<fileset dir="${sdk.dir}/lib" includes="*.jar" />
</path>
<taskdef classpathref="lib.classpath" resource="net/sf/antcontrib/antlib.xml" />
<taskdef classpathref="lib.classpath" resource="ise/antelope/tasks/antlib.xml" uri="antlib:ise.antelope.tasks" />
<property file="${sdk.dir}/build.${user.name}.properties" />
<property file="${sdk.dir}/build.${env.COMPUTERNAME}.properties" />
<property file="${sdk.dir}/build.${env.HOST}.properties" />
<property file="${sdk.dir}/build.${env.HOSTNAME}.properties" />
<if>
<isset property="app.server.dir" />
<then>
<if>
<isset property="app.server.type" />
<then>
<propertycopy from="app.server.dir" name="app.server.${app.server.type}.dir" />
</then>
<else>
<propertycopy from="app.server.dir" name="app.server.tomcat.dir" />
</else>
</if>
</then>
</if>
<property file="${sdk.dir}/build.properties" />
<propertycopy from="app.server.${app.server.type}.dir" name="app.server.dir" />
<propertycopy from="app.server.${app.server.type}.deploy.dir" name="app.server.deploy.dir" />
<propertycopy from="app.server.${app.server.type}.lib.global.dir" name="app.server.lib.global.dir" />
<propertycopy from="app.server.${app.server.type}.portal.dir" name="app.server.portal.dir" />
<propertycopy from="app.server.${app.server.type}.zip.name" name="app.server.zip.name" silent="true" />
<property name="app.server.classes.portal.dir" value="${app.server.portal.dir}/WEB-INF/classes" />
<property location="${app.server.portal.dir}/WEB-INF/lib" name="app.server.lib.portal.dir" />
<import file="build-common-ivy.xml" />
<path id="plugin.classpath">
<path refid="plugin-lib.classpath" />
<fileset dir="${app.server.lib.global.dir}" includes="*.jar" />
<fileset dir="${app.server.lib.portal.dir}" includes="annotations.jar,commons-logging.jar,log4j.jar,util-bridges.jar,util-java.jar,util-taglib.jar" />
<fileset dir="${sdk.dir}/lib" includes="activation.jar,javax.servlet-api.jar,jsp-api.jar,mail.jar" />
</path>
<path id="portal.classpath">
<pathelement location="${app.server.classes.portal.dir}" />
<fileset dir="${app.server.lib.global.dir}" includes="*.jar" />
<fileset dir="${app.server.lib.portal.dir}" includes="*.jar" />
<fileset dir="${sdk.dir}/lib" includes="activation.jar,jargs.jar,javax.servlet-api.jar,jsp-api.jar,qdox.jar" />
</path>
<path id="test.classpath">
<path refid="plugin.classpath" />
<fileset dir="${app.server.lib.portal.dir}" excludes="ant.jar" includes="*.jar" />
<fileset dir="${sdk.dir}/lib" includes="junit.jar,mockito-all.jar,powermock-*.jar,spring-test.jar" />
<pathelement location="test-classes/integration" />
<pathelement location="test-classes/unit" />
</path>
<condition property="correct.ant.version">
<antversion atleast="1.7.0" />
</condition>
<if>
<not>
<equals arg1="${correct.ant.version}" arg2="true" />
</not>
<then>
<fail>Please use Ant 1.7.0 or above.</fail>
</then>
</if>
<whichresource resource="/org/eclipse/jdt/core/JDTCompilerAdapter.class" property="ecj.compiler" />
<if>
<and>
<equals arg1="${javac.compiler}" arg2="org.eclipse.jdt.core.JDTCompilerAdapter" />
<not>
<isset property="ecj.compiler" />
</not>
</and>
<then>
<copy file="${sdk.dir}/lib/ecj.jar" todir="${ant.home}/lib" />
<fail>
.
Task cannot continue because ECJ is not installed.
ECJ was automatically installed. Please rerun your task.
</fail>
</then>
</if>
<target name="compile-java">
<copy todir="${javac.destdir}">
<fileset dir="${javac.srcdir}" excludes="**/*.java" />
</copy>
<javac
classpathref="${javac.classpathref}"
compiler="${javac.compiler}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${javac.destdir}"
encoding="${javac.encoding}"
includeAntRuntime="false"
nowarn="${javac.nowarn}"
srcdir="${javac.srcdir}"
/>
</target>
<target name="create">
<if>
<or>
<not>
<isset property="plugin.type" />
</not>
</or>
<then>
<fail>This task must be called by the create script.</fail>
</then>
</if>
<if>
<or>
<equals arg1="${plugin.type}" arg2="hook" />
<equals arg1="${plugin.type}" arg2="portlet" />
<equals arg1="${plugin.type}" arg2="theme" />
</or>
<then>
<subant target="create">
<fileset dir="${sdk.dir}/${plugin.type}s" includes="build.xml" />
</subant>
</then>
<else>
<subant target="create">
<fileset dir="${sdk.dir}/${plugin.type}" includes="build.xml" />
</subant>
</else>
</if>
</target>
<target name="format-javadoc">
<java
classname="com.liferay.portal.tools.JavadocFormatter"
classpathref="portal.classpath"
fork="true"
newenvironment="true"
>
<jvmarg value="-Xmx512m" />
<arg value="javadoc.init=${init}" />
<arg value="javadoc.input.dir=${input.dir}" />
<arg value="javadoc.limit=${limit}" />
<arg value="javadoc.output.file.prefix=${output.file.prefix}" />
<arg value="javadoc.update=${update}" />
</java>
</target>
<target name="format-source">
<java
classname="com.liferay.portal.tools.sourceformatter.SourceFormatter"
classpathref="portal.classpath"
fork="true"
newenvironment="true"
>
<jvmarg value="-Xmx512m" />
<jvmarg value="-Xss2048k" />
</java>
<delete file="ServiceBuilder.temp" />
</target>
<target name="print-current-time">
<tstamp>
<format property="current.time" pattern="MMMM d, yyyy 'at' hh:mm aa" />
</tstamp>
<echo message="${current.time}" />
</target>
<target name="setup-eclipse">
<java
classname="com.liferay.portal.tools.PluginsEnvironmentBuilder"
classpathref="portal.classpath"
fork="true"
newenvironment="true"
>
<jvmarg value="-Dplugins.env.dir=." />
</java>
</target>
<target name="setup-jrebel">
<property name="jrebel.plugin.classes.dir" value="${basedir}/${plugin.classes.dir}" />
<echo file="${jrebel.plugin.classes.dir}/rebel.xml"><![CDATA[<?xml version="1.0"?>
<application
xmlns="http://www.zeroturnaround.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zeroturnaround.com http://www.zeroturnaround.com/alderaan/rebel-2_0.xsd"
>
<classpath>
<dir name="${jrebel.plugin.classes.dir}" />
</classpath>
</application>]]></echo>
<if>
<available file="docroot" type="dir" />
<then>
<replace file="${jrebel.plugin.classes.dir}/rebel.xml">
<replacetoken><![CDATA[</application>]]></replacetoken>
<replacevalue expandProperties="true"><![CDATA[ <web>
<link target="/${plugin.name}">
<dir name="${basedir}/docroot" />
</link>
</web>
</application>]]></replacevalue>
</replace>
</then>
</if>
</target>
<target name="sort-xml-attributes">
<java
classname="com.liferay.portal.tools.XMLAttributesSorter"
classpathref="portal.classpath"
fork="true"
newenvironment="true"
>
<jvmarg value="-Xmx512m" />
<jvmarg value="-Xss2048k" />
<arg value="sort.xml.file.name=${sort.xml.file.name}" />
</java>
</target>
</project>