Revision 37665

View differences:

tags/v_2_0_0_Build_2043/extensions/org.gvsig.mkmvnproject/src/main/java/org/gvsig/mkmvnproject/CreatePluginConsoleWindow.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.awt.Dimension;
25
import java.io.IOException;
26

  
27
import org.gvsig.andami.ui.mdiManager.IWindow;
28
import org.gvsig.andami.ui.mdiManager.IWindowListener;
29
import org.gvsig.andami.ui.mdiManager.WindowInfo;
30

  
31
/**
32
 * A gvSIG window which shows the execution log messages of the create plugin
33
 * process.
34
 * 
35
 * @author gvSIG Team
36
 * @version $Id$
37
 */
38
public class CreatePluginConsoleWindow extends CreatePluginConsolePanel
39
		implements IWindow, IWindowListener {
40

  
41
	private static final long serialVersionUID = -5589080107545290284L;
42

  
43
	private WindowInfo info;
44

  
45
	private Object profile = WindowInfo.EDITOR_PROFILE;
46

  
47
	/**
48
	 * Constructor.
49
	 * 
50
	 * @throws IOException
51
	 *             if there is an error creating the console streams
52
	 */
53
	public CreatePluginConsoleWindow() throws IOException {
54
		super();
55
		initializeWindow();
56
	}
57

  
58
	/**
59
	 * Constructor.
60
	 * 
61
	 * @param isDoubleBuffered
62
	 *            if the panel must be double buffered.
63
	 * @throws IOException
64
	 *             if there is an error creating the console streams
65
	 */
66
	public CreatePluginConsoleWindow(boolean isDoubleBuffered) throws IOException {
67
		super(isDoubleBuffered);
68
		initializeWindow();
69
	}
70

  
71
	/**
72
	 * Initializes the window.
73
	 */
74
	private void initializeWindow() {
75
		Dimension dimension = new Dimension(600, 300);
76
		setSize(dimension);
77
		int code = WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE
78
				| WindowInfo.RESIZABLE | WindowInfo.MODELESSDIALOG;
79
		profile = WindowInfo.EDITOR_PROFILE;
80
		info = new WindowInfo(code);
81
		info.setTitle("Console");
82
		info.setMinimumSize(dimension);
83
	}
84

  
85
	public WindowInfo getWindowInfo() {
86
		return info;
87
	}
88

  
89
	public Object getWindowProfile() {
90
		return profile;
91
	}
92

  
93
	public void windowActivated() {
94
		// Nothing to do
95
	}
96

  
97
	public void windowClosed() {
98
		super.closeConsole();
99
	}
100

  
101
}
tags/v_2_0_0_Build_2043/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>
tags/v_2_0_0_Build_2043/extensions/org.gvsig.mkmvnproject/src/main/java/org/gvsig/mkmvnproject/CreatePluginConsolePanel.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.awt.BorderLayout;
25
import java.awt.Color;
26
import java.awt.Dimension;
27
import java.io.BufferedReader;
28
import java.io.IOException;
29
import java.io.InputStreamReader;
30
import java.io.PipedInputStream;
31
import java.io.PipedOutputStream;
32
import java.io.PrintStream;
33

  
34
import javax.swing.JPanel;
35
import javax.swing.JScrollPane;
36
import javax.swing.JTextArea;
37
import javax.swing.SwingUtilities;
38

  
39
import org.slf4j.Logger;
40
import org.slf4j.LoggerFactory;
41

  
42
/**
43
 * A panel which shows the execution log messages of the create plugin process.
44
 * 
45
 * @author gvSIG Team
46
 * @version $Id$
47
 */
48
public class CreatePluginConsolePanel extends JPanel {
49

  
50
	private static final long serialVersionUID = -7213048219847956909L;
51

  
52
	private static final Logger LOG = LoggerFactory
53
			.getLogger(CreatePluginConsolePanel.class);
54

  
55
	private JTextArea console;
56

  
57
	private PrintStream printStream;
58
	private PipedOutputStream pipedos;
59
	private PipedInputStream pipedis;
60
	private Thread consoleThread;
61

  
62
	/**
63
	 * Constructor.
64
	 * 
65
	 * @throws IOException
66
	 *             if there is an error creating the console streams
67
	 */
68
	public CreatePluginConsolePanel() throws IOException {
69
		super();
70
		initialize();
71
	}
72

  
73
	/**
74
	 * Constructor.
75
	 * 
76
	 * @param isDoubleBuffered
77
	 *            if the panel must be double buffered.
78
	 * @throws IOException
79
	 *             if there is an error creating the console streams
80
	 */
81
	public CreatePluginConsolePanel(boolean isDoubleBuffered)
82
			throws IOException {
83
		super(isDoubleBuffered);
84
		initialize();
85
	}
86

  
87
	/**
88
	 * Initializes the panel GUI.
89
	 * 
90
	 * @throws IOException
91
	 */
92
	private void initialize() throws IOException {
93
		Dimension dimension = new Dimension(600, 200);
94
		setSize(dimension);
95
		setLayout(new BorderLayout());
96

  
97
		console = new JTextArea();
98
		console.setEditable(false);
99
		// console.setColumns(20);
100
		// console.setRows(5);
101
		console.setBackground(Color.WHITE);
102
		console.setLineWrap(true);
103
		console.setWrapStyleWord(true);
104

  
105
		JScrollPane consoleScrollPane = new JScrollPane(console);
106
		add(consoleScrollPane, BorderLayout.CENTER);
107

  
108
		pipedis = new PipedInputStream();
109

  
110
		pipedos = new PipedOutputStream(pipedis);
111

  
112
		printStream = new PrintStream(pipedos);
113
		consoleThread = new ConsoleThread(pipedis, console);
114
		consoleThread.start();
115
	}
116

  
117
	/**
118
	 * Returns a {@link PrintStream} which allows to write messages to the
119
	 * console.
120
	 * 
121
	 * @return a {@link PrintStream} which allows to write messages to the
122
	 *         console
123
	 */
124
	public PrintStream getPrintStream() {
125
		return printStream;
126
	}
127

  
128
	/**
129
	 * Returns a {@link PrintStream} which allows to write error messages to the
130
	 * console.
131
	 * 
132
	 * @return a {@link PrintStream} which allows to write error messages to the
133
	 *         console
134
	 */
135
	public PrintStream getErrorPrintStream() {
136
		return getPrintStream();
137
	}
138

  
139
	/**
140
	 * Closes the console. Once this method is called, any more calls to the
141
	 * console {@link PrintStream} will throw an exception.
142
	 */
143
	public void closeConsole() {
144
		printStream.flush();
145
		printStream.close();
146
		try {
147
			pipedos.close();
148
			pipedis.close();
149
			// Wait for the thread to finish
150
			consoleThread.join(500);
151
		} catch (IOException e) {
152
			LOG.warn("Error closing the internal piped streams", e);
153
		} catch (InterruptedException e) {
154
			// Nothing special to do
155
			LOG.debug("Console thread interrupted while waiting to finish", e);
156
		}
157
	}
158

  
159
	private static final class ConsoleThread extends Thread {
160

  
161
		private final PipedInputStream pipedis;
162
		private final JTextArea console;
163

  
164
		/**
165
		 * Constructor.
166
		 */
167
		public ConsoleThread(PipedInputStream pipedis, JTextArea console) {
168
			super("Create plugin console update thread");
169
			setDaemon(true);
170
			this.pipedis = pipedis;
171
			this.console = console;
172
		}
173

  
174
		@Override
175
		public void run() {
176
			try {
177
				BufferedReader reader = new BufferedReader(
178
						new InputStreamReader(pipedis));
179
				String line;
180
				while ((line = reader.readLine()) != null) {
181
					SwingUtilities.invokeLater(new ConsoleUpdateRunnable(
182
							console, line));
183
				}
184
				LOG.debug("Console input stream end, finish reading");
185
				reader.close();
186
			} catch (IOException e) {
187
                LOG.warn("Error reading from the console string", e);
188
			}
189
		}
190

  
191
	}
192

  
193
	/**
194
	 * Runnable used to update the console text field.
195
	 * 
196
	 * @author gvSIG Team
197
	 * @version $Id$
198
	 */
199
	private static final class ConsoleUpdateRunnable implements Runnable {
200
		private final String newLine;
201
		private final JTextArea console;
202

  
203
		/**
204
		 * Constructor.
205
		 */
206
		public ConsoleUpdateRunnable(JTextArea console, String newLine) {
207
			this.console = console;
208
			this.newLine = newLine;
209
		}
210

  
211
		public void run() {
212
			console.append(newLine);
213
			console.append("\n");
214
		}
215
	}
216
}
tags/v_2_0_0_Build_2043/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.awt.GridBagConstraints;
25
import java.io.File;
26
import java.io.IOException;
27
import java.net.URL;
28

  
29
import org.apache.tools.ant.DefaultLogger;
30
import org.apache.tools.ant.Project;
31
import org.apache.tools.ant.ProjectHelper;
32
import org.slf4j.Logger;
33
import org.slf4j.LoggerFactory;
34

  
35
import org.gvsig.andami.PluginServices;
36
import org.gvsig.andami.messages.NotificationManager;
37
import org.gvsig.andami.plugins.Extension;
38

  
39
/**
40
 * Extension to launch the project creation from templates.
41
 * 
42
 * @author gvSIG team
43
 * @version $Id$
44
 */
45
public class MakeMavenProjectExtension extends Extension {
46

  
47
	private static final String ANT_BUILD_FILE = "mkmvnproject.xml";
48

  
49
	private static final String ANT_TARGET = "mkproject";
50

  
51
	private static final Logger LOG = LoggerFactory
52
			.getLogger(MakeMavenProjectExtension.class);
53

  
54
	private boolean enabled = true;
55

  
56
	private final Object lock = new Object();
57

  
58
	public void execute(String actionCommand) {
59
		// TODO: add support to parallel executions in Andami??
60

  
61
        // Create messages console
62
	    CreatePluginConsoleWindow console = null;
63

  
64
        if (console == null) {
65
            try {
66
                console = new CreatePluginConsoleWindow();
67
            } catch (IOException e) {
68
                NotificationManager.addWarning("Error creating the console", e);
69
            }
70
        }
71
        if (console != null) {
72
            PluginServices.getMDIManager().addWindow(console, GridBagConstraints.LAST_LINE_START);
73
        }
74

  
75
		try {
76
			// Disable extension so it can't be executed again.
77
			synchronized (lock) {
78
				enabled = false;
79
			}
80
			new CreatePluginThread(console).start();
81
		} finally {
82
			synchronized (lock) {
83
				// create plugin process finish. Enable extension.
84
				enabled = true;
85
			}
86
		}
87
	}
88

  
89
	/**
90
	 * Thread to launch the ant base plugin creation project.
91
	 * 
92
	 * @author gvSIG Team
93
	 * @version $Id$
94
	 */
95
	private static final class CreatePluginThread extends Thread {
96

  
97
		private final CreatePluginConsoleWindow console;
98

  
99
		/**
100
		 * Constructor.
101
		 * 
102
		 * @param console
103
		 */
104
		public CreatePluginThread(CreatePluginConsoleWindow console) {
105
			this.console = console;
106
			setName("Create plugin execution thread");
107
			setDaemon(true);
108
		}
109

  
110
		@Override
111
		public void run() {
112
			DefaultLogger log = new DefaultLogger();
113
			log.setMessageOutputLevel(Project.MSG_INFO);
114

  
115
			if (console != null) {
116
				log.setErrorPrintStream(console.getErrorPrintStream());
117
				log.setOutputPrintStream(console.getPrintStream());
118
			} else {
119
				LOG.warn("Console window not available, will use the default console for Ant");
120
				log.setErrorPrintStream(System.err);
121
				log.setOutputPrintStream(System.out);
122
			}
123

  
124
			ClassLoader loader = this.getClass().getClassLoader();
125
			URL build = loader.getResource("scripts/" + ANT_BUILD_FILE);
126
			File file = new File(build.getFile());
127

  
128
			final Project ant = new Project();
129
			ant.addBuildListener(log);
130
			ant.setUserProperty("ant.file", file.getAbsolutePath());
131
			ant.init();
132
			ProjectHelper.getProjectHelper().parse(ant, file);
133

  
134
			LOG.info("Starting ant task with the file {} and the target {}",
135
					file, ANT_TARGET);
136
			ant.executeTarget(ANT_TARGET);
137
		}
138
	}
139

  
140
	public void initialize() {
141
		// Nothing to do
142
	}
143

  
144
	public boolean isEnabled() {
145
		return enabled;
146
	}
147

  
148
	public boolean isVisible() {
149
		return true;
150
	}
151

  
152
}
0 153

  
tags/v_2_0_0_Build_2043/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="7009080"
13
				action-command="gvSIGProjectWizard"/>
14
		</extension>		
15
	</extensions>
16
</plugin-config>
0 17

  
tags/v_2_0_0_Build_2043/extensions/org.gvsig.mkmvnproject/src/main/resources/scripts/landregistryviewer.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project name="gvSIG-make-maven-project" default="mkproject-build" basedir=".">
3

  
4
	<!-- Get current file location folder -->
5
	<dirname property="gvSIG-make-maven-project.basedir" file="${ant.file.gvSIG-make-maven-project}" />
6

  
7
	<!-- Libraries folder in the gvSIG extension -->
8
	<property name="lib.folder" location="${gvSIG-make-maven-project.basedir}/../lib" />
9
	<!-- Templates folder in the gvSIG extension -->
10
	<property name="templates.folder" location="${gvSIG-make-maven-project.basedir}/../templates" />
11

  
12
	<property name="gvsiglogo" location="${basedir}/../gvSIG.png" />
13

  
14
	<!-- Load some ant external utility tasks -->
15
	<property name="antform.lib" location="${lib.folder}/antform-2.0.jar" />
16
	<property name="antcontrib.lib" location="${lib.folder}/ant-contrib-1.0b3.jar" />
17
	<property name="antelope.lib" location="${lib.folder}/antelopetasks-3.2.10.jar" />
18

  
19
	<taskdef resource="net/sf/antcontrib/antlib.xml">
20
		<classpath>
21
			<pathelement location="${antcontrib.lib}" />
22
		</classpath>
23
	</taskdef>
24

  
25
	<taskdef name="antform" classname="com.sardak.antform.AntForm" classpath="${antform.lib}" />
26

  
27
	<taskdef name="antmenu" classname="com.sardak.antform.AntMenu" classpath="${antform.lib}" />
28

  
29
	<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpath="${antelope.lib}" />
30

  
31
	<target name="mkproject-build-cancelled">
32
		<antform title="Project creation cancelled" width="${form.width}" image="${gvsiglogo}">
33
			<textProperty label="" editable="false" columns="40" property="form.title" />
34
			<label>Creation cancelled.</label>
35
			<separator />
36
			<controlbar>
37
				<button type="cancel" label=" Close " />
38
			</controlbar>
39
		</antform>
40
	</target>
41

  
42
	<target name="mkproject-build">
43
		<echo>
44
  Project name: "${project.name}"
45
  Project name capitalized: "${project.name.capitalized}"
46
  Project name lowercase: ${project.name.lowercase}"
47
  Group id: "${project.group.id}"
48
  ArtifactId: "${project.artifact.id}"
49
  Project folder: "${project.folder}"
50
        </echo>
51

  
52
		<echo>Unzipping the basic template project</echo>
53
		<unzip src="${templates.folder}/landregistryviewer.zip" dest="${project.folder}" />
54

  
55
		<!-- Calculate the project artifact id as PATH -->
56
		<propertyregex property="project.artifact.id.folder" input="${project.artifact.id}" regexp="([^\.]*).([^\.]*)" replace="\1${file.separator}\2" />
57

  
58
		<echo>Renaming folder ${project.folder}/org.gvsig.landregistryviewer to 
59
            ${project.folder}/${project.artifact.id}</echo>
60

  
61
		<move todir="${project.folder}">
62
			<fileset dir="${project.folder}">
63
				<include name="org.gvsig.landregistryviewer/**/*.txt" />
64
				<include name="org.gvsig.landregistryviewer/**/*.java" />
65
				<include name="org.gvsig.landregistryviewer/**/*.xml" />
66
				<include name="org.gvsig.landregistryviewer/**/org.gvsig.tools.library.Library" />
67
				<include name="org.gvsig.landregistryviewer.app/**/org.gvsig.tools.library.Library" />
68
				<include name="org.gvsig.landregistryviewer.app/**/*.txt" />
69
				<include name="org.gvsig.landregistryviewer.app/**/*.xml" />
70
				<include name="org.gvsig.landregistryviewer.app/**/*.java" />
71
 			</fileset>
72
			<mapper>
73
				<filtermapper>
74
					<replacestring from="org.gvsig.landregistryviewer" to="${project.artifact.id}" />
75
					<replacestring from="org${file.separator}gvsig${file.separator}landregistryviewer" to="${project.artifact.id.folder}" />
76
					<replacestring from="LandRegistryViewer" to="${project.name.capitalized}" />
77
				</filtermapper>
78
			</mapper>
79
			<filterchain>
80
				<tokenfilter>
81
					<replacestring from="org.gvsig.landregistryviewer" to="${project.artifact.id}" />
82
				</tokenfilter>
83
				<tokenfilter>
84
					<replacestring from="LandRegistryViewer" to="${project.name.capitalized}" />
85
					<replacestring from="Land Registry Viewer" to="${project.name.capitalized}" />
86
					<replacestring from="gvsig-landregistryviewer" to="gvsig-${project.name.lowercase}" />
87
				</tokenfilter>
88
				<tokenfilter>
89
					<replacestring from="LandRegistryViewer" to="${project.name.capitalized}" />
90
					<replacestring from="Land Registry Viewer" to="${project.name.capitalized}" />
91
					<replacestring from="gvsig-landregistryviewer" to="gvsig-${project.name.lowercase}" />
92
				</tokenfilter>
93
			</filterchain>
94
		</move>
95
		<move todir="${project.folder}">
96
			<fileset dir="${project.folder}">
97
                                <include name="org.gvsig.landregistryviewer/**" />
98
                                <include name="org.gvsig.landregistryviewer.app/**" />
99
			</fileset>
100
			<mapper>
101
				<filtermapper>
102
					<replacestring from="org.gvsig.landregistryviewer" to="${project.artifact.id}" />
103
					<replacestring from="org${file.separator}gvsig${file.separator}landregistryviewer" to="${project.artifact.id.folder}" />
104
					<replacestring from="LandRegistryViewer" to="${project.name.capitalized}" />
105
				</filtermapper>
106
			</mapper>
107
		</move>
108
<!--
109
		<delete dir="${project.folder}/org.gvsig.landregistryviewer"/>
110
		<delete dir="${project.folder}/org.gvsig.landregistryviewer.app"/>
111
-->
112
	</target>
113

  
114

  
115
</project>
0 116

  
tags/v_2_0_0_Build_2043/extensions/org.gvsig.mkmvnproject/src/main/resources/scripts/fortunecookies.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project name="gvSIG-make-maven-project" default="mkproject-build" basedir=".">
3

  
4
	<!-- Get current file location folder -->
5
	<dirname property="gvSIG-make-maven-project.basedir" file="${ant.file.gvSIG-make-maven-project}" />
6

  
7
	<!-- Libraries folder in the gvSIG extension -->
8
	<property name="lib.folder" location="${gvSIG-make-maven-project.basedir}/../lib" />
9
	<!-- Templates folder in the gvSIG extension -->
10
	<property name="templates.folder" location="${gvSIG-make-maven-project.basedir}/../templates" />
11

  
12
	<property name="gvsiglogo" location="${basedir}/../gvSIG.png" />
13

  
14
	<!-- Load some ant external utility tasks -->
15
	<property name="antform.lib" location="${lib.folder}/antform-2.0.jar" />
16
	<property name="antcontrib.lib" location="${lib.folder}/ant-contrib-1.0b3.jar" />
17
	<property name="antelope.lib" location="${lib.folder}/antelopetasks-3.2.10.jar" />
18

  
19
	<taskdef resource="net/sf/antcontrib/antlib.xml">
20
		<classpath>
21
			<pathelement location="${antcontrib.lib}" />
22
		</classpath>
23
	</taskdef>
24

  
25
	<taskdef name="antform" classname="com.sardak.antform.AntForm" classpath="${antform.lib}" />
26

  
27
	<taskdef name="antmenu" classname="com.sardak.antform.AntMenu" classpath="${antform.lib}" />
28

  
29
	<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpath="${antelope.lib}" />
30

  
31
	<target name="mkproject-build-cancelled">
32
		<antform title="Project creation cancelled" width="${form.width}" image="${gvsiglogo}">
33
			<textProperty label="" editable="false" columns="40" property="form.title" />
34
			<label>Creation cancelled.</label>
35
			<separator />
36
			<controlbar>
37
				<button type="cancel" label=" Close " />
38
			</controlbar>
39
		</antform>
40
	</target>
41

  
42

  
43
	<target name="mkproject-prompt-data">
44
		<property name="project.type" value="1" />
45
		<property name="create.main" value="true" />
46
		<property name="create.ui.library" value="true" />
47
		<property name="create.plugin" value="false" />
48

  
49
		<antform title="Create project" width="${form.width}" image="${gvsiglogo}">
50
			<textProperty label="" editable="false" columns="${form.columns}" property="form.title" />
51

  
52
			<textProperty label="Project" editable="false" property="project.name" />
53
			<textProperty label="Group Id" editable="false" property="project.group.id" />
54
			<textProperty label="Artifact Id" editable="false" property="project.artifact.id" />
55
			<textProperty label="Folder" editable="false" property="project.folder" />
56
			<separator />
57
			<radioSelectionProperty property="selected.project.type" separator="#" values="1- Basic, API separated of the implementation#2- With providers, implementation requires provider services" editable="true" label="Choose project type :" />
58
			<booleanProperty property="create.main" editable="true" label="Create test application" />
59
			<booleanProperty property="create.ui.library" editable="true" label="Create swing library projects" />
60
			<booleanProperty property="create.plugin" editable="true" label="Create gvSIG plugin" />
61
			<separator />
62
			<controlbar>
63
				<button type="cancel" label=" Cancel " target="mkproject-build-cancelled" />
64
				<button type="ok" label=" Next " target="mkproject-confirm" />
65
			</controlbar>
66
		</antform>
67
	</target>
68

  
69
	<target name="mkproject-confirm-data">
70

  
71
		<propertyregex property="project.type" input="${selected.project.type}" regexp="([1-5]).*" select="\1" defaultvalue="1" />
72

  
73
		<antform title="Confirm the creation" width="${form.width}" image="${gvsiglogo}">
74
			<textProperty label="" editable="false" columns="${form.columns}" property="form.title" />
75
			<label>The data used for the creation of project are:</label>
76
		
77
			<textProperty label="Project" editable="false" property="project.name" />
78
			<textProperty label="Project name capitalized" editable="false" property="${project.name.capitalized}" />
79
			<textProperty label="Project name lowercase" editable="false" property="${project.name.lowercase}" />
80
			<textProperty label="Group Id" editable="false" property="project.group.id" />
81
			<textProperty label="Artifact Id" editable="false" property="project.artifact.id" />
82
			<textProperty label="Folder" editable="false" property="project.folder" />
83
		
84
			<textProperty label="Create main" editable="false" property="create.main" />
85
			<textProperty label="Create UI library" editable="false" property="create.ui.library" />
86
			<textProperty label="Create plugin" editable="false" property="create.plugin" />
87
			<textProperty label="Project type"  editable="false" property="project.type" />
88
			
89
			<label>Continue ?</label>
90
			<separator />
91
			<controlbar>
92
				<button type="cancel" label=" Cancel " target="mkproject-build-cancelled" />
93
				<button type="ok" label=" Previous " target="mkproject-prompt-data" />
94
				<button type="ok" label=" Next " />
95
			</controlbar>
96
		</antform>
97

  
98
	</target>
99

  
100
	<target name="mkproject-build" depends="mkproject-prompt-data">
101
		<echo>
102
  Project name: "${project.name}"
103
  Project name capitalized: "${project.name.capitalized}"
104
  Project name lowercase: ${project.name.lowercase}"
105
  Group id: "${project.group.id}"
106
  ArtifactId: "${project.artifact.id}"
107
  Project folder: "${project.folder}"
108
  Create main: "${create.main}"
109
  Create UI library: "${create.ui.library}"
110
  Create plugin: "${create.plugin}"
111
  Project type: "${project.type}"
112
        </echo>
113

  
114
		<if>
115
			<equals arg1="${project.type}" arg2="1" />
116
			<then>
117
				<echo>Unzipping the basic template project</echo>
118
				<unzip src="${templates.folder}/fortunecookies-basic.zip" dest="${project.folder}" />
119
			</then>
120
			<else>
121
				<echo>Unzipping the provider based implementation template project</echo>
122
				<unzip src="${templates.folder}/fortunecookies-pbi.zip" dest="${project.folder}" />
123
			</else>
124
		</if>
125

  
126
		<!-- Calculate the project artifact id as PATH -->
127
		<propertyregex property="project.artifact.id.folder" input="${project.artifact.id}" regexp="([^\.]*).([^\.]*)" replace="\1${file.separator}\2" />
128

  
129

  
130
		<echo>Remove non wanted projects</echo>
131
		<if>
132
			<equals arg1="${create.plugin}" arg2="false" />
133
			<then>
134
				<echo>Remove the gvSIG extension projects</echo>
135
				<delete dir="${project.folder}/org.gvsig.fortunecookies.app.noswinglib" />
136
				<delete dir="${project.folder}/org.gvsig.fortunecookies.app" />
137
			</then>
138
		</if>
139
		<if>
140
			<equals arg1="${create.main}" arg2="false" />
141
			<then>
142
				<echo>Remove the library test main project</echo>
143
				<delete dir="${project.foldern}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main" />
144
				<replace file="${project.folder}/org.gvsig.fortunecookies/pom.xml" token="&lt;module&gt;org.gvsig.fortunecookies.main&lt;/module&gt;" value="" />
145
				<replace file="${project.folder}/org.gvsig.fortunecookies/pom.xml" token="&lt;module&gt;org.gvsig.fortunecookies.main.noswinglib&lt;/module&gt;" value="" />
146
			</then>
147
		</if>
148
		<if>
149
			<equals arg1="${create.ui.library}" arg2="false" />
150
			<then>
151
				<echo>Remove the Swing library</echo>
152
				<delete dir="${project.folder}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.swing" />
153
				<replace file="${project.folder}/org.gvsig.fortunecookies/pom.xml" token="&lt;module&gt;org.gvsig.fortunecookies.swing&lt;/module&gt;" value="" />
154
				<if>
155
					<equals arg1="${create.plugin}" arg2="true" />
156
					<then>
157
						<echo>Leave only the extension which depends on the swing components</echo>
158
						<delete dir="${project.folder}/org.gvsig.fortunecookies.app" />
159
						<move todir="${project.folder}/org.gvsig.fortunecookies.app">
160
							<fileset dir="${project.folder}/org.gvsig.fortunecookies.app.noswinglib" />
161
						</move>
162
					</then>
163
				</if>
164
				<if>
165
					<equals arg1="${create.main}" arg2="true" />
166
					<then>
167
						<echo>Leave only the Main class which not depends on the swing components</echo>
168
						<delete dir="${project.folder}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main" />
169
						<move todir="${project.folder}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main">
170
							<fileset dir="${project.folder}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main.noswinglib" />
171
						</move>
172
						<replace file="${project.folder}/org.gvsig.fortunecookies/pom.xml" token="&lt;module&gt;org.gvsig.fortunecookies.main.noswinglib&lt;/module&gt;" value="" />
173
						<replace file="${project.folder}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main/pom.xml" token="org.gvsig.fortunecookies.main.noswinglib" value="org.gvsig.fortunecookies.main" />
174
					</then>
175
				</if>
176
			</then>
177
			<else>
178
				<!-- Let the Swing library and use the extension which uses that library -->
179
				<if>
180
					<equals arg1="${create.plugin}" arg2="true" />
181
					<then>
182
						<echo>Leave only the extension which not depends on the swing components</echo>
183
						<delete dir="${project.folder}/org.gvsig.fortunecookies.app.noswinglib" />
184
					</then>
185
				</if>
186
				<if>
187
					<equals arg1="${create.main}" arg2="true" />
188
					<then>
189
						<echo>Leave only the Main class which depends on the swing components</echo>
190
						<delete dir="${project.folder}/org.gvsig.fortunecookies/org.gvsig.fortunecookies.main.noswinglib" />
191
						<replace file="${project.folder}/org.gvsig.fortunecookies/pom.xml" token="&lt;module&gt;org.gvsig.fortunecookies.main.noswinglib&lt;/module&gt;" value="" />
192
					</then>
193
				</if>
194
			</else>
195
		</if>
196

  
197
		<echo>Renaming folder ${project.folder}/org.gvsig.fortunecookies to 
198
            ${project.folder}/${project.artifact.id}</echo>
199
		<move todir="${project.folder}">
200
			<fileset dir="${project.folder}">
201
				<include name="org.gvsig.fortunecookies/**" />
202
				<include name="org.gvsig.fortunecookies.app/**" />
203
			</fileset>
204
			<mapper>
205
				<filtermapper>
206
					<replacestring from="org.gvsig.fortunecookies" to="${project.artifact.id}" />
207
					<replacestring from="org${file.separator}gvsig${file.separator}fortunecookies" to="${project.artifact.id.folder}" />
208
					<replacestring from="FortuneCookie" to="${project.name.capitalized}" />
209
				</filtermapper>
210
			</mapper>
211
			<filterchain>
212
				<tokenfilter>
213
					<!-- Replace fortune cookie server url as it contains the FortuneCookie word in it. -->
214
					<replacestring from="http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx/GetFortuneCookie" to="FC_URL_TO_PRESERVE" />
215
				</tokenfilter>
216
				<tokenfilter>
217
					<replacestring from="org.gvsig.fortunecookies" to="${project.artifact.id}" />
218
				</tokenfilter>
219
				<tokenfilter>
220
					<replacestring from="FortuneCookies" to="${project.name.capitalized}" />
221
					<replacestring from="Fortune Cookies" to="${project.name.capitalized}" />
222
					<replacestring from="Fortune cookies" to="${project.name.capitalized}" />
223
					<replacestring from="fortune cookies" to="${project.name.capitalized}" />
224
					<replacestring from="gvsig-fortunecookies" to="gvsig-${project.name.lowercase}" />
225
					<replacestring from="fortunecookies" to="${project.name.capitalized}" />
226
				</tokenfilter>
227
				<tokenfilter>
228
					<replacestring from="FortuneCookie" to="${project.name.capitalized}" />
229
					<replacestring from="Fortune Cookie" to="${project.name.capitalized}" />
230
					<replacestring from="Fortune cookie" to="${project.name.capitalized}" />
231
					<replacestring from="fortune cookie" to="${project.name.capitalized}" />
232
					<replacestring from="gvsig-fortunecookie" to="gvsig-${project.name.lowercase}" />
233
					<replacestring from="fortunecookie" to="${project.name.capitalized}" />
234
				</tokenfilter>
235
				<tokenfilter>
236
					<!-- Restore the fortune cookie server URL -->
237
					<replacestring from="FC_URL_TO_PRESERVE" to="http://www.fullerdata.com/FortuneCookie/FortuneCookie.asmx/GetFortuneCookie" />
238
				</tokenfilter>
239
			</filterchain>
240
		</move>
241
		
242
	</target>
243

  
244

  
245
</project>
0 246

  
tags/v_2_0_0_Build_2043/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" file="${ant.file.gvSIG-make-maven-project}" />
6

  
7
	<!-- Libraries folder in the gvSIG extension -->
8
	<property name="lib.folder" location="${gvSIG-make-maven-project.basedir}/../lib" />
9
	<!-- Templates folder in the gvSIG extension -->
10
	<property name="templates.folder" location="${gvSIG-make-maven-project.basedir}/../templates" />
11

  
12
	<property name="gvsiglogo" location="${basedir}/../gvSIG.png" />
13

  
14
	<!-- Load some ant external utility tasks -->
15
	<property name="antform.lib" location="${lib.folder}/antform-2.0.jar" />
16
	<property name="antcontrib.lib" location="${lib.folder}/ant-contrib-1.0b3.jar" />
17
	<property name="antelope.lib" location="${lib.folder}/antelopetasks-3.2.10.jar" />
18

  
19
	<property name="form.width" value="700" />
20
	<property name="form.height" value="550" />
21
	<property name="form.columns" value="40" />
22

  
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" classname="com.sardak.antform.AntForm" classpath="${antform.lib}" />
31

  
32
	<taskdef name="antmenu" classname="com.sardak.antform.AntMenu" classpath="${antform.lib}" />
33

  
34
	<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpath="${antelope.lib}" />
35

  
36

  
37
	<!-- 
38
	================ begin specific code of templates ================= 
39
	-->
40
	<property name="template.fortunecookies.option" value="1 - General project based on Fortune cookies example project" />
41
	<property name="template.fortunecookies.description1" value="Create a general pourpose project with the multimodule" />
42
	<property name="template.fortunecookies.description2" value="structure. Can select some opcions in this project like if need" />
43
	<property name="template.fortunecookies.description3" value="a extension, services, ..." />
44

  
45
	<property name="template.landregistryviewer.option" value="2 - Basic plugin with spatial support" />
46
	<property name="template.landregistryviewer.description1" value="Create a project based in the LandRegistryViewer example." />
47
	<property name="template.landregistryviewer.description2" value="Uses access to View, MapControl and datasources." />
48
	<property name="template.landregistryviewer.description3" value="" />
49

  
50
	<property name="templates" value="fortunecookies,landregistryviewer" />
51
	<!-- 
52
	================ End specific code of templates ================= 
53
	-->
54

  
55
	<target name="mkproject" depends="mkproject-prompt-basic-data">
56
		<description>Creates a new gvSIG project</description>
57
	</target>
58

  
59
	<target name="mkproject-prompt-basic-data">
60

  
61
		<property name="project.group.id" value="org.gvsig" />
62

  
63
		<antform title="Create project" width="${form.width}" image="${gvsiglogo}">
64
			<textProperty label="" editable="false" columns="${form.columns}" property="form.title" />
65
			<textProperty label="Name : " property="project.name" required="true" />
66
			<label>                               For the project name, use the java class naming rules. 
67
                               Ex: FortuneCookie or LandRegistryViewer</label>
68
			<textProperty label="Group Id : " property="project.group.id" required="true" />
69

  
70
			<fileSelectionProperty label="Create project in : " property="project.folder" directoryChooser="true" editable="false" required="true" />
71
			<separator />
72
			<label>Select the template to use:</label>
73

  
74
			<!-- 
75
			================ begin specific code of templates ================= 
76
			-->
77
			<checkSelectionProperty property="template.landregistryviewer.check" values="${template.landregistryviewer.option}" label="" />
78
			<label>                                         ${template.landregistryviewer.description1}
79
                                         ${template.landregistryviewer.description2}
80
                                         ${template.landregistryviewer.description3}</label>
81

  
82
			<checkSelectionProperty property="template.fortunecookies.check" values="${template.fortunecookies.option}" label="" />
83
			<label>                                         ${template.fortunecookies.description1}
84
                                         ${template.fortunecookies.description2}
85
                                         ${template.fortunecookies.description3}</label>
86
			<!-- 
87
			================ End specific code of templates ================= 
88
			-->
89
			<separator />
90
			<controlbar>
91
				<button type="cancel" label=" Cancel " target="mkproject-build-cancelled" />
92
				<button type="ok" label=" Next " target="mkproject-fixnames" />
93
			</controlbar>
94
		</antform>
95
	</target>
96

  
97
	<target name="mkproject-fixnames">
98

  
99
		<!-- Trim project name and group id -->
100
		<stringutil string="${project.name}" property="project.name">
101
			<trim />
102
		</stringutil>
103
		<stringutil string="${project.group.id}" property="project.group.id">
104
			<trim />
105
		</stringutil>
106

  
107
		<!-- Lower case project name -->
108
		<stringutil string="${project.name}" property="project.name.lowercase">
109
			<lowercase />
110
		</stringutil>
111

  
112
		<!-- Capitalize project name, just in case -->
113
		<stringutil string="${project.name}" property="project.name.capitalized.end">
114
			<substring beginindex="1" />
115
		</stringutil>
116
		<stringutil string="${project.name}" property="project.name.capitalized.beginning">
117
			<substring endindex="1" />
118
			<uppercase />
119
		</stringutil>
120
		<property name="project.name.capitalized" value="${project.name.capitalized.beginning}${project.name.capitalized.end}" />
121

  
122
		<!-- Create artifactID with project.group.id + . + project.name.lowercase -->
123
		<property name="project.artifact.id" value="${project.group.id}.${project.name.lowercase}" />
124

  
125
		<for list="${templates}" param="template">
126
			<sequential>
127
				<var name="template.name" value="@{template}" />
128
				<var name="check.name" value="template.${template.name}.check" />
129
				<propertycopy override="true" name="arg1" from="${check.name}" />
130
				<propertycopy override="true" name="arg2" from="template.${template.name}.option" />
131
				<if>
132
					<and>
133
						<isset property="selected.template" />
134
						<equals arg1="${arg1}" arg2="${arg2}" />
135
					</and>
136
					<then>
137
						<antcall target="fail">
138
							<param name="message" value="Only one template can be selected" />
139
						</antcall>
140
					</then>
141
				</if>
142
				<if>
143
					<equals arg1="${arg1}" arg2="${arg2}" />
144
					<then>
145
						<echo>selected.template = "${template.name}"</echo>
146
						<property name="selected.template" value="${template.name}" />
147
					</then>
148
				</if>
149
			</sequential>
150
		</for>
151
		<antcall target="mkproject-confirm" inheritall="true" />
152
	</target>
153

  
154
	<target name="mkproject-confirm">
155
		<antform title="Confirm the creation" width="${form.width}" image="${gvsiglogo}">
156
			<textProperty label="" editable="false" columns="${form.columns}" property="form.title" />
157
			<label>The data used for the creation of project are:</label>
158
			<textProperty label="Project" editable="false" property="project.name" />
159
			<textProperty label="Project name capitalized" editable="false" property="project.name.capitalized" />
160
			<textProperty label="Project name lowercase" editable="false" property="project.name.lowercase" />
161
			<textProperty label="Group Id" editable="false" property="project.group.id" />
162
			<textProperty label="Artifact Id" editable="false" property="project.artifact.id" />
163
			<textProperty label="Folder" editable="false" property="project.folder" />
164
			<textProperty label="Template" editable="false" property="selected.template" />
165
			<label>Continue ?</label>
166
			<separator />
167
			<controlbar>
168
				<button type="cancel" label=" Cancel " target="mkproject-build-cancelled" />
169
				<button type="ok" label=" Previous " target="mkproject-prompt-basic-data" />
170
				<button type="ok" label=" Next " target="mkproject-build" />
171
			</controlbar>
172
		</antform>
173
	</target>
174

  
175
	<target name="mkproject-build">
176
		<echo>
177
  Project name: "${project.name}"
178
  Project name capitalized: "${project.name.capitalized}"
179
  Project name lowercase: ${project.name.lowercase}"
180
  Group id: "${project.group.id}"
181
  ArtifactId: "${project.artifact.id}"
182
  Project folder: "${project.folder}"
183
  Selected template: "${selected.template}"
184
        </echo>
185
		<!--  call specific code of the selected template -->
186
		<ant antfile="${selected.template}.xml" inheritall="false">
187
			<property name="project.name" value="${project.name}" />
188
			<property name="project.name.capitalized" value="${project.name.capitalized}" />
189
			<property name="project.name.lowercase" value="${project.name.lowercase}" />
190
			<property name="project.group.id" value="${project.group.id}" />
191
			<property name="project.artifact.id" value="${project.artifact.id}" />
192
			<property name="project.folder" value="${project.folder}" />
193
			<property name="form.width" value="${form.width}" />
194
			<property name="form.height" value="${form.height}" />
195
			<property name="form.columns" value="${form.columns}" />
196
		</ant>
197
		<if>
198
			<resourceexists>
199
				<file file="${project.folder}/${project.artifact.id}" />
200
			</resourceexists>
201
			<then>
202
				<antcall target="mkproject-prepare-workspace" inheritall="true" />
203
				<antcall target="mkproject-build-succesfully" inheritall="true" />
204
			</then>
205
			<else>
206
				<antcall target="mkproject-build-cancelled" inheritall="true" />
207
			</else>
208
		</if>
209
	</target>
210

  
211
	<target name="mkproject-prepare-workspace">
212
		<ant dir="${project.folder}/${project.artifact.id}" antfile="prepare-workspace.xml" target="prepare-workspace" />
213
		<if>
214
			<resourceexists>
215
				<file file="${project.folder}/${project.artifact.id}.app" />
216
			</resourceexists>
217
			<then>
218
				<ant dir="${project.folder}/${project.artifact.id}.app" antfile="../org.gvsig.maven.base.build/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" />
219
			</then>
220
		</if>
221
	</target>
222

  
223
	<target name="mkproject-build-succesfully">
224
		<antform title="Project creation" width="${form.width}" image="${gvsiglogo}">
225
			<textProperty label="" editable="false" columns="${form.columns}" property="form.title" />
226
			<label>Project ${project.name} was created succesfully</label>
227
			<controlbar>
228
				<button type="ok" label=" Close " />
229
			</controlbar>
230
		</antform>
231
	</target>
232

  
233
	<target name="mkproject-build-cancelled">
234
		<antform title="Project creation cancelled" width="${form.width}" image="${gvsiglogo}">
235
			<textProperty label="" editable="false" columns="40" property="form.title" />
236
			<label>Creation cancelled.</label>
237
			<separator />
238
			<controlbar>
239
				<button type="cancel" label=" Close " />
240
			</controlbar>
241
		</antform>
242
	</target>
243

  
244
	<target name="fail">
245
		<echo>${message}</echo>
246
		<fail message="${message}" />
247
	</target>
248

  
249
</project>
0 250

  
tags/v_2_0_0_Build_2043/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
	<target name="prepare-templates" depends="prepare-fortunecookies,prepare-landregistryviewer"> 
6
 	</target>
7
	
8
	<!-- *************** Fortune cookies template **************** -->
9

  
10
	<target name="check-fortunecookies">
11
        <available file="${prepare-templates.build.basedir}/target/templates/downloads/fortunecookies"
12
                   type="dir"
13
                   property="fortunecookies.downloaded" />
14
    </target>
15

  
16
    <target name="download-fortunecookies"
17
            depends="check-fortunecookies"
18
            unless="fortunecookies.downloaded">
19
        <echo>Downloading fortunecookies templates...</echo>
20
        <mkdir dir="${prepare-templates.build.basedir}/target/templates/downloads/fortunecookies" />
21
        <mkdir dir="${prepare-templates.build.basedir}/target/templates-zips" />
22

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

  
41
    <target name="prepare-fortunecookies" depends="download-fortunecookies">
42
        <echo>Zipping fortunecookies...</echo>
43
    	<delete file="${prepare-templates.build.basedir}/target/templates-zips/fortunecookies-basic.zip"/>
44
    	<delete file="${prepare-templates.build.basedir}/target/templates-zips/fortunecookies-pbi.zip"/>
45
        <zip destfile="${prepare-templates.build.basedir}/target/templates-zips/fortunecookies-basic.zip"
46
             basedir="${prepare-templates.build.basedir}/target/templates/downloads/fortunecookies/basic-with-user-interface/"
47
             includes="**/*" />
48
        <zip destfile="${prepare-templates.build.basedir}/target/templates-zips/fortunecookies-pbi.zip"
49
             basedir="${prepare-templates.build.basedir}/target/templates/downloads/fortunecookies/provider-based-implementation-with-user-interface/"
50
             includes="**/*" />
51
    </target>
52

  
53
	
54
	<!-- *************** Land registry viewer template **************** -->
55

  
56
	<target name="check-landregistryviewer">
57
        <available file="${prepare-templates.build.basedir}/target/templates/downloads/landregistryviewer"
58
                   type="dir"
59
                   property="landregistryviewer.downloaded" />
60
    </target>
61

  
62
    <target name="download-landregistryviewer"
63
            depends="check-landregistryviewer"
64
            unless="landregistryviewer.downloaded">
65
        <echo>Downloading landregistryviewer template...</echo>
66
        <mkdir dir="${prepare-templates.build.basedir}/target/templates/downloads/landregistryviewer" />
67
        <mkdir dir="${prepare-templates.build.basedir}/target/templates-zips" />
68

  
69
        <java classname="org.tmatesoft.svn.cli.SVN"
70
              classpath="${runtime_classpath}"
71
              dir="${prepare-templates.build.basedir}/target/templates/downloads/landregistryviewer/"
72
              fork="true"
73
              failonerror="true">
74
            <arg value="export" />
75
            <arg value="https://devel.gvsig.org/svn/gvsig-plugintemplates/org.gvsig.landregistryviewer/trunk/org.gvsig.landregistryviewer" />
76
        </java>
77
        <java classname="org.tmatesoft.svn.cli.SVN"
78
              classpath="${runtime_classpath}"
79
              dir="${prepare-templates.build.basedir}/target/templates/downloads/landregistryviewer/"
80
              fork="true"
81
              failonerror="true">
82
            <arg value="export" />
83
            <arg value="https://devel.gvsig.org/svn/gvsig-plugintemplates/org.gvsig.landregistryviewer.app/trunk/org.gvsig.landregistryviewer.app" />
84
        </java>
85
    </target>
86

  
87
    <target name="prepare-landregistryviewer" depends="download-landregistryviewer">
88
        <echo>Zipping landregistryviewer...</echo>
89
    	<delete file="${prepare-templates.build.basedir}/target/templates-zips/landregistryviewer.zip"/>
90
        <zip destfile="${prepare-templates.build.basedir}/target/templates-zips/landregistryviewer.zip"
91
             basedir="${prepare-templates.build.basedir}/target/templates/downloads/landregistryviewer/"
92
             includes="**/*" />
93
    </target>
94

  
95
	
96
</project>
tags/v_2_0_0_Build_2043/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" value="${org.gvsig.initial.build.basedir}/.." />
6
	<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" />
7
	<property name="build.jar.version" value="1.0.8-SNAPSHOT" />
8
	<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
9

  
10
	<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" />
11

  
12
	<target name="check-maven-base-build-available">
13
		<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" />
14
	</target>
15

  
16
	<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available">
17
		<!-- Unzip de build jar file from the maven repository into the workspace root folder -->
18
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
19
			<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}">
20
				<patternset>
21
					<exclude name="META-INF/**" />
22
				</patternset>
23
			</zipfileset>
24
		</copy>
25
	</target>
26

  
27
	<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available">
28
		<mkdir dir="target" />
29

  
30
		<!-- Download the build jar file -->
31
		<get src="http://devel.gvsig.org/m2repo/j2se/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" />
32

  
33
		<!-- Unzip de build jar file into the workspace root folder -->
34
		<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false">
35
			<zipfileset src="target/${build.jar.file}">
36
				<patternset>
37
					<exclude name="META-INF/**" />
38
				</patternset>
39
			</zipfileset>
40
		</copy>
41

  
42
	</target>
43
	
44
	<target name="find.depends.natives.file">
45
	    <condition property="depends.natives.file.exists">
46
            <available file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES"/>
47
	    </condition>	
48
	</target>
49
	
50
	<target name="find.gvsig.platform.properties.file" 
51
			depends="find.depends.natives.file"
52
			if="depends.natives.file.exists">
53
	    <condition property="gvsig.platform.exists">
54
            <available file="${user.home}/.gvsig.platform.properties"/>
55
	    </condition>	
56
	</target>
57
	
58
	<target name="check.gvsig.platform.properties" 
59
			depends="find.gvsig.platform.properties.file">
60
		<fail if="depends.natives.file.exists" unless="gvsig.platform.exists">
61
ERROR!!
62
	
63
You have to define your gvSIG platform properties, 
64
by creating the file: ${user.home}/.gvsig.platform.properties
65
with the following content:
66

  
67
native_platform=linux
68
native_distribution=all
69
native_compiler=gcc4
70
native_arch=i386
71
native_libraryType=dynamic
72
export native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType}
73

  
74
Replace the fifth initial variables values with the ones appropiate 
75
to your platform.
76
	
77
If you use maven in the command line, you can use the previous file also
78
to define the MAVEN_OPTS environment variable, by adding to your 
79
.bash_rc file something like this:
80

  
81
if [ -f "${HOME}/.gvsig.platform.properties" ]
82
then
83
    . ${HOME}/.gvsig.platform.properties
84
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m -Dnative-classifier=${native_classifier}"
85
else
86
    export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m"
87
fi
88

  
89
It will work if you use the bash shell. In any other case or platform, you'll
90
have to define your MAVEN_OPTS environment variable and set the 
91
"native-classifier" parameter directly.
92
		</fail>			
93
	
94
	</target>
95

  
96
	<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties">
97

  
98
		<mkdir dir="target" />
99

  
100
		<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" />
101

  
102
		<!-- Copy the maven launchers to the workspace metadata folder -->
103
		<copy todir="${workspace.basedir}/.metadata">
104
			<fileset dir="${build.basedir}/eclipse-launchers">
105
				<exclude name="**/org.eclipse.jdt.core.prefs" />
106
				<exclude name="**/org.eclipse.core.variables.prefs" />
107
			</fileset>
108
		</copy>
109

  
110
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true">
111
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" />
112
		</concat>
113
		<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true">
114
			<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" />
115
		</concat>
116

  
117
		<!-- Configure the eclipse workspace -->
118
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" />
119

  
120
		<!-- Configure the gvSIG profile -->
121
		<ant antfile="${build.basedir}/check-gvsig-profile.xml" />
122

  
123
		<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" />
124

  
125
		<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
126
			<classpath>
127
				<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" />
128
			</classpath>
129
		</taskdef>
130

  
131
		<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}">
132
			<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" />
133
		</xmltask>
134

  
135
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
136
		<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" />
137

  
138
		<!-- Compile, install and generate eclipse projects -->
139
		<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" />
140

  
141
		<echo>INFORMATION!!!</echo>
142
		<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo>
143

  
144
		<!-- TODO: copiar al proyecto de configuraciĆ³n general -->
145
	</target>
146

  
147
	<target name="clean">
148
		<delete dir="target" />
149
	</target>
150
	
151
</project>
0 152

  
tags/v_2_0_0_Build_2043/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
    <artifactId>org.gvsig.mkmvnproject</artifactId>
7
    <packaging>jar</packaging>
8
    <version>2.0-SNAPSHOT</version>
9
    <name>Development project wizard</name>
10
    <description>
11
        Utilities and gvSIG plugin to create new gvSIG projects from a template
12
    </description>
13
    <parent>
14
        <groupId>org.gvsig</groupId>
15
        <artifactId>org.gvsig.maven.base.extension.pom</artifactId>
16
        <version>1.0.8-SNAPSHOT</version>
17
    </parent>
18
    <scm>
19
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.mkmvnproject</connection>
20
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/extensions/org.gvsig.mkmvnproject</developerConnection>
21
        <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/extensions/org.gvsig.mkmvnproject</url>
22
    </scm>
23
    <developers>
24
        <developer>
25
            <id>jjdelcerro</id>
26
            <name>Joaqu?n Jos? del Cerro</name>
27
            <email>jjdelcerro@gvsig.org</email>
28
            <roles>
29
                <role>Architect</role>
30
                <role>Developer</role>
31
            </roles>
32
        </developer>
33
        <developer>
34
            <id>jbadia</id>
35
            <name>Jos? Bad?a</name>
36
            <email>badia_jos@gva.es</email>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff