Statistics
| Revision:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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