Statistics
| Revision:

svn-gvsig-desktop / tags / v2_0_0_Build_2060 / build / ant-tasks / subversion-tasks.xml @ 39342

History | View | Annotate | Download (9.21 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
        <property name="build.path" location="${gvSIG-subversion-tasks.basedir}/.." />
7

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

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

    
24
                <artifact:pom id="pom" file="pom.xml" />
25
            <echo>Checking out the gvSIG projects for the group ${pom.artifactId}: ${pom.modules}</echo>
26
                <for list="${pom.modules}" param="svn.module" delimiter=",[]" trim="true">
27
                        <sequential>
28
                                <propertyregex property="svn.module" input="@{svn.module}"
29
                                        regexp="[./]*(.*)" replace="\1" casesensitive="false" 
30
                                        override="true" />
31
                            <!-- just to ignore submodules as they are already check out -->
32
                <var name="svn.issubmodule" unset="true" />
33
                <available file="${basedir}/${svn.module}" 
34
                    property="svn.issubmodule" />
35
                                <antcall target="svn.checkout.module">
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="-Dmaven.test.failure.ignore install" />
48
                                <maven arg="-P eclipse-project" />
49
                        </then>
50
                </if>
51
        </target>
52

    
53
        <target name="svn.update.all" depends="svn.getparams"
54
                description="Updates all projects defined in a parent module pom.xml">
55
                <artifact:pom id="pom" file="pom.xml" />
56
                <for list="${pom.modules}" param="svn.module" delimiter=",[]" trim="true">
57
                        <sequential>
58
                                <propertyregex property="svn.module" input="@{svn.module}"
59
                                        regexp="[./]*(.*)" replace="\1" casesensitive="false" 
60
                                        override="true" />
61
                <!-- just to ignore submodules as they are already check out -->
62
                <var name="svn.issubmodule" unset="true" />
63
                <available file="${basedir}/${svn.module}" 
64
                    property="svn.issubmodule" />
65
                                <antcall target="svn.update.module">
66
                                        <param name="svn.module" value="${svn.module}" />
67
                                </antcall>
68
                        </sequential>
69
                </for>
70
        </target>
71
    
72
    <target name="svn.checkout.module" unless="svn.issubmodule">
73
        <var name="svn.isgroup" unset="true" />
74
        <available file="${build.folder}/projects/${svn.module}" 
75
            property="svn.isgroup" />
76
        <antcall target="svn.checkout.group">
77
            <param name="svn.module" value="${svn.module}" />
78
        </antcall>
79
        <antcall target="svn.checkout.project">
80
            <param name="svn.module" value="${svn.module}" />
81
        </antcall>
82
    </target>    
83

    
84
        <target name="svn.checkout.group" if="svn.isgroup">
85
                <echo>group: ${svn.module}</echo>
86
                <ant dir="${build.folder}/projects/${svn.module}" 
87
                        target="svn.checkout.allprojects" />
88
        </target>
89

    
90
        <target name="svn.checkout.project" unless="svn.isgroup" 
91
                depends="svn.get.project.path">
92
                <echo>project: ${svn.module}</echo>
93
                <antcall target="svn.checkout">
94
                        <param name="svn.project.path" value="${workspace_loc}" />
95
                        <param name="svn.project.url" value="${svn.module.url}" />
96
                </antcall>
97
        </target>
98

    
99
    <target name="svn.update.module" unless="svn.issubmodule">
100
        <var name="svn.isgroup" unset="true" />
101
        <available file="${build.folder}/projects/${svn.module}" 
102
            property="svn.isgroup" />
103
        <antcall target="svn.update.group">
104
            <param name="svn.module" value="${svn.module}" />
105
        </antcall>
106
        <antcall target="svn.update.project">
107
            <param name="svn.module" value="${svn.module}" />
108
        </antcall>
109
    </target>
110

    
111
    <target name="svn.update.group" if="svn.isgroup">
112
        <echo>group: ${svn.module}</echo>
113
        <ant dir="${build.folder}/projects/${svn.module}" target="svn.update.all" />
114
    </target>
115

    
116
        <target name="svn.update.project" unless="svn.isgroup" 
117
                depends="svn.get.project.path">
118
                <echo>project: ${svn.module}</echo>
119
                <antcall target="svn.update">
120
                        <param name="svn.project.path" value="${workspace_loc}" />
121
                        <param name="svn.project.url" value="${svn.module.url}" />
122
                </antcall>
123
        </target>
124

    
125
        <target name="svn.checkout">
126
                <echo>url: ${svn.project.url}</echo>
127
                <echo>SVNKit version: ${svnkit.version}</echo>
128
                <java classname="org.tmatesoft.svn.cli.SVN" dir="${svn.project.path}"
129
                        fork="true" failonerror="true">
130
                        <arg value="--non-interactive"/>
131
                        <arg value="co" />
132
                        <arg value="--username" />
133
                        <arg value="${svn.username}" />
134
                        <arg value="--password" />
135
                        <arg value="${svn.password}" />
136
                        <arg value="${svn.project.url}" />
137
                        <classpath>
138
                                <pathelement location="${ant.libs.dir}/svnkit-${svnkit.version}.jar" />
139
                                <pathelement location="${ant.libs.dir}/svnkit-cli-${svnkit.version}.jar" />
140
                <pathelement location="${ant.libs.dir}/sqljet-1.1.1.jar"/>
141
                <pathelement location="${ant.libs.dir}/antlr-runtime-3.4.jar"/>
142
                <pathelement location="${ant.libs.dir}/sequence-library-1.0.2.jar"/>
143
                        </classpath>
144
                </java>
145
        </target>
146

    
147
        <target name="svn.update">
148
                <echo>url: ${svn.project.url}</echo>
149
                <echo>SVNKit version: ${svnkit.version}</echo>
150
                <java classname="org.tmatesoft.svn.cli.SVN" dir="${svn.project.path}"
151
                        fork="true" failonerror="true">
152
                        <arg value="--non-interactive"/>
153
                        <arg value="update" />
154
                        <arg value="${svn.module}" />
155
                        <classpath>
156
                                <pathelement location="${ant.libs.dir}/svnkit-${svnkit.version}.jar" />
157
                                <pathelement location="${ant.libs.dir}/svnkit-cli-${svnkit.version}.jar" />
158
                <pathelement location="${ant.libs.dir}/sqljet-1.1.1.jar"/>
159
                <pathelement location="${ant.libs.dir}/antlr-runtime-3.4.jar"/>
160
                <pathelement location="${ant.libs.dir}/sequence-library-1.0.2.jar"/>
161
                        </classpath>
162
                </java>
163
        </target>
164

    
165
        <target name="svn.getparams" depends="svn.getparams.form" unless="svn.repository.url">
166
            <typedef resource="com/googlecode/svntask/svntask.xml">
167
                    <classpath>
168
                                <fileset dir= "${gvSIG-subversion-tasks.basedir}" >
169
                                     <include name="svnkit-${svnkit.version}.jar"/>
170
                    <include name="svntask-1.0.8.jar"/>
171
                    <include name="sqljet-1.1.1.jar"/>
172
                    <include name="antlr-runtime-3.4.jar"/>
173
                    <include name="sequence-library-1.0.2.jar"/>
174
                                        
175
                             </fileset>
176
                     </classpath>
177
             </typedef>
178
                <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpath="${gvSIG-subversion-tasks.basedir}/antelopetasks-3.2.10.jar" />
179

    
180
        <svn>
181
                        <info path="${build.path}" />
182
                </svn>
183
                <stringutil string="${svn.info.url}" property="svn.repository.url">
184
                        <replace regex="/build$$" replacement="/" />
185
                </stringutil>
186
    </target>
187

    
188
        <!-- 
189
                Get subversion parameters using the AntForms utility:
190
                http://antforms.sourceforge.net/
191
        -->
192
        <target name="svn.getparams.form" unless="svnkit.version">
193
                <!-- Default values -->
194
                <property name="create.eclipse.projects" value="true"/>
195
                <antform title="SVN parameters" image="${gvsiglogo}" resetMessage="Cancel"
196
                        previousTarget="cancel">
197
                        <textProperty label="" property="dumb"
198
                                password="false" editable="false" columns="38"/>
199
                        <label>
200
Note:
201
  Select the SVNKit version which relates to the SVN version of the other SVN 
202
  clients you are using, like the SVN command line client or Eclipse. In the
203
  case of Eclipse, you have to install a version of the Subclipse plugin which 
204
  provides the same SVNKit version as the one selected, or to install the 
205
  Subversive plugin and configure it to use the selected SVNKit version in the
206
  plugin preferences.
207
                                
208
  The relationship with the subversion version is :
209
          SVNKit 1.1.7 -> Subversion 1.4 -> ¿? 
210
          SVNKit 1.2.3 -> Subversion 1.5 -> Subclipse 1.4.*
211
        SVNKit 1.3.0 -> Subversion 1.6 -> Subclipse 1.6.*
212
        SVNKit 1.7.4 -> Subversion 1.7 -> Subclipse 1.7.*
213
                                
214
  In the case of Subversive, you can select the SVNKit version in the eclipse preferences:
215
        Team > SVN > SVN Connector
216
                        </label>
217

    
218
                        <selectionProperty label="SVNKit version to use: "
219
                                property="svnkit.version"
220
                                values="1.7.4-v1;1.3.0;1.2.3;1.1.7"
221
                                separator=";" />
222

    
223
                        <label>
224
Note:
225
  Once the process has finished, import the projects into your eclipse workspace.
226
                        </label>
227
                </antform>
228
        </target>
229

    
230
        <target name="svn.get.project.path">
231
                <description>
232
                        Converts a project name to a project path in subversion.
233
                        Ej: libTools -> libraries/libTools
234
                </description>
235
                <property file="${gvSIG-subversion-tasks.basedir}/projects-svn-repository.properties"/>
236
                <propertycopy property="svn.module.url.tail" from="${svn.module}" 
237
                                          override="true" silent="true"/>
238
                <property name="svn.module.url" value="${svn.repository.url}${svn.module.url.tail}"/>
239
        </target>
240
</project>