Statistics
| Revision:

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

History | View | Annotate | Download (7.83 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
            <echo>Checking out the gvSIG projects for the group ${pom.artifactId}: ${pom.modules}</echo>
25
                <for list="${pom.modules}" param="svn.module" delimiter=",[]" trim="true">
26
                        <sequential>
27
                                <propertyregex property="svn.module" input="@{svn.module}"
28
                                        regexp="[./]*(.*)" replace="\1" casesensitive="false" 
29
                                        override="true" />
30
                            <!-- just to ignore submodules as they are already check out -->
31
                <var name="svn.issubmodule" unset="true" />
32
                <available file="${basedir}/${svn.module}" 
33
                    property="svn.issubmodule" />
34
                                <antcall target="svn.checkout.module">
35
                                        <param name="svn.module" value="${svn.module}" />
36
                                </antcall>
37
                        </sequential>
38
                </for>
39
        </target>
40
        
41
        <target name="eclipse.projects" if="create.eclipse.projects">
42
                <!-- Create the eclipse project configuration for all downloaded projects -->
43
                <if>
44
                        <equals arg1="${create.eclipse.projects}" arg2="true" />
45
                        <then>
46
                                <maven arg="-Dmaven.test.failure.ignore install" />
47
                                <maven arg="-P eclipse-project" />
48
                        </then>
49
                </if>
50
        </target>
51

    
52
        <target name="svn.update.all" depends="svn.getparams"
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
                                <propertyregex property="svn.module" input="@{svn.module}"
58
                                        regexp="[./]*(.*)" replace="\1" casesensitive="false" 
59
                                        override="true" />
60
                <!-- just to ignore submodules as they are already check out -->
61
                <var name="svn.issubmodule" unset="true" />
62
                <available file="${basedir}/${svn.module}" 
63
                    property="svn.issubmodule" />
64
                                <antcall target="svn.update.module">
65
                                        <param name="svn.module" value="${svn.module}" />
66
                                </antcall>
67
                        </sequential>
68
                </for>
69
        </target>
70
    
71
    <target name="svn.checkout.module" unless="svn.issubmodule">
72
        <var name="svn.isgroup" unset="true" />
73
        <available file="${build.folder}/projects/${svn.module}" 
74
            property="svn.isgroup" />
75
        <antcall target="svn.checkout.group">
76
            <param name="svn.module" value="${svn.module}" />
77
        </antcall>
78
        <antcall target="svn.checkout.project">
79
            <param name="svn.module" value="${svn.module}" />
80
        </antcall>
81
    </target>    
82

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

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

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

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

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

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

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

    
158
        <!-- 
159
                Get subversion parameters using the AntForms utility:
160
                http://antforms.sourceforge.net/
161
        -->
162
        <target name="svn.getparams" unless="svn.repository.url">
163
                <!-- Default values -->
164
                <property name="create.eclipse.projects" value="true"/>
165
                <property name="svn.repository.url" value="https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep"/>
166
                <!--
167
                        <property name="svn.username" value="guest"/> <property name="svn.password"
168
                        value="guest"/>
169
                -->
170
                <antform title="SVN parameters" image="${gvsiglogo}" resetMessage="Cancel"
171
                        previousTarget="cancel">
172
        
173
                        <textProperty label="gvSIG 2.0 subversion repository: " property="svn.repository.url"
174
                                password="false" editable="false" columns="38"/>
175

    
176
                        <label>
177
Note:
178
  Select the SVNKit version which relates to the SVN version of the other SVN 
179
  clients you are using, like the SVN command line client or Eclipse. In the
180
  case of Eclipse, you have to install a version of the Subclipse plugin which 
181
  provides the same SVNKit version as the one selected, or to install the 
182
  Subversive plugin and configure it to use the selected SVNKit version in the
183
  plugin preferences.
184
                                
185
  The relationship with the subversion version is :
186
          SVNKit 1.1.7 -> Subversion 1.4 -> ¿? 
187
          SVNKit 1.2.3 -> Subversion 1.5 -> Subclipse 1.4.*
188
          SVNKit 1.3.0 -> Subversion 1.6 -> Subclipse 1.6.*
189
                                
190
  In the case of Subversive, you can select the SVNKit version in the eclipse preferences:
191
        Team > SVN > SVN Connector
192
                        </label>
193

    
194
                        <selectionProperty label="SVNKit version to use: "
195
                                property="svnkit.version"
196
                                values="1.3.0;1.2.3;1.1.7"
197
                                separator=";" />
198

    
199
                        <label>
200
Note:
201
  Once the process has finished, import the projects into your eclipse workspace.
202
                        </label>
203
                </antform>
204
        </target>
205

    
206
        <target name="svn.get.project.path">
207
                <description>
208
                        Converts a project name to a project path in subversion.
209
                        Ej: libTools -> libraries/libTools
210
                </description>
211
                <property file="${gvSIG-subversion-tasks.basedir}/projects-svn-repository.properties"/>
212
                <propertycopy property="svn.module.url" from="${svn.module}" 
213
                                          override="true" silent="true"/>
214
        </target>
215
</project>