svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.mkmvnproject / src / main / resources / scripts / mkmvnproject.xml @ 32859
History | View | Annotate | Download (18.5 KB)
1 |
<?xml version="1.0" encoding="ISO-8859-1"?>
|
---|---|
2 |
<project name="gvSIG-make-maven-project" default="mkproject" basedir="."> |
3 |
|
4 |
<!-- Get current file location folder -->
|
5 |
<dirname property="gvSIG-make-maven-project.basedir" |
6 |
file="${ant.file.gvSIG-make-maven-project}" /> |
7 |
|
8 |
<!-- Libraries folder in the gvSIG extension -->
|
9 |
<property name="lib.folder" |
10 |
location="${gvSIG-make-maven-project.basedir}/../lib" /> |
11 |
<!-- Templates folder in the gvSIG extension -->
|
12 |
<property name="templates.folder" |
13 |
location="${gvSIG-make-maven-project.basedir}/../templates" /> |
14 |
|
15 |
<property name="gvsiglogo" location="${basedir}/../gvSIG.png" /> |
16 |
|
17 |
<!-- Load some ant external utility tasks -->
|
18 |
<property name="antform.lib" location="${lib.folder}/antform-2.0.jar" /> |
19 |
<property name="antcontrib.lib" |
20 |
location="${lib.folder}/ant-contrib-1.0b3.jar" /> |
21 |
<property name="antelope.lib" |
22 |
location="${lib.folder}/antelopetasks-3.2.10.jar" /> |
23 |
|
24 |
<taskdef resource="net/sf/antcontrib/antlib.xml"> |
25 |
<classpath>
|
26 |
<pathelement location="${antcontrib.lib}" /> |
27 |
</classpath>
|
28 |
</taskdef>
|
29 |
|
30 |
<taskdef name="antform" |
31 |
classname="com.sardak.antform.AntForm" |
32 |
classpath="${antform.lib}" /> |
33 |
|
34 |
<taskdef name="antmenu" |
35 |
classname="com.sardak.antform.AntMenu" |
36 |
classpath="${antform.lib}" /> |
37 |
|
38 |
<taskdef name="stringutil" |
39 |
classname="ise.antelope.tasks.StringUtilTask" |
40 |
classpath="${antelope.lib}" /> |
41 |
|
42 |
<property name="confirm.message" value="Please confirm:" /> |
43 |
|
44 |
<target name="mkproject"> |
45 |
<description>Creates a new gvSIG project</description> |
46 |
|
47 |
<property name="project.type" value="1" /> |
48 |
<property name="create.app" value="true" /> |
49 |
<property name="create.ui.library" value="true" /> |
50 |
<property name="create.extension" value="false" /> |
51 |
<property name="project.group.id" value="org.gvsig" /> |
52 |
|
53 |
<antform title="Create Maven project" image="${gvsiglogo}"> |
54 |
<label>Select the project properties:</label> |
55 |
<textProperty label="Name : " |
56 |
property="project.name" |
57 |
required="true" /> |
58 |
<label>For the project name, use the java class naming rules. Ex: FortuneCookie</label> |
59 |
<textProperty label="Group Id : " property="project.group.id" /> |
60 |
<fileSelectionProperty label="Create project in : " |
61 |
property="project.save.on" |
62 |
directoryChooser="true" |
63 |
editable="false" |
64 |
required="true" /> |
65 |
<separator /> |
66 |
<radioSelectionProperty property="project.type" |
67 |
separator="#" |
68 |
values="1- Basic, API separated of the implementation#2- With providers, implementation requires provider services" |
69 |
editable="true" |
70 |
label="Choose project type :" /> |
71 |
<separator /> |
72 |
<booleanProperty property="create.app" |
73 |
editable="true" |
74 |
label="Create test application" /> |
75 |
<separator /> |
76 |
<booleanProperty property="create.ui.library" |
77 |
editable="true" |
78 |
label="Create swing library projects" /> |
79 |
<separator /> |
80 |
<booleanProperty property="create.extension" |
81 |
editable="true" |
82 |
label="Create gvSIG plugin" /> |
83 |
<separator /> |
84 |
<controlbar>
|
85 |
<button type="cancel" |
86 |
label="Cancel" |
87 |
target="project-cancelled" /> |
88 |
<button type="ok" label="Next" target="mkproject-redirect" /> |
89 |
</controlbar>
|
90 |
</antform>
|
91 |
</target>
|
92 |
|
93 |
<target name="mkproject-redirect"> |
94 |
|
95 |
<!-- Trim project name and group id -->
|
96 |
<stringutil string="${project.name}" property="project.name"> |
97 |
<trim /> |
98 |
</stringutil>
|
99 |
<stringutil string="${project.group.id}" property="project.group.id"> |
100 |
<trim /> |
101 |
</stringutil>
|
102 |
|
103 |
<!-- Lower case project name -->
|
104 |
<stringutil string="${project.name}" property="project.name.lowercase"> |
105 |
<lowercase /> |
106 |
</stringutil>
|
107 |
|
108 |
<!-- Capitalize project name, just in case -->
|
109 |
<stringutil string="${project.name}" |
110 |
property="project.name.capitalized.end"> |
111 |
<substring beginindex="1" /> |
112 |
</stringutil>
|
113 |
<stringutil string="${project.name}" |
114 |
property="project.name.capitalized.beginning"> |
115 |
<substring endindex="1" /> |
116 |
<uppercase /> |
117 |
</stringutil>
|
118 |
<property name="project.name.capitalized" |
119 |
value="${project.name.capitalized.beginning}${project.name.capitalized.end}" /> |
120 |
|
121 |
<echo>
|
122 |
Project name: ${project.name} |
123 |
Project name capitalized beg: ${project.name.capitalized.beginning} |
124 |
Project name capitalized end: ${project.name.capitalized.end} |
125 |
Project name capitalized: ${project.name.capitalized} |
126 |
</echo>
|
127 |
|
128 |
|
129 |
<!-- Create artifactID with project.group.id + . + project.name.lowercase -->
|
130 |
<property name="project.artifact.id" |
131 |
value="${project.group.id}.${project.name.lowercase}" /> |
132 |
|
133 |
<!-- Create project depending on the selected project type -->
|
134 |
<propertyregex property="value.project.type" |
135 |
input="${project.type}" |
136 |
regexp="([1-5]).*" |
137 |
select="\1" |
138 |
defaultvalue="1" /> |
139 |
<if>
|
140 |
<equals arg1="${value.project.type}" arg2="1" /> |
141 |
<then>
|
142 |
<antcall target="mkproject-basic" /> |
143 |
</then>
|
144 |
<else>
|
145 |
<antcall target="mkproject-spi" /> |
146 |
</else>
|
147 |
</if>
|
148 |
</target>
|
149 |
|
150 |
<target name="mkproject-basic"> |
151 |
<antform title="Confirm the creation" |
152 |
image="${gvsiglogo}" |
153 |
height="400" |
154 |
width="500"> |
155 |
<textProperty label="" |
156 |
property="confirm.message" |
157 |
editable="false" |
158 |
columns="28" /> |
159 |
<label>The project
|
160 |
"${project.name}" |
161 |
will be created from the |
162 |
basic API/implementation |
163 |
template on the folder |
164 |
${project.save.on} |
165 |
with: |
166 |
- groupID = ${project.group.id} |
167 |
- artifactID = ${project.artifact.id} |
168 |
- Swing library subproject? ${create.ui.library} |
169 |
- Lib test application subproject? ${create.app} |
170 |
- gvSIG plugin subproject? ${create.extension} |
171 |
</label>
|
172 |
<controlbar>
|
173 |
<button type="cancel" |
174 |
label="Cancel" |
175 |
target="project-cancelled" /> |
176 |
<button type="ok" label="Previous" target="mkproject" /> |
177 |
<button type="ok" label="Create" target="get-api-project" /> |
178 |
</controlbar>
|
179 |
</antform>
|
180 |
</target>
|
181 |
|
182 |
<target name="mkproject-spi"> |
183 |
<antform title="Confirm the creation" |
184 |
image="${gvsiglogo}" |
185 |
height="400" |
186 |
width="500"> |
187 |
<textProperty label="" |
188 |
property="confirm.message" |
189 |
editable="false" |
190 |
columns="28" /> |
191 |
<label>The project
|
192 |
"${project.name}" |
193 |
will be created from the |
194 |
implementation with providers |
195 |
template on the folder |
196 |
${project.save.on} |
197 |
with: |
198 |
- groupID = ${project.group.id} |
199 |
- artifactID = ${project.artifact.id} |
200 |
- Swing library subproject? ${create.ui.library} |
201 |
- Lib test application subproject? ${create.app} |
202 |
- gvSIG plugin subproject? ${create.extension} |
203 |
</label>
|
204 |
<controlbar>
|
205 |
<button type="cancel" |
206 |
label="Cancel" |
207 |
target="project-cancelled" /> |
208 |
<button type="ok" label="Previous" target="mkproject" /> |
209 |
<button type="ok" label="Create" target="get-spi-project" /> |
210 |
</controlbar>
|
211 |
</antform>
|
212 |
</target>
|
213 |
|
214 |
<target name="get-api-project"> |
215 |
<echo>Unzipping the basic template project</echo> |
216 |
<unzip src="${templates.folder}/template-basic.zip" |
217 |
dest="${project.save.on}" /> |
218 |
<antcall target="prepare-project" /> |
219 |
</target>
|
220 |
|
221 |
<target name="get-spi-project"> |
222 |
<echo>Unzipping the provider based implementation template project</echo> |
223 |
<unzip src="${templates.folder}/template-pbi.zip" |
224 |
dest="${project.save.on}" /> |
225 |
<antcall target="prepare-project" /> |
226 |
</target>
|
227 |
|
228 |
<target name="prepare-project"> |
229 |
<!-- Calculate the project artifact id as PATH -->
|
230 |
<propertyregex property="project.artifact.id.folder" |
231 |
input="${project.artifact.id}" |
232 |
regexp="([^\.]*).([^\.]*)" |
233 |
replace="\1${file.separator}\2" /> |
234 |
|
235 |
|
236 |
<echo>Remove non wanted projects</echo> |
237 |
<if>
|
238 |
<equals arg1="${create.extension}" arg2="false" /> |
239 |
<then>
|
240 |
<echo>Remove the gvSIG extension projects</echo> |
241 |
<delete dir="${project.save.on}/org.gvsig.fortunecookies.app.noswinglib" /> |
242 |
<delete dir="${project.save.on}/org.gvsig.fortunecookies.app" /> |
243 |
</then>
|
244 |
</if>
|
245 |
<if>
|
246 |
<equals arg1="${create.app}" arg2="false" /> |
247 |
<then>
|
248 |
<echo>Remove the library test main project</echo> |
249 |
<delete dir="${project.save.on}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main" /> |
250 |
<replace file="${project.save.on}/org.gvsig.fortunecookies/pom.xml" |
251 |
token="<module>org.gvsig.fortunecookies.main</module>" |
252 |
value="" /> |
253 |
<replace file="${project.save.on}/org.gvsig.fortunecookies/pom.xml" |
254 |
token="<module>org.gvsig.fortunecookies.main.noswinglib</module>" |
255 |
value="" /> |
256 |
</then>
|
257 |
</if>
|
258 |
<if>
|
259 |
<equals arg1="${create.ui.library}" arg2="false" /> |
260 |
<then>
|
261 |
<echo>Remove the Swing library</echo> |
262 |
<delete dir="${project.save.on}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.swing" /> |
263 |
<replace file="${project.save.on}/org.gvsig.fortunecookies/pom.xml" |
264 |
token="<module>org.gvsig.fortunecookies.swing</module>" |
265 |
value="" /> |
266 |
<if>
|
267 |
<equals arg1="${create.extension}" arg2="true" /> |
268 |
<then>
|
269 |
<echo>Leave only the extension which depends on the swing components</echo> |
270 |
<delete dir="${project.save.on}/org.gvsig.fortunecookies.app" /> |
271 |
<move todir="${project.save.on}/org.gvsig.fortunecookies.app"> |
272 |
<fileset dir="${project.save.on}/org.gvsig.fortunecookies.app.noswinglib" /> |
273 |
</move>
|
274 |
</then>
|
275 |
</if>
|
276 |
<if>
|
277 |
<equals arg1="${create.app}" arg2="true" /> |
278 |
<then>
|
279 |
<echo>Leave only the Main class which not depends on the swing components</echo> |
280 |
<delete dir="${project.save.on}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main" /> |
281 |
<move todir="${project.save.on}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main"> |
282 |
<fileset dir="${project.save.on}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main.noswinglib" /> |
283 |
</move>
|
284 |
<replace file="${project.save.on}/org.gvsig.fortunecookies/pom.xml" |
285 |
token="<module>org.gvsig.fortunecookies.main.noswinglib</module>" |
286 |
value="" /> |
287 |
<replace file="${project.save.on}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main/pom.xml" |
288 |
token="org.gvsig.fortunecookies.main.noswinglib" |
289 |
value="org.gvsig.fortunecookies.main" /> |
290 |
</then>
|
291 |
</if>
|
292 |
</then>
|
293 |
<else>
|
294 |
<!-- Let the Swing library and use the extension which uses that library -->
|
295 |
<if>
|
296 |
<equals arg1="${create.extension}" arg2="true" /> |
297 |
<then>
|
298 |
<echo>Leave only the extension which not depends on the swing components</echo> |
299 |
<delete dir="${project.save.on}/org.gvsig.fortunecookies.app.noswinglib" /> |
300 |
</then>
|
301 |
</if>
|
302 |
<if>
|
303 |
<equals arg1="${create.app}" arg2="true" /> |
304 |
<then>
|
305 |
<echo>Leave only the Main class which depends on the swing components</echo> |
306 |
<delete dir="${project.save.on}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main.noswinglib" /> |
307 |
<replace file="${project.save.on}/org.gvsig.fortunecookies/pom.xml" |
308 |
token="<module>org.gvsig.fortunecookies.main.noswinglib</module>" |
309 |
value="" /> |
310 |
</then>
|
311 |
</if>
|
312 |
</else>
|
313 |
</if>
|
314 |
|
315 |
<echo>Renaming folder ${project.save.on}/org.gvsig.fortunecookies to
|
316 |
${project.save.on}/${project.artifact.id}</echo>
|
317 |
<move todir="${project.save.on}"> |
318 |
<fileset dir="${project.save.on}"> |
319 |
<include name="org.gvsig.fortunecookies/**" /> |
320 |
<include name="org.gvsig.fortunecookies.app/**" /> |
321 |
</fileset>
|
322 |
<mapper>
|
323 |
<filtermapper>
|
324 |
<replacestring from="org.gvsig.fortunecookies" |
325 |
to="${project.artifact.id}" /> |
326 |
<replacestring from="org${file.separator}gvsig${file.separator}fortunecookies" |
327 |
to="${project.artifact.id.folder}" /> |
328 |
<replacestring from="FortuneCookie" |
329 |
to="${project.name.capitalized}" /> |
330 |
</filtermapper>
|
331 |
</mapper>
|
332 |
<filterchain>
|
333 |
<tokenfilter>
|
334 |
<!-- Replace fortune cookie server url as it contains the FortuneCookie word in it. -->
|
335 |
<replacestring from="http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx/GetFortuneCookie" |
336 |
to="FC_URL_TO_PRESERVE" /> |
337 |
</tokenfilter>
|
338 |
<tokenfilter>
|
339 |
<replacestring from="org.gvsig.fortunecookies" |
340 |
to="${project.artifact.id}" /> |
341 |
</tokenfilter>
|
342 |
<tokenfilter>
|
343 |
<replacestring from="FortuneCookies" |
344 |
to="${project.name.capitalized}" /> |
345 |
<replacestring from="Fortune Cookies" |
346 |
to="${project.name.capitalized}" /> |
347 |
<replacestring from="Fortune cookies" |
348 |
to="${project.name.capitalized}" /> |
349 |
<replacestring from="fortune cookies" |
350 |
to="${project.name.capitalized}" /> |
351 |
<replacestring from="gvsig-fortunecookies" |
352 |
to="gvsig-${project.name.lowercase}" /> |
353 |
<replacestring from="fortunecookies" |
354 |
to="${project.name.capitalized}" /> |
355 |
</tokenfilter>
|
356 |
<tokenfilter>
|
357 |
<replacestring from="FortuneCookie" |
358 |
to="${project.name.capitalized}" /> |
359 |
<replacestring from="Fortune Cookie" |
360 |
to="${project.name.capitalized}" /> |
361 |
<replacestring from="Fortune cookie" |
362 |
to="${project.name.capitalized}" /> |
363 |
<replacestring from="fortune cookie" |
364 |
to="${project.name.capitalized}" /> |
365 |
<replacestring from="gvsig-fortunecookie" |
366 |
to="gvsig-${project.name.lowercase}" /> |
367 |
<replacestring from="fortunecookie" |
368 |
to="${project.name.capitalized}" /> |
369 |
</tokenfilter>
|
370 |
<tokenfilter>
|
371 |
<!-- Restore the fortune cookie server URL -->
|
372 |
<replacestring from="FC_URL_TO_PRESERVE" |
373 |
to="http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx/GetFortuneCookie" /> |
374 |
</tokenfilter>
|
375 |
</filterchain>
|
376 |
</move>
|
377 |
|
378 |
<antcall target="prepare-workspace" /> |
379 |
</target>
|
380 |
|
381 |
<target name="prepare-workspace"> |
382 |
<ant dir="${project.save.on}/${project.artifact.id}" |
383 |
antfile="prepare-workspace.xml" |
384 |
target="prepare-workspace" /> |
385 |
<if>
|
386 |
<equals arg1="${create.extension}" arg2="true" /> |
387 |
<then>
|
388 |
<ant dir="${project.save.on}/${project.artifact.id}.app" |
389 |
antfile="../org.gvsig.maven.base.build/maven-goals.xml" |
390 |
target="mvn-install-and-eclipse-eclipse" /> |
391 |
<antcall target="project-created-succesfully" /> |
392 |
</then>
|
393 |
</if>
|
394 |
</target>
|
395 |
|
396 |
<target name="project-created-succesfully"> |
397 |
<antform title="Project created succesfully" image="${gvsiglogo}"> |
398 |
<label>Project ${project.name} was created succesfully</label> |
399 |
<controlbar>
|
400 |
<button type="cancel" label="Ok" /> |
401 |
</controlbar>
|
402 |
</antform>
|
403 |
</target>
|
404 |
|
405 |
<target name="project-cancelled"> |
406 |
<property name="cancel.message" |
407 |
value="Project creation cancelled by the user" /> |
408 |
<antform title="Project creation cancelled" |
409 |
image="${gvsiglogo}" |
410 |
height="200" |
411 |
width="400"> |
412 |
<textProperty label="" |
413 |
property="cancel.message" |
414 |
editable="false" |
415 |
columns="24" /> |
416 |
<controlbar>
|
417 |
<button type="cancel" label="Ok" /> |
418 |
</controlbar>
|
419 |
</antform>
|
420 |
</target>
|
421 |
|
422 |
</project>
|