-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-common-osgi-plugin.xml
171 lines (143 loc) · 5.02 KB
/
build-common-osgi-plugin.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
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="build-common-osgi-plugin" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-common-plugin.xml" />
<antelope:stringutil string="${plugin.file}" property="plugin.file">
<antelope:replace regex="\.war" replacement="\.jar" />
</antelope:stringutil>
<if>
<available file="src" />
<then>
<property name="osgi.plugin.classes.dir" value="classes" />
<property name="osgi.plugin.source.dir" value="src" />
</then>
<else>
<property name="osgi.plugin.classes.dir" value="docroot/WEB-INF/classes" />
<property name="osgi.plugin.source.dir" value="docroot/WEB-INF/src" />
</else>
</if>
<property name="plugin-lib.classpath.path" refid="plugin-lib.classpath" />
<path id="plugin-lib.classpath">
<path refid="portal.classpath" />
<fileset dir="lib" erroronmissingdir="false" includes="*.jar" />
<pathelement path="${plugin-lib.classpath.path}" />
</path>
<var name="plugin-lib.classpath.path" unset="true" />
<taskdef classpathref="portal.classpath" resource="aQute/bnd/ant/taskdef.properties" />
<macrodef name="manifest-helper">
<attribute name="analyze" default="false" />
<sequential>
<taskdef
classname="com.liferay.util.ant.ManifestHelperTask"
classpathref="plugin.classpath"
name="liferay-manifest-helper"
/>
<liferay-manifest-helper
analyze="@{analyze}"
classpathref="plugin.classpath"
projectDirPropertyName="sdk.dir"
/>
</sequential>
</macrodef>
<target name="clean">
<delete dir="${osgi.plugin.classes.dir}" />
<antcall target="build-common-plugin.clean" />
</target>
<target name="compile">
<antcall target="compile-import-shared" />
<mkdir dir="${osgi.plugin.classes.dir}" />
<copy todir="${osgi.plugin.classes.dir}">
<fileset dir="${osgi.plugin.source.dir}" excludes="**/*.java" />
</copy>
<antcall target="compile-java">
<param name="javac.classpathref" value="plugin.classpath" />
<param name="javac.destdir" value="${osgi.plugin.classes.dir}" />
<param name="javac.srcdir" value="${osgi.plugin.source.dir}" />
</antcall>
</target>
<target name="deploy" depends="jar,deploy-dependencies">
<copy file="${plugin.file}" todir="${auto.deploy.dir}" />
</target>
<target name="deploy-dependencies">
<copy failonerror="false" todir="${auto.deploy.dir}">
<fileset dir="lib" includes="${osgi.dependencies}" />
</copy>
</target>
<target name="jar" depends="compile">
<if>
<not>
<uptodate targetfile="${plugin.file}">
<srcfiles dir="${osgi.plugin.classes.dir}" includes="**/*.*" />
</uptodate>
</not>
<then>
<manifest-helper />
<bndexpand propertyfile="${sdk.dir}/common.bnd" />
<bnd
eclipse="false"
exceptions="true"
failok="false"
inherit="true"
output="${plugin.file}"
sourcepath="."
>
<bndfiles path="bnd.bnd" />
<classpath>
<pathelement location="${osgi.plugin.classes.dir}" />
</classpath>
</bnd>
</then>
</if>
</target>
<target name="manifest">
<if>
<not>
<available file="${osgi.plugin.classes.dir}/META-INF/MANIFEST.MF" />
</not>
<then>
<manifest-helper analyze="true" />
<mkdir dir="${osgi.plugin.classes.dir}/META-INF" />
<tstamp>
<format property="build.time" pattern="EEE MMM d HH:mm:ss z yyyy" />
</tstamp>
<manifest file="${osgi.plugin.classes.dir}/META-INF/MANIFEST.MF">
<attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.5" />
<attribute name="Bundle-Vendor" value="${release.info.vendor}" />
<attribute name="Bundle-Version" value="${release.info.version}" />
<attribute name="Export-Package" value="${export.packages}" />
<attribute name="Import-Package" value="${import.packages}" />
<attribute name="Javac-Compiler" value="${javac.compiler}" />
<attribute name="Javac-Debug" value="${javac.debug}" />
<attribute name="Javac-Deprecation" value="${javac.deprecation}" />
<attribute name="Javac-Encoding" value="${javac.encoding}" />
</manifest>
<if>
<and>
<isset property="manifest.bundle.name" />
<isset property="manifest.bundle.symbolic.name" />
</and>
<then>
<manifest file="${osgi.plugin.classes.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Bundle-Name" value="${manifest.bundle.name}" />
<attribute name="Bundle-SymbolicName" value="${manifest.bundle.symbolic.name}" />
</manifest>
</then>
</if>
<if>
<isset property="manifest.premain.class" />
<then>
<manifest file="${osgi.plugin.classes.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Can-Redefine-Classes" value="${manifest.can.redefine.classes}" />
<attribute name="Can-Retransform-Classes" value="${manifest.can.retransform.classes}" />
<attribute name="Premain-Class" value="${manifest.premain.class}" />
</manifest>
</then>
</if>
</then>
</if>
</target>
<target name="war">
<antcall target="jar" />
</target>
</project>