Revision 29319

View differences:

branches/v2_0_0_prep/build/build.xml
1 1
<project name="gvSIG build" basedir="../.." 
2 2
		 default="mvn-configure-eclipse-workspace" 
3 3
		 xmlns:artifact="antlib:org.apache.maven.artifact.ant">
4
	
4

  
5 5
	<description>
6 6
		Ant tasks and macros to interact with maven
7 7
	</description>
8
	
8

  
9 9
	<!-- set global properties for this build -->
10 10
	<dirname file="${ant.file.Complete_build_system}" property="ant.file.Complete_build_system.dir"/>
11 11
	<dirname file="${ant.file.Complete_build_system.dir}" property="workspace_loc"/>
12
	
12

  
13 13
	<property name="mavendir" location="${ant.file.Complete_build_system.dir}/maven" />
14 14
	<!--property environment="environment"/-->
15 15
	<property name="ant.libs.dir" location="../../ant-tasks"/>
......
17 17
	<!-- ============================= -->
18 18
	<!-- External ant tasks definition -->
19 19
	<!-- ============================= -->
20
		
21
	<!-- Maven ant tasks registration -->	
20

  
21
	<!-- Maven ant tasks registration -->
22 22
	<path id="maven-ant-tasks.classpath" path="${ant.libs.dir}/maven-ant-tasks-2.0.10.jar" />
23 23
	<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
24 24
           uri="antlib:org.apache.maven.artifact.ant"
......
26 26

  
27 27
	<!-- ant-contrib library load -->
28 28
	<taskdef resource="net/sf/antcontrib/antlib.xml">
29
			<classpath>
30
				<pathelement location="${ant.libs.dir}/ant-contrib-1.0b3.jar"/>
31
				<pathelement location="${ant.libs.dir}/bcel-5.1.jar"/>
32
				<pathelement location="${ant.libs.dir}/commons-httpclient-3.0.1.jar"/>
33
				<pathelement location="${ant.libs.dir}/commons-logging-1.0.4.jar"/>
34
				<pathelement location="${ant.libs.dir}/ivy-1.3.1.jar"/>
35
			</classpath>
29
		<classpath>
30
			<pathelement location="${ant.libs.dir}/ant-contrib-1.0b3.jar"/>
31
			<pathelement location="${ant.libs.dir}/bcel-5.1.jar"/>
32
			<pathelement location="${ant.libs.dir}/commons-httpclient-3.0.1.jar"/>
33
			<pathelement location="${ant.libs.dir}/commons-logging-1.0.4.jar"/>
34
			<pathelement location="${ant.libs.dir}/ivy-1.3.1.jar"/>
35
		</classpath>
36 36
	</taskdef>
37 37

  
38 38
	<!-- Maven targets -->
39 39
	<macrodef name="maven">
40
	   <attribute name="arg" />
41
	   <sequential>
42
	   	 <echo>mvn @{arg}</echo>
43
		 <artifact:mvn mavenHome="../../maven" fork="true" failonerror="true">
44
		    <arg line="@{arg}"/>
45
		 </artifact:mvn>
46
	   </sequential>
47
	</macrodef>	
48
	
40
		<attribute name="arg" />
41
		<sequential>
42
			<echo>mvn @{arg}</echo>
43
			<artifact:mvn mavenHome="../../maven" fork="true" failonerror="true">
44
				<arg line="@{arg}"/>
45
			</artifact:mvn>
46
		</sequential>
47
	</macrodef>
48

  
49 49
	<target name="mvn-clean" 
50 50
			description="Cleans all artifacts">
51 51
		<maven arg="clean" />
......
55 55
			description="Compiles and installs">
56 56
		<maven arg="install" />
57 57
	</target>
58
	
58

  
59 59
	<target name="mvn-install-without-tests" 
60 60
		 	description="Compiles and installs without launching tests">
61 61
		<maven arg="-Dmaven.test.skip=true install" />
......
72 72
			description="Compiles, installs and deploys">
73 73
		<maven arg="deploy" />
74 74
	</target>
75
	
75

  
76 76
	<target name="mvn-configure-eclipse-workspace"
77 77
			description="Configures the eclipse workspace for maven integration">
78
		<maven arg="-Declipse.workspace='${workspace_loc}' eclipse:add-maven-repo" />
79
		<mkdir dir="${workspace_loc}/.metadata/.plugins/org.eclipse.ui.workbench" />
78

  
79
		<input message="Eclipse workspace folder to configure?:"
80
			   addproperty="eclipse.workspace"
81
			   defaultvalue="${workspace_loc}"/>
82

  
83
		<maven arg="-Declipse.workspace='${eclipse.workspace}' eclipse:add-maven-repo" />
84
		<mkdir dir="${eclipse.workspace}/.metadata/.plugins/org.eclipse.ui.workbench" />
80 85
		<copy file="metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml"  
81
			  todir="${workspace_loc}/.metadata/.plugins/org.eclipse.ui.workbench" />
86
			  todir="${eclipse.workspace}/.metadata/.plugins/org.eclipse.ui.workbench" />
82 87
	</target>
83 88

  
84 89
	<target name="mvn-eclipse-clean"
......
93 98

  
94 99
	<target name="mvn-create-library"
95 100
			description="Generates a new library project with the initial structure and configuration">
96
		
101

  
97 102
		<input message="Library maven groupId:"
98 103
			   addproperty="lib.groupId"
99 104
			   defaultvalue="org.gvsig" />
100
		
105

  
101 106
		<input message="Library maven artifactId:"
102 107
			   addproperty="lib.artifactId"/>
103
		
108

  
104 109
		<input message="Library main java package:"
105 110
			   addproperty="lib.package"
106 111
			   defaultvalue="${lib.artifactId}"/>
107
			
112

  
108 113
		<input message="Library version:"
109 114
			   addproperty="lib.version"
110 115
			   defaultvalue="2.0-SNAPSHOT" />
111
		
116

  
112 117
		<maven arg="archetype:generate -B -DarchetypeGroupId=org.gvsig -DarchetypeArtifactId=org.gvsig.library-archetype -DgroupId=${lib.groupId} -DartifactId=${lib.artifactId} -Dversion=${lib.version} -Dpackage=${lib.package}" />
113
		
118

  
114 119
		<move todir="../../../${lib.artifactId}">
115 120
			<fileset dir="${lib.artifactId}" />
116 121
		</move>
122

  
123
		<artifact:mvn pom="../../../${lib.artifactId}/pom.xml">
124
			<arg value="eclipse:eclipse" />
125
		</artifact:mvn>
117 126
	</target>
118 127

  
119 128
	<!-- Projects checkout targets -->
120
	<target name="svn.checkout.all" depends="svn.getparams" 
121
			description="Checkouts all projects defined in a parent module pom.xml">
129
	<target name="svn.checkout.all" depends="svn.getparams" description="Checkouts all projects defined in a parent module pom.xml">
122 130

  
123 131
		<artifact:pom id="pom" file="pom.xml" />
124 132
		<for list="${pom.modules}" param="svn.module" delimiter=",[]" trim="true">
125 133
			<sequential>
126 134
				<var name="svn.isgroup" unset="true"/>
127
			    <propertyregex property="svn.module"
135
				<propertyregex property="svn.module"
128 136
			              input="@{svn.module}"
129 137
			              regexp="[./]*(.*)"
130 138
			              replace="\1"
......
148 156
		<for list="${pom.modules}" param="svn.module" delimiter=",[]" trim="true">
149 157
			<sequential>
150 158
				<var name="svn.isgroup" unset="true"/>
151
			    <propertyregex property="svn.module"
159
				<propertyregex property="svn.module"
152 160
			              input="@{svn.module}"
153 161
			              regexp="[./]*(.*)"
154 162
			              replace="\1"
......
170 178
		<ant dir="../${svn.module}" target="svn.checkout.all"/>
171 179
	</target>
172 180

  
173
  <target name="svn.checkout.project" unless="svn.isgroup" 
181
	<target name="svn.checkout.project" unless="svn.isgroup" 
174 182
			depends="svn.get.project.path">
175 183
		<echo>project: ${svn.module}</echo>
176 184
		<antcall target="svn.checkout">
177 185
			<param name="svn.project.path" value="../../.."/>
178 186
			<param name="svn.project.url" value="${svn.repository.url}/${svn.module}"/>
179
	    </antcall>
180
  </target>
187
		</antcall>
188
	</target>
181 189

  
182 190
	<target name="svn.update.group" if="svn.isgroup">
183 191
		<echo>group: ${svn.module}</echo>
184 192
		<ant dir="../${svn.module}" target="svn.update.all"/>
185 193
	</target>
186 194

  
187
  <target name="svn.update.project" unless="svn.isgroup" 
195
	<target name="svn.update.project" unless="svn.isgroup" 
188 196
			depends="svn.get.project.path">
189 197
		<echo>project: ${svn.module}</echo>
190 198
		<antcall target="svn.update">
191 199
			<param name="svn.project.path" value="../../.."/>
192 200
			<param name="svn.project.url" value="${svn.repository.url}/${svn.module}"/>
193
	    </antcall>
194
  </target>
201
		</antcall>
202
	</target>
195 203

  
196
  <target name="svn.checkout">
197
  	<echo>url: ${svn.project.url}</echo>
198
    <java classname="org.tmatesoft.svn.cli.SVN" 
204
	<target name="svn.checkout">
205
		<echo>url: ${svn.project.url}</echo>
206
		<java classname="org.tmatesoft.svn.cli.SVN" 
199 207
          dir="${svn.project.path}" 
200 208
          fork="true" 
201 209
          failonerror="true">
202
      <arg value="co" />
203
      <arg value="--username"/>
204
      <arg value="${svn.username}"/>
205
	  <arg value="--password"/>
206
      <arg value="${svn.password}"/>
207
      <arg value="${svn.project.url}" />
208
        <classpath>
209
          <pathelement location="${ant.libs.dir}/svnkit-1.2.3.jar" />
210
          <pathelement location="${ant.libs.dir}/svnkit-cli-1.2.3.jar" />
211
        </classpath>
212
    </java>
213
  </target>
210
			<arg value="co" />
211
			<arg value="--username"/>
212
			<arg value="${svn.username}"/>
213
			<arg value="--password"/>
214
			<arg value="${svn.password}"/>
215
			<arg value="${svn.project.url}" />
216
			<classpath>
217
				<pathelement location="${ant.libs.dir}/svnkit-1.2.3.jar" />
218
				<pathelement location="${ant.libs.dir}/svnkit-cli-1.2.3.jar" />
219
			</classpath>
220
		</java>
221
	</target>
214 222

  
215
   <target name="svn.update">
216
	    <java classname="org.tmatesoft.svn.cli.SVN" 
223
	<target name="svn.update">
224
		<java classname="org.tmatesoft.svn.cli.SVN" 
217 225
	          dir="${svn.project.path}" 
218 226
	          fork="true" 
219 227
	          failonerror="true">
220
	      <arg value="update" />
221
	      <arg value="${svn.module}" />
222
	        <classpath>
223
	          <pathelement location="${ant.libs.dir}/svnkit-1.2.3.jar" />
224
	          <pathelement location="${ant.libs.dir}/svnkit-cli-1.2.3.jar" />
225
	        </classpath>
226
	    </java>
227
   </target>
228
			<arg value="update" />
229
			<arg value="${svn.module}" />
230
			<classpath>
231
				<pathelement location="${ant.libs.dir}/svnkit-1.2.3.jar" />
232
				<pathelement location="${ant.libs.dir}/svnkit-cli-1.2.3.jar" />
233
			</classpath>
234
		</java>
235
	</target>
228 236

  
229
  <target name="svn.getparams">
230
	  <input
237
	<target name="svn.getparams">
238
		<input
231 239
	    addproperty="svn.repository.url.option"
232 240
	  	defaultvalue="a">
233 241
	  	Select one SVN url to the branch to checkout:
234 242
	  	a) Public (http://subversion.gvsig.org/gvSIG/branches/v2_0_0_prep)
235 243
	  	b) Development (https://gvsig.org/svn/gvSIG/branches/v2_0_0_prep)
236 244
  	  </input>
237
  	
238
  	  <condition property="svn.repository.url" 
245

  
246
		<condition property="svn.repository.url" 
239 247
  	  			 value="https://gvsig.org/svn/gvSIG/branches/v2_0_0_prep"
240 248
  	  			 else="http://subversion.gvsig.org/gvSIG/branches/v2_0_0_prep">
241
  	  	<equals arg1="${svn.repository.url.option}" arg2="b"/>
242
  	  </condition>
249
			<equals arg1="${svn.repository.url.option}" arg2="b"/>
250
		</condition>
243 251

  
244
  	  <input
252
		<input
245 253
	    message="SVN user name:"
246 254
	    addproperty="svn.username"
247 255
  	    defaultvalue="guest" />
248
  	
249
	  <input
256

  
257
		<input
250 258
	    message="SVN user password:"
251 259
	    addproperty="svn.password"
252
	  	defaultvalue="guest" />	  
253
   </target>
254
	
260
	  	defaultvalue="guest" />
261
	</target>
262

  
255 263
	<target name="svn.get.project.path">
256 264
		<description>
257 265
			Converts a project name to a project path in subversion. 
258 266
			Ej: libTools -> libraries/libTools
259 267
		</description>
260
	    <propertyregex property="svn.module"
268
		<propertyregex property="svn.module"
261 269
	              input="${svn.module}"
262 270
	              regexp="^lib.*"
263 271
	              replace="libraries/\0"
264 272
	              casesensitive="false" 
265 273
	    		  override="true"/>
266
	    <propertyregex property="svn.module"
274
		<propertyregex property="svn.module"
267 275
	              input="${svn.module}"
268 276
	              regexp="^ext.*"
269 277
	              replace="extensions/\0"
270 278
	              casesensitive="false" 
271 279
	    		  override="true"/>
272
	    <propertyregex property="svn.module"
280
		<propertyregex property="svn.module"
273 281
	              input="${svn.module}"
274 282
	              regexp="^app.*"
275 283
	              replace="applications/\0"
276 284
	              casesensitive="false" 
277 285
	    		  override="true"/>
278
	    <propertyregex property="svn.module"
286
		<propertyregex property="svn.module"
279 287
	              input="${svn.module}"
280 288
	              regexp="^_fw.*"
281 289
	              replace="frameworks/\0"

Also available in: Unified diff