Statistics
| Revision:

root / branches / v2_0_0_prep / build / ant-tasks / subversion-tasks.xml @ 31337

History | View | Annotate | Download (7.67 KB)

1
<project name="gvSIG-subversion-tasks" default="svn.checkout.all"
2
        xmlns:artifact="antlib:org.apache.maven.artifact.ant">
3

    
4
        <dirname property="gvSIG-subversion-tasks.basedir" file="${ant.file.gvSIG-subversion-tasks}" />
5
        <import file="${gvSIG-subversion-tasks.basedir}/ant-tasks-config.xml" />
6

    
7
        <description>
8
                Ant tasks and macros to interact with subversion
9
        </description>
10

    
11
        <!-- Subversion targets -->
12
        <target name="svn.checkout.all" 
13
                depends="svn.checkout.allprojects,eclipse.projects"
14
                description="Checkouts all projects defined in a parent module pom.xml">
15
                <echo>
16
Note:
17
  Once the process has finished, import the projects into your
18
  eclipse workspace.</echo>
19
        </target>
20
                
21
        <target name="svn.checkout.allprojects" depends="svn.getparams">
22

    
23
                <artifact:pom id="pom" file="pom.xml" />
24
                <for list="${pom.modules}" param="svn.module" delimiter=",[]" trim="true">
25
                        <sequential>
26
                                <var name="svn.isgroup" unset="true" />
27
                                <propertyregex property="svn.module" input="@{svn.module}"
28
                                        regexp="[./]*(.*)" replace="\1" casesensitive="false" 
29
                                        override="true" />
30
                                <available file="${build.folder}/projects/${svn.module}" 
31
                                        property="svn.isgroup" />
32
                                <antcall target="svn.checkout.group">
33
                                        <param name="svn.module" value="${svn.module}" />
34
                                </antcall>
35
                                <antcall target="svn.checkout.project">
36
                                        <param name="svn.module" value="${svn.module}" />
37
                                </antcall>
38
                        </sequential>
39
                </for>
40
        </target>
41
        
42
        <target name="eclipse.projects" if="create.eclipse.projects">
43
                <!-- Create the eclipse project configuration for all downloaded projects -->
44
                <if>
45
                        <equals arg1="${create.eclipse.projects}" arg2="true" />
46
                        <then>
47
                                <maven arg="-P eclipse-project" />
48
                        </then>
49
                </if>
50
        </target>
51

    
52
        <target name="svn.update.all" 
53
                description="Updates all projects defined in a parent module pom.xml">
54
                <artifact:pom id="pom" file="pom.xml" />
55
                <for list="${pom.modules}" param="svn.module" delimiter=",[]" trim="true">
56
                        <sequential>
57
                                <var name="svn.isgroup" unset="true" />
58
                                <propertyregex property="svn.module" input="@{svn.module}"
59
                                        regexp="[./]*(.*)" replace="\1" casesensitive="false" 
60
                                        override="true" />
61
                                <available file="${build.folder}/projects/${svn.module}" 
62
                                        property="svn.isgroup" />
63
                                <antcall target="svn.update.group">
64
                                        <param name="svn.module" value="${svn.module}" />
65
                                </antcall>
66
                                <antcall target="svn.update.project">
67
                                        <param name="svn.module" value="${svn.module}" />
68
                                </antcall>
69
                        </sequential>
70
                </for>
71
        </target>
72

    
73
        <target name="svn.checkout.group" if="svn.isgroup">
74
                <echo>group: ${svn.module}</echo>
75
                <ant dir="${build.folder}/projects/${svn.module}" 
76
                        target="svn.checkout.allprojects" />
77
        </target>
78

    
79
        <target name="svn.checkout.project" unless="svn.isgroup" 
80
                depends="svn.get.project.path">
81
                <echo>project: ${svn.module}</echo>
82
                <antcall target="svn.checkout">
83
                        <param name="svn.project.path" value="${workspace_loc}" />
84
                        <param name="svn.project.url" 
85
                                value="${svn.repository.url}/${svn.module}" />
86
                </antcall>
87
        </target>
88

    
89
        <target name="svn.update.group" if="svn.isgroup">
90
                <echo>group: ${svn.module}</echo>
91
                <ant dir="${build.folder}/projects/${svn.module}" target="svn.update.all" />
92
        </target>
93

    
94
        <target name="svn.update.project" unless="svn.isgroup" 
95
                depends="svn.get.project.path">
96
                <echo>project: ${svn.module}</echo>
97
                <antcall target="svn.update">
98
                        <param name="svn.project.path" value="${workspace_loc}" />
99
                        <param name="svn.project.url" 
100
                                value="${svn.repository.url}/${svn.module}" />
101
                </antcall>
102
        </target>
103

    
104
        <target name="svn.checkout">
105
                <echo>url: ${svn.project.url}</echo>
106
                <echo>SVNKit version: ${svnkit.version}</echo>
107
                <java classname="org.tmatesoft.svn.cli.SVN" dir="${svn.project.path}"
108
                        fork="true" failonerror="true">
109
                        <arg value="co" />
110
                        <arg value="--username" />
111
                        <arg value="${svn.username}" />
112
                        <arg value="--password" />
113
                        <arg value="${svn.password}" />
114
                        <arg value="${svn.project.url}" />
115
                        <classpath>
116
                                <pathelement location="${ant.libs.dir}/svnkit-${svnkit.version}.jar" />
117
                                <pathelement location="${ant.libs.dir}/svnkit-cli-${svnkit.version}.jar" />
118
                        </classpath>
119
                </java>
120
        </target>
121

    
122
        <target name="svn.update">
123
                <java classname="org.tmatesoft.svn.cli.SVN" dir="${svn.project.path}"
124
                        fork="true" failonerror="true">
125
                        <arg value="update" />
126
                        <arg value="${svn.module}" />
127
                        <classpath>
128
                                <pathelement location="${ant.libs.dir}/svnkit-${svnkit.version}.jar" />
129
                                <pathelement location="${ant.libs.dir}/svnkit-cli-${svnkit.version}.jar" />
130
                        </classpath>
131
                </java>
132
        </target>
133

    
134
        <!-- 
135
                Get subversion parameters using the AntForms utility:
136
                http://antforms.sourceforge.net/
137
        -->
138
        <target name="svn.getparams" unless="svn.repository.url">
139
                <!-- Default values -->
140
                <property name="create.eclipse.projects" value="true"/>
141

    
142
                <!--
143
                        <property name="svn.username" value="guest"/> <property name="svn.password"
144
                        value="guest"/>
145
                -->
146
                <antform title="SVN parameters" image="${gvsiglogo}" resetMessage="Cancel"
147
                        previousTarget="cancel">
148

    
149
                        <label>Select one SVN url to the branch to checkout and a svn user and password.</label>
150
                        <selectionProperty label="SVN url to the branch to checkout: "
151
                                property="svn.repository.url"
152
                                values="Public - http://subversion.gvsig.org/gvSIG/branches/v2_0_0_prep;Development - https://gvsig.org/svn/gvSIG/branches/v2_0_0_prep"
153
                                separator=";" />
154

    
155
                        <label>
156
Note:
157
  Select the SVNKit version which relates to the SVN version of the other SVN 
158
  clients you are using, like the SVN command line client or Eclipse. In the
159
  case of Eclipse, you have to install a version of the Subclipse plugin which 
160
  provides the same SVNKit version as the one selected, or to install the 
161
  Subversive plugin and configure it to use the selected SVNKit version in the
162
  plugin preferences.
163
                                
164
  The relationship with the subversion version is :
165
          SVNKit 1.1.7 -> Subversion 1.4 -> ¿? 
166
          SVNKit 1.2.3 -> Subversion 1.5 -> Subclipse 1.4.*
167
          SVNKit 1.3.0 -> Subversion 1.6 -> Subclipse 1.6.*
168
                                
169
  In the case of Subversive, you can select the SVNKit version in the eclipse preferences:
170
        Team > SVN > SVN Connector
171
                        </label>
172

    
173
                        <selectionProperty label="SVNKit version to use: "
174
                                property="svnkit.version"
175
                                values="1.2.3;1.1.7;1.3.0"
176
                                separator=";" />
177

    
178
                        <textProperty label="SVN user name: " property="svn.username"
179
                                password="false" />
180
                        <textProperty label="SVN user password: " property="svn.password"
181
                                password="true" />
182
                        <booleanProperty label="Create eclipse projects after checking out"
183
                                property="create.eclipse.projects" />
184
                        <label>
185
Note:
186
  Once the process has finished, import the projects into your eclipse workspace.
187
                        </label>
188
                </antform>
189
                <propertyregex property="svn.repository.url" input="${svn.repository.url}"
190
                        regexp="[^-]*-\s(.*)" select="\1" casesensitive="false" override="true" />
191
        </target>
192

    
193
        <target name="svn.get.project.path">
194
                <description>
195
                        Converts a project name to a project path in subversion.
196
                        Ej: libTools -> libraries/libTools
197
                </description>
198
                <propertyregex property="svn.module" input="${svn.module}"
199
                        regexp="^lib.*" replace="libraries/\0" casesensitive="false" 
200
                        override="true" />
201
                <propertyregex property="svn.module" input="${svn.module}"
202
                        regexp="^ext.*" replace="extensions/\0" casesensitive="false" 
203
                        override="true" />
204
                <propertyregex property="svn.module" input="${svn.module}"
205
                        regexp="^app.*" replace="applications/\0" casesensitive="false" 
206
                        override="true" />
207
                <propertyregex property="svn.module" input="${svn.module}"
208
                        regexp="^_fw.*" replace="frameworks/\0" casesensitive="false" 
209
                        override="true" />
210
                <propertyregex property="svn.module" input="${svn.module}"
211
                        regexp="^org.gvsig.symbology.*" replace="extensions/\0" 
212
                        casesensitive="false" override="true" />
213
        </target>
214
</project>