Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / build / ant-tasks / subversion-tasks.xml @ 37825

History | View | Annotate | Download (8.52 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
                        </classpath>
141
                </java>
142
        </target>
143

    
144
        <target name="svn.update">
145
                <echo>url: ${svn.project.url}</echo>
146
                <echo>SVNKit version: ${svnkit.version}</echo>
147
                <java classname="org.tmatesoft.svn.cli.SVN" dir="${svn.project.path}"
148
                        fork="true" failonerror="true">
149
                        <arg value="--non-interactive"/>
150
                        <arg value="update" />
151
                        <arg value="${svn.module}" />
152
                        <classpath>
153
                                <pathelement location="${ant.libs.dir}/svnkit-${svnkit.version}.jar" />
154
                                <pathelement location="${ant.libs.dir}/svnkit-cli-${svnkit.version}.jar" />
155
                        </classpath>
156
                </java>
157
        </target>
158

    
159
        <target name="svn.getparams" depends="svn.getparams.form" unless="svn.repository.url">
160
            <typedef resource="com/googlecode/svntask/svntask.xml">
161
                    <classpath>
162
                                <fileset dir= "${gvSIG-subversion-tasks.basedir}" >
163
                                     <include name="svnkit-${svnkit.version}.jar"/>
164
                                     <include name="svntask-1.0.8.jar"/>
165
                             </fileset>
166
                     </classpath>
167
             </typedef>
168
                <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpath="${gvSIG-subversion-tasks.basedir}/antelopetasks-3.2.10.jar" />
169

    
170
        <svn>
171
                        <info path="${build.path}" />
172
                </svn>
173
                <stringutil string="${svn.info.url}" property="svn.repository.url">
174
                        <replace regex="/build$$" replacement="/" />
175
                </stringutil>
176
    </target>
177

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

    
207
                        <selectionProperty label="SVNKit version to use: "
208
                                property="svnkit.version"
209
                                values="1.3.0;1.2.3;1.1.7"
210
                                separator=";" />
211

    
212
                        <label>
213
Note:
214
  Once the process has finished, import the projects into your eclipse workspace.
215
                        </label>
216
                </antform>
217
        </target>
218

    
219
        <target name="svn.get.project.path">
220
                <description>
221
                        Converts a project name to a project path in subversion.
222
                        Ej: libTools -> libraries/libTools
223
                </description>
224
                <property file="${gvSIG-subversion-tasks.basedir}/projects-svn-repository.properties"/>
225
                <propertycopy property="svn.module.url.tail" from="${svn.module}" 
226
                                          override="true" silent="true"/>
227
                <property name="svn.module.url" value="${svn.repository.url}${svn.module.url.tail}"/>
228
        </target>
229
</project>