forked from liferay/liferay-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-common-ivy.xml
173 lines (145 loc) · 4.56 KB
/
build-common-ivy.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
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="build-common-ivy" xmlns:antelope="antlib:ise.antelope.tasks" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="ivy.home" value="${sdk.dir}/.ivy" />
<basename property="basedir.name" file="${basedir}" />
<propertyregex
input="${basedir.name}"
property="ivy.module.name"
regexp="(.*)\-(.*)$"
select="com.liferay.\1"
/>
<propertyregex
input="${ivy.module.name}"
override="true"
property="ivy.module.name"
regexp="\-"
replace="\."
/>
<if>
<not>
<available file="${ivy.home}/ivy-${ivy.version}.jar" />
</not>
<then>
<mkdir dir="${ivy.home}" />
<get
dest="${ivy.home}/ivy-${ivy.version}.jar"
src="${ivy.jar.url}"
/>
</then>
</if>
<path id="ivy.lib.path">
<fileset
dir="${ivy.home}"
includes="ivy-${ivy.version}.jar"
/>
<fileset
dir="${sdk.dir}/lib"
includes="bcpg-jdk16.jar,bcprov-jdk16.jar"
/>
</path>
<taskdef classpathref="ivy.lib.path" resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" />
<pathconvert property="sdk.dependencies.dir" targetos="unix">
<path location="${sdk.dir}/dependencies" />
</pathconvert>
<path id="sdk.dependencies.path">
<dirset dir="${sdk.dir}" includes="dependencies/*" />
</path>
<pathconvert pathsep="," property="sdk.dependencies.path" refid="sdk.dependencies.path" targetos="unix" />
<macrodef name="process-ivy">
<attribute default="${basedir}" name="module.dir" />
<sequential>
<for list="@{module.dir},${sdk.dir},${sdk.dependencies.path}" param="ivy.xml.dir">
<sequential>
<if>
<available file="@{ivy.xml.dir}/ivy.xml" />
<then>
<checksum file="@{ivy.xml.dir}/ivy.xml" verifyproperty="ivy.xml.unmodified" />
<if>
<isfalse value="${ivy.xml.unmodified}" />
<then>
<ivy:settings file="${ivy.custom.settings.file}" />
<ivy:resolve
file="@{ivy.xml.dir}/ivy.xml"
log="download-only"
transitive="${ivy.resolve.transitive.dependencies}"
/>
<if>
<or>
<equals arg1="@{ivy.xml.dir}" arg2="${sdk.dir}" />
<contains string="@{ivy.xml.dir}" substring="${sdk.dependencies.dir}" />
<antelope:endswith string="${ant.project.name}" with="-shared" />
<available file="@{ivy.xml.dir}/bnd.bnd" />
</or>
<then>
<ivy:retrieve
conf="default"
overwriteMode="always"
pattern="@{ivy.xml.dir}/lib/[artifact].[ext]"
type="bundle,jar,orbit"
/>
<ivy:retrieve
conf="default"
overwriteMode="always"
pattern="@{ivy.xml.dir}/lib/[artifact]-[type]s.[ext]"
type="source"
/>
</then>
<else>
<ivy:retrieve
conf="default"
overwriteMode="always"
pattern="@{ivy.xml.dir}/docroot/WEB-INF/lib/[artifact].[ext]"
type="bundle,jar,orbit"
/>
<ivy:retrieve
conf="default"
overwriteMode="always"
pattern="@{ivy.xml.dir}/docroot/WEB-INF/lib/[artifact]-[type]s.[ext]"
type="source"
/>
</else>
</if>
<checksum file="@{ivy.xml.dir}/ivy.xml" forceoverwrite="true" />
</then>
</if>
<var name="ivy.xml.unmodified" unset="true" />
</then>
</if>
</sequential>
</for>
</sequential>
</macrodef>
<process-ivy />
<target name="publish">
<ivy:settings file="${sdk.dir}/ivy-settings-publisher.xml" />
<ivy:resolve
log="download-only"
transitive="${ivy.resolve.transitive.dependencies}"
/>
<property name="ivy.pom.description" value="${plugin.name}" />
<property name="ivy.pom.name" value="${plugin.name}" />
<property name="plugin.release.qualifier" value="" />
<property name="ivy.pom.version" value="${plugin.full.version}${plugin.release.qualifier}" />
<ivy:makepom
conf="default,provided,runtime"
description="${ivy.pom.description}"
ivyfile="ivy.xml"
pomfile="${plugin.pom.file}"
templatefile="${sdk.dir}/tools/pom_tmpl/template.pom"
>
<mapping conf="default" scope="compile" />
<mapping conf="provided" scope="provided" />
<mapping conf="runtime" scope="runtime" />
</ivy:makepom>
<ivy:publish
forcedeliver="true"
overwrite="true"
publishivy="false"
pubrevision="${ivy.pom.version}"
resolver="${ivy.publish.resolver}"
>
<artifacts pattern="${sdk.dir}/dist/${plugin.name}-${plugin.full.version}(-[classifier]).[ext]" />
</ivy:publish>
</target>
</project>