Revision 33016

View differences:

tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/prepare-templates.xml
1
<project name="prepare-templates.build" default="prepare-templates">
2

  
3
    <dirname property="prepare-templates.build.basedir"
4
             file="${ant.file.prepare-templates.build}" />
5

  
6
    <target name="check-templates">
7
        <available file="${prepare-templates.build.basedir}/target/templates"
8
                   type="dir"
9
                   property="templates.downloaded" />
10
    </target>
11

  
12
    <target name="download-templates"
13
            depends="check-templates"
14
            unless="templates.downloaded">
15
        <echo>Downloading project templates...</echo>
16
        <mkdir dir="${prepare-templates.build.basedir}/target/templates/downloads" />
17
        <mkdir dir="${prepare-templates.build.basedir}/target/templates-zips" />
18

  
19
        <java classname="org.tmatesoft.svn.cli.SVN"
20
              classpath="${runtime_classpath}"
21
              dir="${prepare-templates.build.basedir}/target/templates/downloads/"
22
              fork="true"
23
              failonerror="true">
24
            <arg value="export" />
25
            <arg value="https://svn.forge.osor.eu/svn/gvsig-fortuneco/org.gvsig.fortunecookies/trunk/basic-with-user-interface" />
26
        </java>
27
        <java classname="org.tmatesoft.svn.cli.SVN"
28
              classpath="${runtime_classpath}"
29
              dir="${prepare-templates.build.basedir}/target/templates/downloads/"
30
              fork="true"
31
              failonerror="true">
32
            <arg value="export" />
33
            <arg value="https://svn.forge.osor.eu/svn/gvsig-fortuneco/org.gvsig.fortunecookies/trunk/provider-based-implementation-with-user-interface" />
34
        </java>
35
    </target>
36

  
37
    <target name="prepare-templates" depends="download-templates">
38
        <echo>Zipping templates...</echo>
39
        <zip destfile="${prepare-templates.build.basedir}/target/templates-zips/template-basic.zip"
40
             basedir="${prepare-templates.build.basedir}/target/templates/downloads/basic-with-user-interface/"
41
             includes="**/*" />
42
        <zip destfile="${prepare-templates.build.basedir}/target/templates-zips/template-pbi.zip"
43
             basedir="${prepare-templates.build.basedir}/target/templates/downloads/provider-based-implementation-with-user-interface/"
44
             includes="**/*" />
45
    </target>
46

  
47
</project>
tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/prepare-workspace.xml
1
<project name="org.gvsig.initial.build" default="prepare-workspace">
2
	
3
	<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}"/>
4
	
5
	<property name="workspace.basedir" 
6
			  value="${org.gvsig.initial.build.basedir}/.."/>
7
	<property name="build.basedir" 
8
		      value="${workspace.basedir}/org.gvsig.maven.base.build"
9
		      description="Eclipse workspace location"/>
10
	<property name="build.jar.version" 
11
			 	  value="1.0.6-SNAPSHOT" />
12
	<property name="build.jar.file" 
13
		 	  value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
14
	
15
	<target name="prepare-workspace">
16
		
17
		<mkdir dir="target"/>
18
	
19
		<!-- Get the build jar file -->
20
		<get src="http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/maven-repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" 
21
			 dest="target/${build.jar.file}"
22
			 verbose="true"/>
23
		
24
		<!-- Unzip de build jar file into the workspace root folder -->
25
		<unzip src="target/${build.jar.file}"
26
		       dest="${workspace.basedir}">
27
		    <patternset>
28
		        <exclude name="META-INF/**"/>
29
		    </patternset>
30
		</unzip>
31
		
32
		<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug"/>
33
		
34
		<!-- Copy the maven launchers to the workspace metadata folder -->
35
		<copy todir="${workspace.basedir}/.metadata">
36
		    <fileset dir="${build.basedir}/eclipse-launchers"/>
37
		</copy>
38
		
39
		<!-- Configure the eclipse workspace -->
40
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace"/>
41

  
42
		<!-- Configure the gvSIG profile -->
43
		<ant antfile="${build.basedir}/check-gvsig-profile.xml" target="initialize"/>
44

  
45
		<!-- Compile, install and generate eclipse projects -->
46
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse"/>
47
		
48
		<echo>INFORMATION!!!</echo>
49
		<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo>
50
		
51
		<!-- TODO: copiar al proyecto de configuraciĆ³n general -->
52
	</target>
53
 	
54
	<target name="clean">
55
		<delete dir="target"/>
56
	</target>
57

  
58
</project>
0 59

  
tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
    <modelVersion>4.0.0</modelVersion>
6
    <groupId>org.gvsig</groupId>
7
    <artifactId>org.gvsig.mkmvnproject</artifactId>
8
    <packaging>jar</packaging>
9
    <version>2.0-SNAPSHOT</version>
10
    <name>org.gvsig.mkmvnproject</name>
11
    <description>
12
        Utilities and gvSIG plugin to create new gvSIG projects from a template
13
    </description>
14
    <url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.fortunecookies/${pom.version}/basic/org.gvsig.mkmvnproject</url>
15
    <parent>
16
        <groupId>org.gvsig</groupId>
17
        <artifactId>org.gvsig.maven.base.extension.pom</artifactId>
18
        <version>1.0.6-SNAPSHOT</version>
19
    </parent>
20

  
21
    <scm>
22
        <connection>scm:svn:https://svn.forge.osor.eu/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.mkmvnproject</connection>
23
        <developerConnection>scm:svn:https://svn.forge.osor.eu/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.mkmvnproject</developerConnection>
24
        <url>https://forge.osor.eu/plugins/scmsvn/viewcvs.php/branches/v2_0_0_prep/extensions/org.gvsig.mkmvnproject/?root=gvsig-desktop</url>
25
    </scm>
26

  
27
    <developers>
28
        <developer>
29
            <id>jjdelcerro</id>
30
            <name>Joaqu?n Jos? del Cerro</name>
31
            <email>jjdelcerro@gvsig.org</email>
32
            <roles>
33
                <role>Architect</role>
34
                <role>Developer</role>
35
            </roles>
36
        </developer>
37
        <developer>
38
            <id>jbadia</id>
39
            <name>Jos? Bad?a</name>
40
            <email>badia_jos@gva.es</email>
41
            <roles>
42
                <role>Developer</role>
43
            </roles>
44
        </developer>
45
        <developer>
46
            <id>cordinyana</id>
47
            <name>C?sar Ordi?ana</name>
48
            <email>cordinyana@gvsig.com</email>
49
            <roles>
50
                <role>Architect</role>
51
                <role>Developer</role>
52
            </roles>
53
        </developer>
54
    </developers>
55

  
56
    <distributionManagement>
57
        <site>
58
            <id>gvsig-repository</id>
59
            <url>scp://shell.forge.osor.eu/home/groups/gvsig-desktop/www/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.mkmvnproject/${pom.version}</url>
60
        </site>
61
    </distributionManagement>
62
    <repositories>
63
        <repository>
64
            <id>gvsig-public-http-repository</id>
65
            <name>gvSIG maven public HTTP repository</name>
66
            <url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/maven-repository</url>
67
            <releases>
68
                <enabled>true</enabled>
69
                <updatePolicy>daily</updatePolicy>
70
                <checksumPolicy>warn</checksumPolicy>
71
            </releases>
72
            <snapshots>
73
                <enabled>true</enabled>
74
                <updatePolicy>daily</updatePolicy>
75
                <checksumPolicy>warn</checksumPolicy>
76
            </snapshots>
77
        </repository>
78
    </repositories>
79

  
80
    <dependencyManagement>
81
        <dependencies>
82
            <dependency>
83
                <groupId>org.gvsig</groupId>
84
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
85
                <version>2.0.0-SNAPSHOT</version>
86
                <type>pom</type>
87
                <scope>import</scope>
88
            </dependency>
89
            <dependency>
90
                <groupId>org.gvsig</groupId>
91
                <artifactId>org.gvsig.i18n</artifactId>
92
                <version>2.0-SNAPSHOT</version>
93
            </dependency>
94
            <dependency>
95
                <groupId>ant-contrib</groupId>
96
                <artifactId>ant-contrib</artifactId>
97
                <version>1.0b3</version>
98
            </dependency>
99
            <dependency>
100
                <groupId>org.apache.ant</groupId>
101
                <artifactId>ant</artifactId>
102
                <version>1.8.1</version>
103
            </dependency>
104
            <dependency>
105
                <groupId>org.apache.ant</groupId>
106
                <artifactId>ant-launcher</artifactId>
107
                <version>1.8.1</version>
108
            </dependency>
109
            <dependency>
110
                <groupId>org.apache.ant</groupId>
111
                <artifactId>ant-nodeps</artifactId>
112
                <version>1.8.1</version>
113
            </dependency>
114
            <dependency>
115
                <groupId>org.apache.ant</groupId>
116
                <artifactId>ant-apache-oro</artifactId>
117
                <version>1.8.1</version>
118
            </dependency>
119
            <dependency>
120
                <groupId>com.sardak</groupId>
121
                <artifactId>antform</artifactId>
122
                <version>2.0</version>
123
            </dependency>
124
            <dependency>
125
                <groupId>org.tigris.antelope</groupId>
126
                <artifactId>antelopetasks</artifactId>
127
                <version>3.2.10</version>
128
            </dependency>
129
            <dependency>
130
                <groupId>org.gvsig</groupId>
131
                <artifactId>org.gvsig.andami</artifactId>
132
                <version>2.0-SNAPSHOT</version>
133
            </dependency>
134
            <dependency>
135
                <groupId>org.tmatesoft.svnkit</groupId>
136
                <artifactId>svnkit</artifactId>
137
                <version>1.3.3</version>
138
                <scope>runtime</scope>
139
            </dependency>
140
            <dependency>
141
                <groupId>org.tmatesoft.svnkit</groupId>
142
                <artifactId>svnkit-cli</artifactId>
143
                <version>1.3.3</version>
144
                <scope>runtime</scope>
145
            </dependency>
146
        </dependencies>
147
    </dependencyManagement>
148
    <dependencies>
149
        <dependency>
150
            <groupId>org.gvsig</groupId>
151
            <artifactId>org.gvsig.core.maven.dependencies</artifactId>
152
            <version>2.0.0-SNAPSHOT</version>
153
            <type>pom</type>
154
            <scope>import</scope>
155
        </dependency>
156
        <dependency>
157
            <groupId>org.gvsig</groupId>
158
            <artifactId>org.gvsig.i18n</artifactId>
159
        </dependency>
160
        <dependency>
161
            <groupId>ant-contrib</groupId>
162
            <artifactId>ant-contrib</artifactId>
163
        </dependency>
164
        <dependency>
165
            <groupId>org.apache.ant</groupId>
166
            <artifactId>ant</artifactId>
167
        </dependency>
168
        <dependency>
169
            <groupId>org.apache.ant</groupId>
170
            <artifactId>ant-launcher</artifactId>
171
        </dependency>
172
        <dependency>
173
            <groupId>org.apache.ant</groupId>
174
            <artifactId>ant-nodeps</artifactId>
175
        </dependency>
176
        <dependency>
177
            <groupId>org.apache.ant</groupId>
178
            <artifactId>ant-apache-oro</artifactId>
179
        </dependency>
180
        <dependency>
181
            <groupId>com.sardak</groupId>
182
            <artifactId>antform</artifactId>
183
        </dependency>
184
        <dependency>
185
            <groupId>org.tigris.antelope</groupId>
186
            <artifactId>antelopetasks</artifactId>
187
        </dependency>
188
        <dependency>
189
            <groupId>org.gvsig</groupId>
190
            <artifactId>org.gvsig.andami</artifactId>
191
        </dependency>
192
        <dependency>
193
            <groupId>org.tmatesoft.svnkit</groupId>
194
            <artifactId>svnkit</artifactId>
195
            <scope>runtime</scope>
196
        </dependency>
197
        <dependency>
198
            <groupId>org.tmatesoft.svnkit</groupId>
199
            <artifactId>svnkit-cli</artifactId>
200
            <scope>runtime</scope>
201
        </dependency>
202
    </dependencies>
203
    <build>
204
        <resources>
205
            <resource>
206
                <directory>src/main/resources</directory>
207
                <excludes>
208
                    <exclude>config.xml</exclude>
209
                    <exclude>gvSIG.png</exclude>
210
                    <exclude>scripts/**</exclude>
211
                </excludes>
212
            </resource>
213
        </resources>
214

  
215
        <plugins>
216
            <plugin>
217
                <groupId>org.apache.maven.plugins</groupId>
218
                <artifactId>maven-release-plugin</artifactId>
219
                <configuration>
220
                    <tagBase>https://svn.forge.osor.eu/svn/gvsig-desktop/tags</tagBase>
221
                </configuration>
222
            </plugin>
223
            <plugin>
224
                <artifactId>maven-antrun-plugin</artifactId>
225
                <executions>
226
                    <execution>
227
                        <id>prepare-templates</id>
228
                        <phase>package</phase>
229
                        <configuration>
230
                            <tasks>
231
                                <!-- Regexp implementation to use -->
232
                                <property name="ant.regexp.regexpimpl"
233
                                    value="org.apache.tools.ant.util.regexp.JakartaOroRegexp" />
234

  
235
                                <property name="runtime_classpath"
236
                                    refid="maven.runtime.classpath" />
237
                                <ant antfile="${basedir}/prepare-templates.xml" />
238
                            </tasks>
239
                        </configuration>
240
                        <goals>
241
                            <goal>run</goal>
242
                        </goals>
243
                    </execution>
244
                </executions>
245
                <dependencies>
246
                    <dependency>
247
                        <groupId>org.apache.ant</groupId>
248
                        <artifactId>ant-apache-oro</artifactId>
249
                        <version>1.8.1</version>
250
                    </dependency>
251
                </dependencies>
252
            </plugin>
253
        </plugins>
254
    </build>
255
    <profiles>
256
        <profile>
257
            <id>gvsig-install</id>
258
            <activation>
259
                <activeByDefault>true</activeByDefault>
260
            </activation>
261
            <properties>
262
                <!--  gvSIG installation folder relative to the current workspace -->
263
                <gvsig.install.dir>${basedir}/../build/product</gvsig.install.dir>
264
            </properties>
265
        </profile>
266
        <profile>
267
            <id>create-project</id>
268
            <build>
269
                <plugins>
270
                    <plugin>
271
                        <artifactId>maven-antrun-plugin</artifactId>
272
                        <executions>
273
                            <execution>
274
                                <id>Run mkmvnproject.xml</id>
275
                                <phase>install</phase>
276
                                <configuration>
277
                                    <tasks>
278
                                        <!-- Regexp implementation to use -->
279
                                        <property name="ant.regexp.regexpimpl"
280
                                            value="org.apache.tools.ant.util.regexp.JakartaOroRegexp" />
281
                                        <ant
282
                                            antfile="${project.build.directory}/${project.artifactId}-${project.version}-distribution/${project.artifactId}-${project.version}/gvSIG/extensiones/${project.artifactId}/scripts/mkmvnproject.xml" />
283
                                    </tasks>
284
                                </configuration>
285
                                <goals>
286
                                    <goal>run</goal>
287
                                </goals>
288
                            </execution>
289
                        </executions>
290
                        <dependencies>
291
                            <dependency>
292
                                <groupId>org.apache.ant</groupId>
293
                                <artifactId>ant-apache-oro</artifactId>
294
                                <version>1.8.1</version>
295
                            </dependency>
296
                        </dependencies>
297
                    </plugin>
298
                </plugins>
299
            </build>
300
        </profile>
301
        <profile>
302
            <id>gvsig-install</id>
303
            <activation>
304
                <activeByDefault>true</activeByDefault>
305
            </activation>
306
            <properties>
307
                <!--
308
                    Default gvSIG installation folder relative to the current
309
                    workspace
310
                -->
311
                <gvsig.install.dir>${basedir}/../build/product</gvsig.install.dir>
312
            </properties>
313
        </profile>
314
    </profiles>
315
</project>
0 316

  
tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/build.xml
1
<project name="gvSIG-build-config" default="mvn-install" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
2

  
3
	<property name="maven.folder" 
4
		location="${basedir}/src/main/resources/maven" />
5
	
6
	<!-- Maven ant tasks registration -->
7
	<path id="maven-ant-tasks.classpath" 
8
		path="${maven.folder}/lib/maven-ant-tasks-2.0.10.jar" />
9
	<typedef resource="org/apache/maven/artifact/ant/antlib.xml" 
10
		uri="antlib:org.apache.maven.artifact.ant"
11
		classpathref="maven-ant-tasks.classpath" />
12
	
13
	<!-- Maven targets -->
14
	<macrodef name="maven">
15
		<attribute name="arg" />
16
		<sequential>
17
			<echo>mvn @{arg}</echo>
18
			<artifact:mvn mavenHome="${maven.folder}" fork="true"
19
				failonerror="true" maxmemory="256M">
20
				<arg line="@{arg}" />
21
				<jvmarg value="-XX:MaxPermSize=64M" />
22
			</artifact:mvn>
23
		</sequential>
24
	</macrodef>
25

  
26
	<!-- Utility targets -->
27
	<target name="cancel">
28
		<fail>User canceled</fail>
29
	</target>
30

  
31
	<target name="mvn-clean" description="Cleans all artifacts">
32
		<maven arg="clean" />
33
	</target>
34

  
35
	<target name="mvn-compile" description="Compiles all source code">
36
		<maven arg="compile" />
37
	</target>
38

  
39
	<target name="mvn-test" description="Launches unit tests">
40
		<maven arg="test" />
41
	</target>
42

  
43
	<target name="mvn-install" description="Compiles and installs">
44
		<maven arg="install" />
45
	</target>
46
	
47
	<target name="mvn-install-ignore-tests" description="Compiles and installs and ignore tests">
48
	        <maven arg="install -Dmaven.test.failure.ignore" />
49
	    </target>
50
	
51
	<target name="mvn-install-without-tests"
52
		description="Compiles and installs without launching tests">
53
		<maven arg="-Dmaven.test.skip=true install" />
54
	</target>
55

  
56
	<target name="mvn-reinstall" 
57
		description="Performs a clean install">
58
		<maven arg="clean install" />
59
	</target>
60

  
61
	<target name="mvn-reinstall-without-tests"
62
		description="Performs a clean install without launching tests">
63
		<maven arg="-Dmaven.test.skip=true clean install" />
64
	</target>
65

  
66
	<target name="mvn-deploy" 
67
		description="Compiles, installs and deploys">
68
		<maven arg="deploy" />
69
	</target>
70

  
71
	<target name="mvn-deploy-release" 
72
			description="Compiles, installs and deploys for release">
73
		<maven arg="-P release deploy" />
74
	</target>
75

  
76
	<target name="mvn-eclipse-clean"
77
		description="Cleans the maven generated eclipse project files">
78
		<maven arg="eclipse:clean" />
79
	</target>
80

  
81
	<target name="mvn-eclipse-eclipse"
82
		description="Generates an eclipse project configuration from the pom.xml">
83
		<maven arg="eclipse:eclipse" />
84
	</target>
85

  
86
	<target name="mvn-site"
87
		description="Generates the project site documentation">
88
		<maven arg="site" />
89
	</target>
90
</project>
0 91

  
tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/distribution/distribution.xml
1
<assembly>
2
	<id>distribution</id>
3
	<formats>
4
		<format>dir</format>
5
	</formats>
6
	<fileSets>
7
		<!-- Estructure for the extension -->
8
		<fileSet>
9
			<directory>src/main/resources</directory>
10
			<outputDirectory>${extension.install.dir.name}
11
			</outputDirectory>
12
		</fileSet>
13
		<fileSet>
14
			<directory>target/templates-zips</directory>
15
			<outputDirectory>${extension.install.dir.name}/templates
16
			</outputDirectory>
17
		</fileSet>
18
	</fileSets>
19

  
20
	<dependencySets>
21
		<dependencySet>
22
			<outputDirectory>${extension.install.dir.name}/${library-dir}
23
			</outputDirectory>
24
			<includes>
25
				<include>org.gvsig:org.gvsig.mkmvnproject</include>
26
				<include>ant-contrib:ant-contrib</include>
27
				<include>org.apache.ant:ant</include>
28
				<include>org.apache.ant:ant-launcher</include>
29
				<include>org.apache.ant:ant-nodeps</include>
30
                <include>org.apache.ant:ant-apache-regexp</include>
31
				<include>com.sardak:antform</include>
32
				<include>org.tigris.antelope:antelopetasks</include>				
33
			</includes>
34
		</dependencySet>
35
	</dependencySets>
36
</assembly>
0 37

  
tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/src/main/resources/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app" />
4
	<resourceBundle name="text"/>
5
	<libraries library-dir="lib"/>
6
	<extensions>
7
		<extension class-name="org.gvsig.mkmvnproject.MakeMavenProjectExtension"
8
			description=""
9
			active="true"
10
			priority="1">
11
			<menu text="tools/Development/Create Plugin"
12
				position="11"
13
				action-command="gvSIGProjectWizard"/>
14
		</extension>		
15
	</extensions>
16
</plugin-config>
0 17

  
tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/src/main/resources/build.number
1
#Build Number for ANT. Do not edit!
2
#Tue Apr 28 16:00:47 CEST 2009
3
build.number=2005
tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/src/main/resources/scripts/mkmvnproject.xml
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="&lt;module&gt;org.gvsig.fortunecookies.main&lt;/module&gt;"
252
                         value="" />
253
                <replace file="${project.save.on}/org.gvsig.fortunecookies/pom.xml"
254
                         token="&lt;module&gt;org.gvsig.fortunecookies.main.noswinglib&lt;/module&gt;"
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="&lt;module&gt;org.gvsig.fortunecookies.swing&lt;/module&gt;"
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="&lt;module&gt;org.gvsig.fortunecookies.main.noswinglib&lt;/module&gt;"
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="&lt;module&gt;org.gvsig.fortunecookies.main.noswinglib&lt;/module&gt;"
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>
0 423

  
tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/src/main/java/org/gvsig/mkmvnproject/MakeMavenProjectExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22
package org.gvsig.mkmvnproject;
23

  
24
import java.io.File;
25
import java.net.URL;
26

  
27
import org.apache.tools.ant.DefaultLogger;
28
import org.apache.tools.ant.Project;
29
import org.apache.tools.ant.ProjectHelper;
30
import org.gvsig.andami.plugins.Extension;
31
import org.slf4j.Logger;
32
import org.slf4j.LoggerFactory;
33

  
34
/**
35
 * Extension to launch the project creation from templates.
36
 * 
37
 * @author gvSIG team
38
 * @version $Id$
39
 */
40
public class MakeMavenProjectExtension extends Extension {
41

  
42
	private static final String ANT_BUILD_FILE = "mkmvnproject.xml";
43

  
44
	private static final String ANT_TARGET = "mkproject";
45

  
46
	private static final Logger LOG = LoggerFactory
47
			.getLogger(MakeMavenProjectExtension.class);
48

  
49
	public void execute(String actionCommand) {
50
		ClassLoader loader = this.getClass().getClassLoader();
51
		URL build = loader.getResource("scripts/" + ANT_BUILD_FILE);
52
		File file = new File(build.getFile());
53

  
54
		DefaultLogger log = new DefaultLogger();
55
		log.setErrorPrintStream(System.err);
56
		log.setOutputPrintStream(System.out);
57
		log.setMessageOutputLevel(Project.MSG_INFO);
58

  
59
		Project ant = new Project();
60
		ant.addBuildListener(log);
61
		ant.setUserProperty("ant.file", file.getAbsolutePath());
62
		ant.init();
63
		ProjectHelper.getProjectHelper().parse(ant, file);
64

  
65
		LOG.info("Starting ant task with the file {} and the target {}", file,
66
				ANT_TARGET);
67
		ant.executeTarget(ANT_TARGET);
68
	}
69

  
70
	public void initialize() {
71
		// Nothing to do
72
	}
73

  
74
	public boolean isEnabled() {
75
		return true;
76
	}
77

  
78
	public boolean isVisible() {
79
		return true;
80
	}
81

  
82
}
0 83

  
tags/v2_0_0_Build_2008/extensions/org.gvsig.mkmvnproject/src/main/java/org/gvsig/mkmvnproject/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.fortunecookies package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>gvSIG Project creation from templates plugins.</p>
11
	
12
	<p>
13
	It allows to create new development projects for gvSIG from templates.
14
	</p>
15

  
16
</body>
17
</html>
0 18

  

Also available in: Unified diff