Statistics
| Revision:

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

History | View | Annotate | Download (5.8 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" depends="svn.getparams"
13
                description="Checkouts all projects defined in a parent module pom.xml">
14
                <artifact:pom id="pom" file="pom.xml" />
15
                <for list="${pom.modules}" param="svn.module" delimiter=",[]" trim="true">
16
                        <sequential>
17
                                <var name="svn.isgroup" unset="true" />
18
                                <propertyregex property="svn.module" input="@{svn.module}"
19
                                        regexp="[./]*(.*)" replace="\1" casesensitive="false" 
20
                                        override="true" />
21
                                <available file="${build.folder}/projects/${svn.module}" 
22
                                        property="svn.isgroup" />
23
                                <antcall target="svn.checkout.group">
24
                                        <param name="svn.module" value="${svn.module}" />
25
                                </antcall>
26
                                <antcall target="svn.checkout.project">
27
                                        <param name="svn.module" value="${svn.module}" />
28
                                </antcall>
29
                        </sequential>
30
                </for>
31
                <echo>Note:
32
                        Once the process has finished, import the projects into your
33
                        eclipse workspace.</echo>
34
        </target>
35

    
36
        <target name="svn.update.all" 
37
                description="Updates all projects defined in a parent module pom.xml">
38
                <artifact:pom id="pom" file="pom.xml" />
39
                <for list="${pom.modules}" param="svn.module" delimiter=",[]" trim="true">
40
                        <sequential>
41
                                <var name="svn.isgroup" unset="true" />
42
                                <propertyregex property="svn.module" input="@{svn.module}"
43
                                        regexp="[./]*(.*)" replace="\1" casesensitive="false" 
44
                                        override="true" />
45
                                <available file="${build.folder}/projects/${svn.module}" 
46
                                        property="svn.isgroup" />
47
                                <antcall target="svn.update.group">
48
                                        <param name="svn.module" value="${svn.module}" />
49
                                </antcall>
50
                                <antcall target="svn.update.project">
51
                                        <param name="svn.module" value="${svn.module}" />
52
                                </antcall>
53
                        </sequential>
54
                </for>
55
        </target>
56

    
57
        <target name="svn.checkout.group" if="svn.isgroup">
58
                <echo>group: ${svn.module}</echo>
59
                <ant dir="${build.folder}/projects/${svn.module}" 
60
                        target="svn.checkout.all" />
61
        </target>
62

    
63
        <target name="svn.checkout.project" unless="svn.isgroup" 
64
                depends="svn.get.project.path">
65
                <echo>project: ${svn.module}</echo>
66
                <antcall target="svn.checkout">
67
                        <param name="svn.project.path" value="${root.folder}" />
68
                        <param name="svn.project.url" 
69
                                value="${svn.repository.url}/${svn.module}" />
70
                </antcall>
71
        </target>
72

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

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

    
88
        <target name="svn.checkout">
89
                <echo>url: ${svn.project.url}</echo>
90
                <java classname="org.tmatesoft.svn.cli.SVN" dir="${svn.project.path}"
91
                        fork="true" failonerror="true">
92
                        <arg value="co" />
93
                        <arg value="--username" />
94
                        <arg value="${svn.username}" />
95
                        <arg value="--password" />
96
                        <arg value="${svn.password}" />
97
                        <arg value="${svn.project.url}" />
98
                        <classpath>
99
                                <pathelement location="${ant.libs.dir}/svnkit-1.2.3.jar" />
100
                                <pathelement location="${ant.libs.dir}/svnkit-cli-1.2.3.jar" />
101
                        </classpath>
102
                </java>
103
        </target>
104

    
105
        <target name="svn.update">
106
                <java classname="org.tmatesoft.svn.cli.SVN" dir="${svn.project.path}"
107
                        fork="true" failonerror="true">
108
                        <arg value="update" />
109
                        <arg value="${svn.module}" />
110
                        <classpath>
111
                                <pathelement location="${ant.libs.dir}/svnkit-1.2.3.jar" />
112
                                <pathelement location="${ant.libs.dir}/svnkit-cli-1.2.3.jar" />
113
                        </classpath>
114
                </java>
115
        </target>
116

    
117
        <target name="svn.getparams">
118
                <!--
119
                        <property name="svn.username" value="guest"/> <property name="svn.password"
120
                        value="guest"/>
121
                -->
122
                <antform title="SVN parameters" image="${gvsiglogo}" resetMessage="Cancel"
123
                        previousTarget="cancel">
124

    
125
                        <label>Select one SVN url to the branch to checkout and a svn user and password.</label>
126
                        <selectionProperty label="SVN url to the branch to checkout: "
127
                                property="svn.repository.url"
128
                                values="Public - http://subversion.gvsig.org/gvSIG/branches/v2_0_0_prep; Development - https://gvsig.org/svn/gvSIG/branches/v2_0_0_prep"
129
                                separator=";" />
130

    
131
                        <textProperty label="SVN user name: " property="svn.username"
132
                                password="false" />
133
                        <textProperty label="SVN user password: " property="svn.password"
134
                                password="true" />
135
                        <label>Note:
136
                                Once the process has finished, import the projects into your
137
                                eclipse workspace.</label>
138
                </antform>
139
                <propertyregex property="svn.repository.url" input="${svn.repository.url}"
140
                        regexp="[^-]*-\s(.*)" select="\1" casesensitive="false" override="true" />
141
        </target>
142

    
143
        <target name="svn.get.project.path">
144
                <description>
145
                        Converts a project name to a project path in subversion.
146
                        Ej: libTools -> libraries/libTools
147
                </description>
148
                <propertyregex property="svn.module" input="${svn.module}"
149
                        regexp="^lib.*" replace="libraries/\0" casesensitive="false" 
150
                        override="true" />
151
                <propertyregex property="svn.module" input="${svn.module}"
152
                        regexp="^ext.*" replace="extensions/\0" casesensitive="false" 
153
                        override="true" />
154
                <propertyregex property="svn.module" input="${svn.module}"
155
                        regexp="^app.*" replace="applications/\0" casesensitive="false" 
156
                        override="true" />
157
                <propertyregex property="svn.module" input="${svn.module}"
158
                        regexp="^_fw.*" replace="frameworks/\0" casesensitive="false" 
159
                        override="true" />
160
        </target>
161
</project>