forked from liferay/liferay-plugins
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.xml
255 lines (211 loc) · 8.46 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
<?xml version="1.0"?>
<!DOCTYPE project>
<project basedir="." default="all" name="plugins" xmlns:antelope="antlib:ise.antelope.tasks" xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:ivy="antlib:org.apache.ivy.ant">
<import file="build-common.xml" />
<condition property="plugins.includes.path" value="">
<or>
<equals arg1="${plugins.includes}" arg2="" />
<not>
<isset property="plugins.includes" />
</not>
</or>
</condition>
<path id="plugins.includes.path">
<dirset dir="hooks" excludes="${plugins.excludes}" includes="${plugins.includes}" />
<dirset dir="layouttpl" excludes="${plugins.excludes}" includes="${plugins.includes}" />
<dirset dir="portlets" excludes="${plugins.excludes}" includes="${plugins.includes}" />
<dirset dir="shared" excludes="${plugins.excludes}" includes="${plugins.includes}" />
<dirset dir="themes" excludes="${plugins.excludes}" includes="${plugins.includes}" />
<dirset dir="webs" excludes="${plugins.excludes}" includes="${plugins.includes}" />
</path>
<pathconvert pathsep="," property="plugins.includes.path" refid="plugins.includes.path" targetos="unix" />
<macrodef name="extract-plugins-sdk">
<attribute name="sdk.name" />
<attribute default="false" name="sdk.with.dependencies" />
<sequential>
<var name="sdk.zip.excludes" value="**/.gradle/**,**/build/**,**/gradle.properties,**/test.*.properties,*.iml,.git/**,.ivy/**,build.*.properties,build.gradle,dist/**,ext/*-ext/**,gradle/**,gradlew*,hooks/*-hook/**,layouttpl/*-layouttpl/**,portlets/*-portlet/**,private-plugins.txt,settings.gradle,shared/*-shared/**,source_formatter_*,suites/**,summary.*,themes/*-theme/**,tmp/**,tools/node-*/**,webs/*-web/**" />
<if>
<isfalse value="@{sdk.with.dependencies}" />
<then>
<var name="sdk.zip.excludes" value="${sdk.zip.excludes},dependencies/**/ivy.xml.MD5,dependencies/**/lib/**,lib/**,ivy.xml.MD5" />
</then>
</if>
<mkdir dir="dist" />
<delete file="dist/@{sdk.name}.zip" />
<zip destfile="dist/@{sdk.name}.zip" duplicate="preserve">
<zipfileset
dir="."
excludes="${sdk.zip.excludes}"
prefix="@{sdk.name}"
/>
<zipfileset
dir="."
includes="lib/ant-contrib.jar,lib/antelopetasks.jar,lib/bcpg-jdk16.jar,lib/bcprov-jdk16.jar"
prefix="@{sdk.name}"
/>
</zip>
</sequential>
</macrodef>
<target name="all">
<antcall target="clean" />
<antcall target="deploy" />
</target>
<target name="build-service">
<ant dir="hooks" inheritAll="false" target="build-service" />
<ant dir="portlets" inheritAll="false" target="build-service" />
<ant dir="webs" inheritAll="false" target="build-service" />
</target>
<target name="build-summary">
<exec executable="git" outputproperty="git.branch">
<arg line="rev-parse --abbrev-ref HEAD" />
</exec>
<java
classname="com.liferay.portal.tools.PluginsSummaryBuilder"
classpathref="portal.classpath"
fork="true"
newenvironment="true"
>
<jvmarg value="-Dexternal-properties=com/liferay/portal/tools/dependencies/portal-tools.properties" />
<jvmarg value="-Dplugins.dir=${sdk.dir}" />
</java>
<java
classname="com.liferay.portal.tools.XSLTBuilder"
classpathref="portal.classpath"
fork="true"
newenvironment="true"
>
<jvmarg value="-Dexternal-properties=com/liferay/portal/tools/dependencies/portal-tools.properties" />
<arg value="${sdk.dir}/summary.xml" />
<arg value="${sdk.dir}/summary.xsl" />
<arg value="${sdk.dir}/summary.html" />
</java>
</target>
<target name="format-javadoc">
<ant dir="hooks" inheritAll="false" target="format-javadoc" />
<ant dir="layouttpl" inheritAll="false" target="format-javadoc" />
<ant dir="portlets" inheritAll="false" target="format-javadoc" />
<ant dir="themes" inheritAll="false" target="format-javadoc" />
<ant dir="webs" inheritAll="false" target="format-javadoc" />
</target>
<target name="publish-sdk-release">
<fail message="Please set the property "sdk.version" to "latest" or to a valid version number.">
<condition>
<not>
<or>
<equals arg1="${sdk.version}" arg2="latest" />
<matches pattern="^\d+\.\d+\.\d+$" string="${sdk.version}" />
</or>
</not>
</condition>
</fail>
<if>
<equals arg1="${sdk.version}" arg2="latest" />
<then>
<delete dir="${ivy.home}/cache/com.liferay.portal/com.liferay.portal.plugins.sdk" />
<delete dir="${user.home}/.m2/repository/com/liferay/portal/com.liferay.portal.plugins.sdk" />
<ivy:settings file="${ivy.custom.settings.file}" />
<ivy:findrevision
module="com.liferay.portal.plugins.sdk"
organisation="com.liferay.portal"
property="sdk.version.latest"
revision="latest.release"
/>
<fail message="Unable to find latest version. Please set the property "sdk.version" to a valid version number." unless="sdk.version.latest" />
<antelope:stringutil property="sdk.version.latest.index" string="${sdk.version.latest}">
<antelope:lastindexof string="." />
</antelope:stringutil>
<antelope:math
datatype="int"
operand1="${sdk.version.latest.index}"
operand2="1"
operation="+"
result="sdk.version.latest.index"
/>
<antelope:stringutil property="sdk.version.latest.prefix" string="${sdk.version.latest}">
<antelope:substring endindex="${sdk.version.latest.index}" />
</antelope:stringutil>
<antelope:stringutil property="sdk.version.latest.micro" string="${sdk.version.latest}">
<antelope:substring beginindex="${sdk.version.latest.index}" />
</antelope:stringutil>
<antelope:math
datatype="int"
operand1="${sdk.version.latest.micro}"
operand2="1"
operation="+"
result="sdk.version.latest.micro"
/>
<property name="sdk.version.current" value="${sdk.version.latest.prefix}${sdk.version.latest.micro}" />
</then>
<else>
<property name="sdk.version.current" value="${sdk.version}" />
</else>
</if>
<extract-plugins-sdk sdk.name="com.liferay.portal.plugins.sdk-${sdk.version.current}" />
<extract-plugins-sdk sdk.name="com.liferay.portal.plugins.sdk-${sdk.version.current}-withdependencies" sdk.with.dependencies="true" />
<artifact:pom artifactId="com.liferay.portal.plugins.sdk" groupId="com.liferay.portal" id="plugins.sdk.pom" packaging="zip" version="${sdk.version.current}" />
<artifact:writepom file="dist/plugins.sdk.pom" pomRefId="plugins.sdk.pom" />
<artifact:deploy file="dist/com.liferay.portal.plugins.sdk-${sdk.version.current}.zip">
<attach classifier="withdependencies" file="dist/com.liferay.portal.plugins.sdk-${sdk.version.current}-withdependencies.zip" type="zip" />
<pom file="dist/plugins.sdk.pom" />
<remoteRepository url="${sonatype.release.url}">
<authentication password="${sonatype.release.password}" username="${sonatype.release.username}" />
</remoteRepository>
</artifact:deploy>
<delete dir="${user.home}/.m2/repository/com/liferay/portal/com.liferay.portal.plugins.sdk" />
<delete file="dist/plugins.sdk.pom" />
</target>
<target name="setup-eclipse">
<loop-macrodef-or-target
module.dirs="${plugins.includes.path}"
target.name="clean"
/>
<loop-macrodef-or-target
module.dirs="${plugins.includes.path}"
target.name="compile"
/>
<ant dir="hooks" inheritAll="false" target="setup-eclipse" />
<ant dir="portlets" inheritAll="false" target="setup-eclipse" />
<ant dir="webs" inheritAll="false" target="setup-eclipse" />
</target>
<target name="zip-portal">
<if>
<not>
<equals arg1="${app.server.type}" arg2="tomcat" />
</not>
<then>
<fail>
.
This task only works when the property "app.server.type" is "tomcat". However,
the outputted files will work in any supported application server.
</fail>
</then>
</if>
<tstamp>
<format pattern="yyyyMMddkkmmssSSS" property="tstamp.value" />
</tstamp>
<zip destfile="dist/liferay-portal-dependencies-${tstamp.value}.zip">
<zipfileset
dir="${app.server.lib.global.dir}"
prefix="liferay-portal-dependencies-${tstamp.value}"
/>
</zip>
<delete failonerror="false" file="dist/liferay-portal-${lp.version}.war" />
<zip
basedir="${app.server.portal.dir}"
destfile="dist/liferay-portal-${tstamp.value}.war"
excludes="_fckeditor/**,fckeditor/_samples/**"
/>
<copy todir="${tstamp.value}/WEB-INF/lib">
<fileset
dir="lib"
includes="ccpp.jar"
/>
</copy>
<zip
basedir="${tstamp.value}"
destfile="dist/liferay-portal-${tstamp.value}.war"
update="yes"
/>
<delete dir="${tstamp.value}" />
</target>
</project>