]> git.argeo.org Git - gpl/argeo-slc.git/blob - maven/plugins/maven-argeo-pde-plugin/src/main/scripts/argeo-pde.build.xml
Update version
[gpl/argeo-slc.git] / maven / plugins / maven-argeo-pde-plugin / src / main / scripts / argeo-pde.build.xml
1 <project>
2 <!-- Defaults -->
3 <property name="projectDirectory" location="${basedir}" />
4 <property name="project.build.directory"
5 location="${projectDirectory}/target" />
6 <property name="dependencyDir"
7 location="${project.build.directory}/dependency" />
8 <property name="eclipseAntArgs" value="" />
9
10 <!-- Element build properties-->
11 <property name="elementBuildScript"
12 location="${projectDirectory}/build.xml" />
13 <property name="buildTempFolder"
14 location="${project.build.directory}/argeo-pde-temp" />
15 <property name="buildScriptProperties" value="" />
16
17 <available file="${projectDirectory}/plugin.xml"
18 property="elementType"
19 value="plugin" />
20 <available file="${projectDirectory}/feature.xml"
21 property="elementType"
22 value="feature" />
23
24 <property name="pluginDestination"
25 location="${project.build.directory}/plugins" />
26 <property name="featureDestination"
27 location="${project.build.directory}/features" />
28
29 <property name="siteTemplate"
30 location="${projectDirectory}/site.template" />
31
32 <!-- Product build properties -->
33 <property name="buildConfiguration" value="buildConfiguration" />
34 <property name="buildConfiguration.dir"
35 location="${projectDirectory}/${buildConfiguration}" />
36
37 <!-- TARGET Build Element -->
38 <target name="buildElement"
39 depends="init,setPluginPath"
40 description="Builds an element (plugin or feature)">
41 <fail message="Property buildScriptTargets has to be set"
42 unless="buildScriptTargets" />
43
44 <mkdir dir="${pluginDestination}" />
45 <mkdir dir="${featureDestination}" />
46
47 <property name="buildDirectory" location="${projectDirectory}/../.." />
48
49 <eclipseAnt antfile="${ant.file}"
50 antargs="eclipse.generateScripts -DpluginPath=${pluginPath} -DprojectDirectory=${projectDirectory} -DeclipseBuildDir=${eclipseBuildDir} -DelementId=${elementId} -DbuildDirectory=${buildDirectory}" />
51 <eclipseAnt antfile="${elementBuildScript}"
52 antargs="${buildScriptTargets} -Dplugin.destination=${pluginDestination} -Dfeature.destination=${featureDestination} -DelementId=${elementId} -DbuildTempFolder=${buildTempFolder} -Dtemp.folder=${buildTempFolder}/temp.folder -Dfeature.temp.folder=${buildTempFolder}/feature.temp.folder ${buildScriptProperties}" />
53
54 <copy todir="${project.build.directory}">
55 <fileset dir="${featureDestination}">
56 <include name="*.zip" />
57 </fileset>
58 <mergemapper to="${elementId}.zip" />
59 </copy>
60
61 <!-- Update site -->
62 <copy tofile="${project.build.directory}/site.xml"
63 file="${siteTemplate}">
64 <filterset begintoken="$${" endtoken="}">
65 <filtersfile file="${buildDirectory}/finalFeaturesVersions.properties" />
66 </filterset>
67 </copy>
68 <zip destfile="${project.build.directory}/${elementId}-updatesite.zip">
69 <fileset dir="${project.build.directory}">
70 <include name="plugins/*.jar" />
71 <include name="features/*.jar" />
72 <include name="site.xml" />
73 </fileset>
74 </zip>
75 </target>
76
77 <!-- TARGET Build Product -->
78 <target name="buildProduct"
79 depends="init,setPluginPath"
80 description="Builds a product">
81 <!-- Load provided build.properties to leave a chance to override -->
82 <property file="${buildConfiguration.dir}/build.properties" />
83 <!-- Set default properties -->
84 <property name="archivePrefix" value="${elementId}" />
85 <property name="buildId" value="${archivePrefix}" />
86 <property name="buildLabel" value="${archivePrefix}" />
87 <property name="collectingFolder" value="${archivePrefix}" />
88 <property name="skipFetch" value="true" />
89 <property name="skipMaps" value="true" />
90 <property name="runPackager" value="true" />
91
92 <!-- Find PDE build file -->
93 <pathconvert pathsep="" property="productBuildFile">
94 <path>
95 <fileset dir="${pdeBuilder}/plugins">
96 <include name="org.eclipse.pde.build_*/scripts/productBuild/productBuild.xml" />
97 </fileset>
98 </path>
99 </pathconvert>
100 <echo message="productBuildFile=${productBuildFile}" />
101
102 <!-- Copy sources -->
103 <property name="buildDirectory"
104 location="${project.build.directory}/productBuild" />
105 <mkdir dir="${buildDirectory}" />
106 <copy todir="${buildDirectory}" includeemptydirs="true" verbose="true">
107 <fileset dir="${projectDirectory}/../..">
108 <include name="plugins/**" />
109 <include name="features/**" />
110 <exclude name="**/.svn/**" />
111 <exclude name="**/target/**" />
112 </fileset>
113 </copy>
114
115 <!-- Execute -->
116 <eclipseAnt antfile="${productBuildFile}"
117 antargs="-Dbuilder=${buildConfiguration.dir} -DbuildDirectory=${buildDirectory} -DbaseLocation=${baseLocation} -Dbase=${base} -DpluginPath=${pluginPath} -DarchivePrefix=${archivePrefix} -DbuildLabel=${buildLabel} -DbuildId=${buildId} -DcollectingFolder=${collectingFolder} -DskipFetch=${skipFetch} -DskipMaps=${skipMaps} -DrunPackager=${runPackager}" />
118
119 <!-- Copy to target dir -->
120 <copy todir="${project.build.directory}">
121 <fileset dir="${buildDirectory}/${collectingFolder}">
122 <include name="*.zip" />
123 </fileset>
124 <globmapper from="${archivePrefix}-*" to="${elementId}-*" />
125 </copy>
126 </target>
127
128 <!-- TARGET Clean -->
129 <target name="clean"
130 depends="init,clean.elementBuildScript"
131 description="Cleans the generated resources">
132 <delete dir="${projectDirectory}/workspace" verbose="true" />
133 <delete file="${projectDirectory}/javaCompiler...args" verbose="true" />
134 <delete>
135 <fileset dir="${projectDirectory}/../..">
136 <include name="final*.properties" />
137 <include name="assemble*.xml" />
138 <include name="package*.xml" />
139 </fileset>
140 </delete>
141 </target>
142
143 <target name="clean.elementBuildScript" if="elementBuildScript.exists">
144 <ant antfile="${elementBuildScript}" target="clean" />
145 <delete file="${elementBuildScript}" verbose="true" />
146 </target>
147
148 <!-- COMMON UTILITIES -->
149 <target name="init">
150 <!-- Init Base -->
151 <property name="base" location="${eclipseBuildDir}" />
152 <property name="baseLocation" location="${base}/eclipse" />
153 <property name="pdeBuilder"
154 location="${eclipseBuildDir}/argeo-slc-pde" />
155 <property name="pluginPathBase"
156 location="${eclipseBuildDir}/pluginPath" />
157
158 <path id="pdeBuilder.launcher.classpath">
159 <fileset dir="${pdeBuilder}/plugins">
160 <include name="org.eclipse.equinox.launcher_*.jar" />
161 </fileset>
162 </path>
163
164 <!-- Log properties -->
165 <echo message="basedir=${basedir}" />
166 <echo message="ant.file=${ant.file}" />
167 <echo message="projectDirectory=${projectDirectory}" />
168
169 <echo message="eclipseBuildDir=${eclipseBuildDir}" />
170 <echo message="base=${base}" />
171 <echo message="baseLocation=${baseLocation}" />
172 <echo message="pdeBuilder=${pdeBuilder}" />
173 <echo message="localBuildDir=${localBuildDir}" />
174 <echo message="pluginPathBase=${pluginPathBase}" />
175
176 <echo message="elementType=${elementType}" />
177 <echo message="elementId=${elementId}" />
178 <echo message="elementBuildScript=${elementBuildScript}" />
179 <echo message="buildScriptTargets=${buildScriptTargets}" />
180 <echo message="buildScriptProperties=${buildScriptProperties}" />
181
182 <echo message="eclipseAntArgs=${eclipseAntArgs}" />
183
184 <echo message="buildConfiguration.dir=${buildConfiguration.dir}" />
185
186 <available file="${elementBuildScript}"
187 property="elementBuildScript.exists"
188 value="true" />
189 </target>
190
191 <target name="setPluginPath">
192 <mkdir dir="${dependencyDir}" />
193 <pathconvert property="pluginPath">
194 <path>
195 <pathelement location="${dependencyDir}" />
196 <dirset dir="${pluginPathBase}">
197 <include name="*" />
198 </dirset>
199 </path>
200 </pathconvert>
201 <echo message="pluginPath=${pluginPath}" />
202 </target>
203
204 <!-- TARGETS TO BE CALLED WITH ANT ECLIPSE -->
205 <target name="eclipse.generateScripts" depends="init">
206 <fail message="Property elementType has to be set"
207 unless="elementType" />
208 <eclipse.buildScript elements="${elementType}@${elementId}"
209 buildDirectory="${buildDirectory}"
210 baseLocation="${baseLocation}"
211 outputUpdateJars="true"
212 generateVersionsLists="true"
213 pluginPath="${pluginPath}" />
214 </target>
215
216 <!-- MACRODEFS -->
217 <macrodef name="eclipseAnt">
218 <attribute name="antfile" />
219 <attribute name="antargs" />
220 <sequential>
221 <echo message="Call Eclipse Ant for file @{antfile} with args ${eclipseAntArgs} @{antargs}" />
222 <java fork="true"
223 classname="org.eclipse.core.launcher.Main"
224 failonerror="true">
225 <classpath refid="pdeBuilder.launcher.classpath" />
226 <arg line="-data ${project.build.directory}/workspace" />
227 <arg line="-application org.eclipse.ant.core.antRunner" />
228 <arg line="-buildfile @{antfile}" />
229 <arg line="${eclipseAntArgs}" />
230 <arg line="@{antargs}" />
231 </java>
232 </sequential>
233 </macrodef>
234 </project>