svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.mkmvnproject.app / org.gvsig.mkmvnproject.app.mainplugin / src / main / resources-plugin / scripts / mkmvnproject.xml @ 40557
History | View | Annotate | Download (12.5 KB)
1 |
<?xml version="1.0" encoding="ISO-8859-1"?>
|
---|---|
2 |
<!--
|
3 |
|
4 |
gvSIG. Desktop Geographic Information System.
|
5 |
|
6 |
Copyright (C) 2007-2013 gvSIG Association.
|
7 |
|
8 |
This program is free software; you can redistribute it and/or
|
9 |
modify it under the terms of the GNU General Public License
|
10 |
as published by the Free Software Foundation; either version 3
|
11 |
of the License, or (at your option) any later version.
|
12 |
|
13 |
This program is distributed in the hope that it will be useful,
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
GNU General Public License for more details.
|
17 |
|
18 |
You should have received a copy of the GNU General Public License
|
19 |
along with this program; if not, write to the Free Software
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
21 |
MA 02110-1301, USA.
|
22 |
|
23 |
For any additional information, do not hesitate to contact us
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com.
|
25 |
|
26 |
-->
|
27 |
<project name="gvSIG-make-maven-project" default="mkproject" basedir="."> |
28 |
|
29 |
<!-- Get current file location folder -->
|
30 |
<dirname property="gvSIG-make-maven-project.basedir" file="${ant.file.gvSIG-make-maven-project}" /> |
31 |
|
32 |
<!-- Libraries folder in the gvSIG extension -->
|
33 |
<property name="lib.folder" location="${gvSIG-make-maven-project.basedir}/../lib" /> |
34 |
<!-- Templates folder in the gvSIG extension -->
|
35 |
<property name="templates.folder" location="${gvSIG-make-maven-project.basedir}/../templates" /> |
36 |
|
37 |
<property name="gvsiglogo" location="${basedir}/../gvSIG.png" /> |
38 |
|
39 |
<!-- Load some ant external utility tasks -->
|
40 |
<property name="antform.lib" location="${lib.folder}/antform-2.0.jar" /> |
41 |
<property name="antcontrib.lib" location="${lib.folder}/ant-contrib-1.0b3.jar" /> |
42 |
<property name="antelope.lib" location="${lib.folder}/antelopetasks-3.2.10.jar" /> |
43 |
|
44 |
<property name="form.width" value="700" /> |
45 |
<property name="form.height" value="550" /> |
46 |
<property name="form.columns" value="40" /> |
47 |
|
48 |
|
49 |
<taskdef resource="net/sf/antcontrib/antlib.xml"> |
50 |
<classpath>
|
51 |
<pathelement location="${antcontrib.lib}" /> |
52 |
</classpath>
|
53 |
</taskdef>
|
54 |
|
55 |
<taskdef name="antform" classname="com.sardak.antform.AntForm" classpath="${antform.lib}" /> |
56 |
|
57 |
<taskdef name="antmenu" classname="com.sardak.antform.AntMenu" classpath="${antform.lib}" /> |
58 |
|
59 |
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpath="${antelope.lib}" /> |
60 |
|
61 |
|
62 |
<!--
|
63 |
================ begin specific code of templates =================
|
64 |
-->
|
65 |
<property name="template.fortunecookies-basic.option" value="2 - General project based on Fortune cookies basic example project" /> |
66 |
<property name="template.fortunecookies-basic.description1" value="Create a general pourpose project with the multimodule" /> |
67 |
<property name="template.fortunecookies-basic.description2" value="structure. It has no GEO logic and is based on a basic" /> |
68 |
<property name="template.fortunecookies-basic.description3" value="API/implementation separation" /> |
69 |
|
70 |
<property name="template.fortunecookies-provider.option" value="3 - General project based on Fortune cookies example project" /> |
71 |
<property name="template.fortunecookies-provider.description1" value="Create a general pourpose project with the multimodule" /> |
72 |
<property name="template.fortunecookies-provider.description2" value="structure. It has no GEO logic and is based on" /> |
73 |
<property name="template.fortunecookies-provider.description3" value="API/SPI/implementation separation and providers" /> |
74 |
|
75 |
<property name="template.landregistryviewer.option" value="1 - Basic plugin with spatial support" /> |
76 |
<property name="template.landregistryviewer.description1" value="Create a project based in the LandRegistryViewer example." /> |
77 |
<property name="template.landregistryviewer.description2" value="Uses access to View, MapControl and datasources." /> |
78 |
<property name="template.landregistryviewer.description3" value="" /> |
79 |
|
80 |
<property name="templates" value="fortunecookies-basic,fortunecookies-provider,landregistryviewer" /> |
81 |
<!--
|
82 |
================ End specific code of templates =================
|
83 |
-->
|
84 |
|
85 |
<target name="mkproject" depends="mkproject-prompt-basic-data"> |
86 |
<description>Creates a new gvSIG project</description> |
87 |
</target>
|
88 |
|
89 |
<target name="mkproject-prompt-basic-data"> |
90 |
|
91 |
<property name="project.group.id" value="org.gvsig" /> |
92 |
|
93 |
<antform title="Create project" width="${form.width}" image="${gvsiglogo}"> |
94 |
<textProperty label="" editable="false" columns="${form.columns}" property="form.title" /> |
95 |
<textProperty label="Name : " property="project.name" required="true" /> |
96 |
<label> For the project name, use the java class naming rules.
|
97 |
Ex: FortuneCookie or LandRegistryViewer</label>
|
98 |
<textProperty label="Group Id : " property="project.group.id" required="true" /> |
99 |
|
100 |
<fileSelectionProperty label="Create project in : " property="project.folder" directoryChooser="true" editable="false" required="true" /> |
101 |
<separator /> |
102 |
<label>Select the template to use:</label> |
103 |
|
104 |
<!--
|
105 |
================ begin specific code of templates =================
|
106 |
-->
|
107 |
<checkSelectionProperty property="template.landregistryviewer.check" values="${template.landregistryviewer.option}" label="" /> |
108 |
<label> ${template.landregistryviewer.description1}
|
109 |
${template.landregistryviewer.description2} |
110 |
${template.landregistryviewer.description3}</label>
|
111 |
|
112 |
<checkSelectionProperty editable="false" property="template.fortunecookies-basic.check" values="${template.fortunecookies-basic.option}" label="" /> |
113 |
<label> ${template.fortunecookies-basic.description1}
|
114 |
${template.fortunecookies-basic.description2} |
115 |
${template.fortunecookies-basic.description3}</label>
|
116 |
<checkSelectionProperty editable="false" property="template.fortunecookies-provider.check" values="${template.fortunecookies-provider.option}" label="" /> |
117 |
<label> ${template.fortunecookies-provider.description1}
|
118 |
${template.fortunecookies-provider.description2} |
119 |
${template.fortunecookies-provider.description3}</label>
|
120 |
<!--
|
121 |
================ End specific code of templates =================
|
122 |
-->
|
123 |
<separator /> |
124 |
<controlbar>
|
125 |
<button type="cancel" label=" Cancel " target="mkproject-build-cancelled" /> |
126 |
<button type="ok" label=" Next " target="mkproject-fixnames" /> |
127 |
</controlbar>
|
128 |
</antform>
|
129 |
</target>
|
130 |
|
131 |
<target name="mkproject-fixnames"> |
132 |
|
133 |
<!-- Trim project name and group id -->
|
134 |
<stringutil string="${project.name}" property="project.name"> |
135 |
<trim /> |
136 |
</stringutil>
|
137 |
<stringutil string="${project.group.id}" property="project.group.id"> |
138 |
<trim /> |
139 |
</stringutil>
|
140 |
|
141 |
<!-- Lower case project name -->
|
142 |
<stringutil string="${project.name}" property="project.name.lowercase"> |
143 |
<lowercase /> |
144 |
</stringutil>
|
145 |
|
146 |
<!-- Capitalize project name, just in case -->
|
147 |
<stringutil string="${project.name}" property="project.name.capitalized.end"> |
148 |
<substring beginindex="1" /> |
149 |
</stringutil>
|
150 |
<stringutil string="${project.name}" property="project.name.capitalized.beginning"> |
151 |
<substring endindex="1" /> |
152 |
<uppercase /> |
153 |
</stringutil>
|
154 |
<property name="project.name.capitalized" value="${project.name.capitalized.beginning}${project.name.capitalized.end}" /> |
155 |
|
156 |
<!-- Create artifactID with project.group.id + . + project.name.lowercase -->
|
157 |
<property name="project.artifact.id" value="${project.group.id}.${project.name.lowercase}" /> |
158 |
|
159 |
<for list="${templates}" param="template"> |
160 |
<sequential>
|
161 |
<var name="template.name" value="@{template}" /> |
162 |
<var name="check.name" value="template.${template.name}.check" /> |
163 |
<propertycopy override="true" name="arg1" from="${check.name}" /> |
164 |
<propertycopy override="true" name="arg2" from="template.${template.name}.option" /> |
165 |
<if>
|
166 |
<and>
|
167 |
<isset property="selected.template" /> |
168 |
<equals arg1="${arg1}" arg2="${arg2}" /> |
169 |
</and>
|
170 |
<then>
|
171 |
<antcall target="fail"> |
172 |
<param name="message" value="Only one template can be selected" /> |
173 |
</antcall>
|
174 |
</then>
|
175 |
</if>
|
176 |
<if>
|
177 |
<equals arg1="${arg1}" arg2="${arg2}" /> |
178 |
<then>
|
179 |
<echo>selected.template = "${template.name}"</echo> |
180 |
<property name="selected.template" value="${template.name}" /> |
181 |
</then>
|
182 |
</if>
|
183 |
</sequential>
|
184 |
</for>
|
185 |
<antcall target="mkproject-confirm" inheritall="true" /> |
186 |
</target>
|
187 |
|
188 |
<target name="mkproject-confirm"> |
189 |
<antform title="Confirm the creation" width="${form.width}" image="${gvsiglogo}"> |
190 |
<textProperty label="" editable="false" columns="${form.columns}" property="form.title" /> |
191 |
<label>The data used for the creation of project are:</label> |
192 |
<textProperty label="Project" editable="false" property="project.name" /> |
193 |
<textProperty label="Project name capitalized" editable="false" property="project.name.capitalized" /> |
194 |
<textProperty label="Project name lowercase" editable="false" property="project.name.lowercase" /> |
195 |
<textProperty label="Group Id" editable="false" property="project.group.id" /> |
196 |
<textProperty label="Artifact Id" editable="false" property="project.artifact.id" /> |
197 |
<textProperty label="Folder" editable="false" property="project.folder" /> |
198 |
<textProperty label="Template" editable="false" property="selected.template" /> |
199 |
<label>Continue ?</label> |
200 |
<separator /> |
201 |
<controlbar>
|
202 |
<button type="cancel" label=" Cancel " target="mkproject-build-cancelled" /> |
203 |
<button type="ok" label=" Previous " target="mkproject-prompt-basic-data" /> |
204 |
<button type="ok" label=" Next " target="mkproject-build" /> |
205 |
</controlbar>
|
206 |
</antform>
|
207 |
</target>
|
208 |
|
209 |
<target name="mkproject-build"> |
210 |
<echo>
|
211 |
Project name: "${project.name}" |
212 |
Project name capitalized: "${project.name.capitalized}" |
213 |
Project name lowercase: ${project.name.lowercase}" |
214 |
Group id: "${project.group.id}" |
215 |
ArtifactId: "${project.artifact.id}" |
216 |
Project folder: "${project.folder}" |
217 |
Selected template: "${selected.template}" |
218 |
</echo>
|
219 |
<!-- call specific code of the selected template -->
|
220 |
<ant antfile="${selected.template}.xml" inheritall="false"> |
221 |
<property name="project.name" value="${project.name}" /> |
222 |
<property name="project.name.capitalized" value="${project.name.capitalized}" /> |
223 |
<property name="project.name.lowercase" value="${project.name.lowercase}" /> |
224 |
<property name="project.group.id" value="${project.group.id}" /> |
225 |
<property name="project.artifact.id" value="${project.artifact.id}" /> |
226 |
<property name="project.folder" value="${project.folder}" /> |
227 |
<property name="form.width" value="${form.width}" /> |
228 |
<property name="form.height" value="${form.height}" /> |
229 |
<property name="form.columns" value="${form.columns}" /> |
230 |
</ant>
|
231 |
<if>
|
232 |
<resourceexists>
|
233 |
<file file="${project.folder}/${project.artifact.id}" /> |
234 |
</resourceexists>
|
235 |
<then>
|
236 |
<antcall target="mkproject-prepare-workspace" inheritall="true" /> |
237 |
<antcall target="mkproject-build-succesfully" inheritall="true" /> |
238 |
</then>
|
239 |
<else>
|
240 |
<antcall target="mkproject-build-cancelled" inheritall="true" /> |
241 |
</else>
|
242 |
</if>
|
243 |
</target>
|
244 |
|
245 |
<target name="mkproject-prepare-workspace"> |
246 |
<ant dir="${project.folder}/${project.artifact.id}" antfile="prepare-workspace.xml" target="prepare-workspace" /> |
247 |
<if>
|
248 |
<resourceexists>
|
249 |
<file file="${project.folder}/${project.artifact.id}.app" /> |
250 |
</resourceexists>
|
251 |
<then>
|
252 |
<ant dir="${project.folder}/${project.artifact.id}.app" antfile="../org.gvsig.maven.base.build/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" /> |
253 |
</then>
|
254 |
</if>
|
255 |
</target>
|
256 |
|
257 |
<target name="mkproject-build-succesfully"> |
258 |
<antform title="Project creation" width="${form.width}" image="${gvsiglogo}"> |
259 |
<textProperty label="" editable="false" columns="${form.columns}" property="form.title" /> |
260 |
<label>Project ${project.name} was created succesfully</label> |
261 |
<controlbar>
|
262 |
<button type="ok" label=" Close " /> |
263 |
</controlbar>
|
264 |
</antform>
|
265 |
</target>
|
266 |
|
267 |
<target name="mkproject-build-cancelled"> |
268 |
<antform title="Project creation cancelled" width="${form.width}" image="${gvsiglogo}"> |
269 |
<textProperty label="" editable="false" columns="40" property="form.title" /> |
270 |
<label>Creation cancelled.</label> |
271 |
<separator /> |
272 |
<controlbar>
|
273 |
<button type="cancel" label=" Close " /> |
274 |
</controlbar>
|
275 |
</antform>
|
276 |
</target>
|
277 |
|
278 |
<target name="fail"> |
279 |
<echo>${message}</echo> |
280 |
<fail message="${message}" /> |
281 |
</target>
|
282 |
|
283 |
</project>
|