-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
259 lines (221 loc) · 8.72 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
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="portlets" basedir="." default="deploy" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="../build-common-plugins.xml" />
<target name="create">
<if>
<or>
<not>
<isset property="portlet.display.name" />
</not>
<not>
<isset property="portlet.name" />
</not>
</or>
<then>
<fail>This task must be called by the create script.</fail>
</then>
</if>
<property name="portlet.parent.dir" value="${user.dir}" />
<property name="portlet.dir" value="${portlet.parent.dir}/${portlet.name}-portlet" />
<if>
<available file="${portlet.dir}" />
<then>
<fail>${portlet.dir} already exists.</fail>
</then>
</if>
<copy todir="${portlet.dir}">
<fileset
dir="${sdk.dir}/tools/portlet_tmpl"
/>
</copy>
<antelope:stringutil string="${portlet.display.name}" property="portlet.java.class.name">
<antelope:replace regex="\s+" replacement="" />
<antelope:trim />
</antelope:stringutil>
<antelope:stringutil string="${portlet.name}" property="portlet.java.package.name">
<antelope:replace regex="-" replacement="" />
<antelope:trim />
</antelope:stringutil>
<if>
<not>
<or>
<not>
<isset property="portlet.framework" />
</not>
<equals arg1="${portlet.framework}" arg2="" />
<equals arg1="${portlet.framework}" arg2="mvc" />
</or>
</not>
<then>
<if>
<or>
<equals arg1="${portlet.framework}" arg2="icefaces" />
<equals arg1="${portlet.framework}" arg2="liferay_faces_alloy" />
<equals arg1="${portlet.framework}" arg2="primefaces" />
<equals arg1="${portlet.framework}" arg2="richfaces" />
</or>
<then>
<copy todir="${portlet.dir}">
<fileset
dir="${sdk.dir}/tools/portlet_jsf_tmpl"
/>
</copy>
</then>
</if>
<copy overwrite="true" todir="${portlet.dir}">
<fileset
dir="${sdk.dir}/tools/portlet_${portlet.framework}_tmpl"
/>
</copy>
</then>
</if>
<if>
<or>
<equals arg1="${portlet.framework}" arg2="icefaces" />
<equals arg1="${portlet.framework}" arg2="jsf" />
<equals arg1="${portlet.framework}" arg2="liferay_faces_alloy" />
<equals arg1="${portlet.framework}" arg2="primefaces" />
<equals arg1="${portlet.framework}" arg2="richfaces" />
</or>
<then>
<if>
<or>
<equals arg1="${portlet.framework}" arg2="jsf" />
<equals arg1="${portlet.framework}" arg2="liferay_faces_alloy" />
<equals arg1="${portlet.framework}" arg2="primefaces" />
<equals arg1="${portlet.framework}" arg2="richfaces" />
</or>
<then>
<echo file="${portlet.dir}/docroot/WEB-INF/liferay-plugin-package.properties" append="true">
portal-dependency-jars=commons-beanutils.jar,commons-collections.jar,commons-digester.jar,commons-fileupload.jar,commons-io.jar,commons-lang.jar
speed-filters-enabled=false
</echo>
</then>
<else>
<echo file="${portlet.dir}/docroot/WEB-INF/liferay-plugin-package.properties" append="true">
portal-dependency-jars=commons-beanutils.jar,commons-collections.jar,commons-digester.jar,commons-lang.jar
speed-filters-enabled=false
</echo>
</else>
</if>
<replace file="${portlet.dir}/docroot/WEB-INF/liferay-portlet.xml">
<replacetoken><![CDATA[</icon>]]></replacetoken>
<replacevalue><![CDATA[</icon>
<requires-namespaced-parameters>false</requires-namespaced-parameters>
<ajaxable>false</ajaxable>]]></replacevalue>
</replace>
<replaceregexp match="</header-portlet-css>(.*)</footer-portlet-javascript>" replace="</header-portlet-css>" flags="s">
<fileset
dir="${portlet.dir}/docroot/WEB-INF"
includes="liferay-portlet.xml"
/>
</replaceregexp>
<replace file="${portlet.dir}/docroot/WEB-INF/portlet.xml">
<replacetoken><![CDATA[<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>]]></replacetoken>
<replacevalue><![CDATA[<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>]]></replacevalue>
</replace>
<replace file="${portlet.dir}/docroot/WEB-INF/portlet.xml">
<replacetoken><![CDATA[<name>view-template</name>]]></replacetoken>
<replacevalue><![CDATA[<name>javax.portlet.faces.defaultViewId.view</name>]]></replacevalue>
</replace>
<replace file="${portlet.dir}/docroot/WEB-INF/portlet.xml">
<replacetoken><![CDATA[<value>/view.jsp</value>]]></replacetoken>
<replacevalue><![CDATA[<value>/views/view.xhtml</value>]]></replacevalue>
</replace>
<delete includeemptydirs="true">
<fileset
dir="${portlet.dir}/docroot"
includes="js/**,view.jsp"
/>
</delete>
</then>
</if>
<if>
<equals arg1="${portlet.framework}" arg2="scala" />
<then>
<move
file="${portlet.dir}/docroot/WEB-INF/src/ScalaPortlet.scala"
tofile="${portlet.dir}/docroot/WEB-INF/src/${portlet.java.package.name}/${portlet.java.class.name}ScalaPortlet.scala"
/>
<echo file="${portlet.dir}/docroot/WEB-INF/liferay-plugin-package.properties" append="true">
portal-dependency-jars=scala-library.jar</echo>
<replace file="${portlet.dir}/docroot/WEB-INF/portlet.xml">
<replacetoken><![CDATA[<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>]]></replacetoken>
<replacevalue><![CDATA[<portlet-class>@portlet.java.package.name@[email protected]@Portlet</portlet-class>]]></replacevalue>
</replace>
<replaceregexp match="</icon>(.*)</footer-portlet-javascript>" replace="</icon>" flags="s">
<fileset
dir="${portlet.dir}/docroot/WEB-INF"
includes="liferay-portlet.xml"
/>
</replaceregexp>
<replace file="${portlet.dir}/docroot/WEB-INF/liferay-portlet.xml">
<replacetoken><![CDATA[</icon>]]></replacetoken>
<replacevalue><![CDATA[</icon>
<ajaxable>false</ajaxable>]]></replacevalue>
</replace>
</then>
</if>
<if>
<equals arg1="${portlet.framework}" arg2="vaadin" />
<then>
<move
file="${portlet.dir}/docroot/WEB-INF/src/Application.java"
tofile="${portlet.dir}/docroot/WEB-INF/src/${portlet.java.package.name}/${portlet.java.class.name}Application.java"
/>
<echo file="${portlet.dir}/docroot/WEB-INF/liferay-plugin-package.properties" append="true">
portal-dependency-jars=vaadin.jar</echo>
<replace file="${portlet.dir}/docroot/WEB-INF/portlet.xml">
<replacetoken><![CDATA[<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>]]></replacetoken>
<replacevalue><![CDATA[<portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>]]></replacevalue>
</replace>
<replace file="${portlet.dir}/docroot/WEB-INF/portlet.xml">
<replacetoken><![CDATA[<name>view-template</name>]]></replacetoken>
<replacevalue><![CDATA[<name>application</name>]]></replacevalue>
</replace>
<replace file="${portlet.dir}/docroot/WEB-INF/portlet.xml">
<replacetoken><![CDATA[<value>/view.jsp</value>]]></replacetoken>
<replacevalue><![CDATA[<value>@portlet.java.package.name@[email protected]@Application</value>]]></replacevalue>
</replace>
<replaceregexp match="</icon>(.*)</footer-portlet-javascript>" replace="</icon>" flags="s">
<fileset
dir="${portlet.dir}/docroot/WEB-INF"
includes="liferay-portlet.xml"
/>
</replaceregexp>
<replace file="${portlet.dir}/docroot/WEB-INF/liferay-portlet.xml">
<replacetoken><![CDATA[</icon>]]></replacetoken>
<replacevalue><![CDATA[</icon>
<requires-namespaced-parameters>false</requires-namespaced-parameters>
<ajaxable>false</ajaxable>]]></replacevalue>
</replace>
<delete includeemptydirs="true">
<fileset
dir="${portlet.dir}/docroot"
includes="css/**,js/**,view.jsp"
/>
</delete>
</then>
</if>
<replace dir="${portlet.dir}">
<replacefilter token="@plugin.type.dir@" value="${plugin.type.dir}" />
<replacefilter token="@portlet.display.name@" value="${portlet.display.name}" />
<replacefilter token="@portlet.java.class.name@" value="${portlet.java.class.name}" />
<replacefilter token="@portlet.java.package.name@" value="${portlet.java.package.name}" />
<replacefilter token="@portlet.name@" value="${portlet.name}" />
</replace>
<mkdir dir="${portlet.dir}/docroot/WEB-INF/tld" />
<copy todir="${portlet.dir}/docroot/WEB-INF/tld">
<fileset dir="${app.server.portal.dir}/WEB-INF/tld">
<include name="aui.tld" />
<include name="liferay-portlet.tld" />
<include name="liferay-portlet-ext.tld" />
<include name="liferay-security.tld" />
<include name="liferay-theme.tld" />
<include name="liferay-ui.tld" />
<include name="liferay-util.tld" />
</fileset>
</copy>
</target>
</project>