-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
194 lines (159 loc) · 7.81 KB
/
build.xml
File metadata and controls
194 lines (159 loc) · 7.81 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project basedir="." default="all" xmlns:if="ant:if" xmlns:unless="ant:unless">
<basename property="ant.project.name" file="${basedir}"/>
<property environment="env"/>
<echo message="${ant.version}" />
<echo message="project ${ant.project.name}: ${ant.file}"/>
<echo message="profile: ${profile}"/>
<!-- Compiler options -->
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<!-- Source dirs -->
<path id="path.src">
<pathelement location=".apt_generated"/>
<pathelement location="src"/>
</path>
<pathconvert pathsep="," property="path.src.csv" refid="path.src"/>
<property name="project.ear" value="../${ant.project.name}EAR/"/>
<!-- Target dirs -->
<property if:set="profile" name="target.dir" value="../dist/${ant.project.name}/${profile}"/>
<property unless:set="profile" name="target.dir" value="../dist/${ant.project.name}"/>
<property name="target.builddir" value="${target.dir}/build"/>
<property name="target.classes" value="${target.builddir}/WEB-INF/classes"/>
<property if:set="profile" name="target.war" value="${target.dir}/${ant.project.name}.${profile}.war"/>
<property unless:set="profile" name="target.war" value="${target.dir}/${ant.project.name}.war"/>
<property if:set="profile" name="target.ear" value="${target.dir}/${ant.project.name}EAR.${profile}.ear"/>
<property unless:set="profile" name="target.ear" value="${target.dir}/${ant.project.name}EAR.ear"/>
<!-- Library dirs (viene selezionato il primo path valido) -->
<available unless:set="RAD_DIR" file="E:\\IBM\\RAD96\\" type="dir" property="RAD_DIR" value="E:\\IBM\\RAD96\\"/>
<available unless:set="RAD_DIR" file="E:\\IBM\\SDP96\\" type="dir" property="RAD_DIR" value="E:\\IBM\\SDP96\\"/>
<available unless:set="RAD_DIR" file="E:\\IBM\\RAD95\\" type="dir" property="RAD_DIR" value="E:\\IBM\\RAD95\\"/>
<available unless:set="RAD_DIR" file="E:\\IBM\\SDP95\\" type="dir" property="RAD_DIR" value="E:\\IBM\\SDP95\\"/>
<available unless:set="RAD_DIR" file="E:\\IBM\\RAD91\\" type="dir" property="RAD_DIR" value="E:\\IBM\\RAD91\\"/>
<available unless:set="RAD_DIR" file="E:\\IBM\\SDP91\\" type="dir" property="RAD_DIR" value="E:\\IBM\\SDP91\\"/>
<available unless:set="RAD_DIR" file="E:\\IBM\\RAD\\" type="dir" property="RAD_DIR" value="E:\\IBM\\RAD\\"/>
<available unless:set="RAD_DIR" file="E:\\IBM\\SDP\\" type="dir" property="RAD_DIR" value="E:\\IBM\\SDP\\"/>
<available unless:set="RAD_DIR" file="/opt/IBM/RAD96/" type="dir" property="RAD_DIR" value="/opt/IBM/RAD96/"/>
<available unless:set="RAD_DIR" file="/opt/IBM/SDP96/" type="dir" property="RAD_DIR" value="/opt/IBM/SDP96/"/>
<available unless:set="RAD_DIR" file="/opt/IBM/RAD95/" type="dir" property="RAD_DIR" value="/opt/IBM/RAD95/"/>
<available unless:set="RAD_DIR" file="/opt/IBM/SDP95/" type="dir" property="RAD_DIR" value="/opt/IBM/SDP95/"/>
<available unless:set="RAD_DIR" file="/opt/IBM/RAD91/" type="dir" property="RAD_DIR" value="/opt/IBM/RAD91/"/>
<available unless:set="RAD_DIR" file="/opt/IBM/SDP91/" type="dir" property="RAD_DIR" value="/opt/IBM/SDP91/"/>
<available unless:set="RAD_DIR" file="/opt/IBM/RAD/" type="dir" property="RAD_DIR" value="/opt/IBM/RAD/"/>
<available unless:set="RAD_DIR" file="/opt/IBM/SDP/" type="dir" property="RAD_DIR" value="/opt/IBM/SDP/"/>
<echo message="RAD_DIR=${RAD_DIR}"></echo>
<!-- Library dirs (project) -->
<path id="path.webApp">
<fileset dir="WebContent/WEB-INF/lib">
<include name="*.jar" />
</fileset>
</path>
<path id="path.ear"/>
<path id="path.webSpherePortal">
<fileset dir="${RAD_DIR}/runtimes/base_v8_stub">
<include name="**/*.jar" />
</fileset>
<fileset dir="${RAD_DIR}/runtimes/portal_v80_stub">
<include name="**/*.jar" />
</fileset>
</path>
<path id="classpath">
<pathelement location="${target.classes}"/>
<path refid="path.webApp"/>
<path refid="path.ear"/>
<path refid="path.webSpherePortal"/>
</path>
<!-- targets -->
<target name="clean">
<delete dir="${target.builddir}"/>
<delete file="${target.war}"/>
<delete file="${target.ear}"/>
</target>
<target name="init">
<mkdir dir="${target.classes}"/>
<!-- include anche i sorgenti nella compilazione -->
<echo message="Copying java sources from ${path.src.csv}"/>
<copy includeemptydirs="false" todir="${target.classes}" overwrite="false">
<multirootfileset basedirs="${path.src.csv}"/>
</copy>
<!-- directory resource -->
<available file="resources" type="dir" property="resources.dir.exists"/>
<echo if:set="resources.dir.exists" message="Copying resource files from resources"/>
<copy if:set="resources.dir.exists" includeemptydirs="false" todir="${target.classes}" overwrite="true">
<fileset dir="resources">
<exclude name="profile/**" />
</fileset>
</copy>
<!-- directory resource di profilo -->
<available if:set="profile" file="resources/profile/${profile}" type="dir" property="resources.profile.dir.exists"/>
<echo if:set="resources.profile.dir.exists" message="Copying '${profile}' profile resource files..."/>
<copy if:set="resources.profile.dir.exists" includeemptydirs="false" todir="${target.classes}" overwrite="true">
<fileset dir="resources/profile/${profile}"></fileset>
</copy>
<!-- directory WebContent -->
<copy includeemptydirs="false" todir="${target.builddir}" overwrite="false">
<fileset dir="WebContent/">
<exclude name="WEB-INF/ibm-web-bnd.xml"/>
<exclude name="WEB-INF/classes"/>
</fileset>
<fileset dir=".">
<include name="CHANGELOG"/>
<include name="LICENSE"/>
</fileset>
</copy>
</target>
<target depends="init" name="build">
<javac debug="true" debuglevel="${debuglevel}" destdir="${target.classes}" includeantruntime="false" source="${source}" target="${target}" executable="${RAD_DIR}/runtimes/base_v8_stub/java/bin/javac" fork="true">
<src refid="path.src"/>
<classpath refid="classpath"/>
</javac>
</target>
<target depends="build" name="war">
<echo message="war profile: ${profile}"/>
<!-- prima di fare il WAR devo crearmi la cartella apposita -->
<war destfile="${target.war}" update="true" needxmlfile="false" manifest="WebContent/META-INF/MANIFEST.MF">
<fileset dir="${target.builddir}"></fileset>
</war>
</target>
<target depends="war" name="ear">
<echo message="ear profile: ${profile}"/>
<available file="${project.ear}" type="dir" property="project.ear.exists"/>
<fail unless:set="project.ear.exists" message="EAR project directory does not exist: ${project.ear}"/>
<ear destfile="${target.ear}" update="true" appxml="${project.ear}/META-INF/application.xml" manifest="${project.ear}/META-INF/MANIFEST.MF">
<fileset unless:set="profile" file="${target.war}"/>
<mappedresources if:set="profile">
<fileset file="${target.war}"/>
<globmapper from="*.${profile}.war" to="*.war"/>
</mappedresources>
<fileset dir="${project.ear}">
<exclude name="META-INF/ibm-application-bnd.xml"/>
<exclude name="META-INF/application.xml"/> <!-- aggiunto già con attributo appxml -->
<include name="META-INF/**"/>
</fileset>
</ear>
</target>
<target depends="clean,ear" name="rebuild-ear">
</target>
<target name="rebuild-ear-test">
<antcall inheritall="false" target="rebuild-ear">
<param name="profile" value="test"/>
</antcall>
</target>
<target name="rebuild-ear-quality">
<antcall inheritall="false" target="rebuild-ear">
<param name="profile" value="quality"/>
</antcall>
</target>
<target name="rebuild-ear-prod">
<antcall inheritall="false" target="rebuild-ear">
<param name="profile" value="prod"/>
</antcall>
</target>
<target name="all">
<antcall target="rebuild-ear-test"></antcall>
<antcall target="rebuild-ear-quality"></antcall>
<antcall target="rebuild-ear-prod"></antcall>
</target>
</project>