Statistics
| Revision:

svn-document-layout / tags / 2059 / prepare-workspace.xml @ 46

History | View | Annotate | Download (7.27 KB)

1
<project name="org.gvsig.initial.build" default="prepare-workspace">
2

    
3
        <dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" />
4

    
5
        <property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." />
6
        <property name="build.basedir"
7
                value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" />
8
        <property name="build.jar.version" value="1.0.8-SNAPSHOT" />
9
        <property name="build.jar.file"
10
                value="org.gvsig.maven.base.build-${build.jar.version}.jar" />
11

    
12
        <property name="ant.libs.dir" location="${build.basedir}"
13
                description="Additional ant tasks libs folder" />
14

    
15
        <target name="check-maven-base-build-available">
16
                <available
17
                        file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}"
18
                        property="maven-base-build-available" />
19
        </target>
20

    
21
        <target name="get-maven-base-build-local" depends="check-maven-base-build-available"
22
                if="maven-base-build-available">
23
                <!-- Unzip de build jar file from the maven repository into the workspace 
24
                        root folder -->
25
                <copy todir="${workspace.basedir}" preservelastmodified="false"
26
                        filtering="false">
27
                        <zipfileset
28
                                src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}">
29
                                <patternset>
30
                                        <exclude name="META-INF/**" />
31
                                </patternset>
32
                        </zipfileset>
33
                </copy>
34
        </target>
35

    
36
        <target name="get-maven-base-build-remote" depends="check-maven-base-build-available"
37
                unless="maven-base-build-available">
38
                <mkdir dir="target" />
39

    
40
                <!-- Download the build jar file -->
41
                <get
42
                        src="http://devel.gvsig.org/m2repo/j2se/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}"
43
                        dest="target/${build.jar.file}" verbose="true" />
44

    
45
                <!-- Unzip de build jar file into the workspace root folder -->
46
                <copy todir="${workspace.basedir}" preservelastmodified="false"
47
                        filtering="false">
48
                        <zipfileset src="target/${build.jar.file}">
49
                                <patternset>
50
                                        <exclude name="META-INF/**" />
51
                                </patternset>
52
                        </zipfileset>
53
                </copy>
54

    
55
        </target>
56

    
57
        <target name="find.depends.natives.file">
58
                <condition property="depends.natives.file.exists">
59
                        <available
60
                                file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES" />
61
                </condition>
62
        </target>
63

    
64
        <target name="find.gvsig.platform.properties.file" depends="find.depends.natives.file"
65
                if="depends.natives.file.exists">
66
                <condition property="gvsig.platform.exists">
67
                        <available file="${user.home}/.gvsig.platform.properties" />
68
                </condition>
69
        </target>
70

    
71
        <target name="check.gvsig.platform.properties" depends="find.gvsig.platform.properties.file">
72
                <fail if="depends.natives.file.exists" unless="gvsig.platform.exists">
73
                        ERROR!!
74

    
75
                        You have to define your gvSIG platform properties,
76
                        by creating the file: ${user.home}/.gvsig.platform.properties
77
                        with the following content:
78

    
79
                        native_platform=linux
80
                        native_distribution=all
81
                        native_compiler=gcc4
82
                        native_arch=i386
83
                        native_libraryType=dynamic
84
                        export
85
                        native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType}
86

    
87
                        Replace the fifth initial variables values with the ones appropiate
88
                        to your platform.
89

    
90
                        If you use maven in the command line, you can use the previous file
91
                        also
92
                        to define the MAVEN_OPTS environment variable, by adding to your
93
                        .bash_rc file something like this:
94

    
95
                        if [ -f "${HOME}/.gvsig.platform.properties" ]
96
                        then
97
                        . ${HOME}/.gvsig.platform.properties
98
                        export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m
99
                        -Dnative-classifier=${native_classifier}"
100
                        else
101
                        export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m"
102
                        fi
103

    
104
                        It will work if you use the bash shell. In any other case or platform,
105
                        you'll
106
                        have to define your MAVEN_OPTS environment variable and set the
107
                        "native-classifier" parameter directly.
108
                </fail>
109

    
110
        </target>
111

    
112
        <target name="prepare-workspace"
113
                depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties">
114

    
115
                <mkdir dir="target" />
116

    
117
                <chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" />
118

    
119
                <!-- Copy the maven launchers to the workspace metadata folder -->
120
                <copy todir="${workspace.basedir}/.metadata">
121
                        <fileset dir="${build.basedir}/eclipse-launchers">
122
                                <exclude name="**/org.eclipse.jdt.core.prefs" />
123
                                <exclude name="**/org.eclipse.core.variables.prefs" />
124
                        </fileset>
125
                </copy>
126

    
127
                <concat
128
                        destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs"
129
                        append="true">
130
                        <filelist
131
                                dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings"
132
                                files="org.eclipse.jdt.core.prefs" />
133
                </concat>
134
                <concat
135
                        destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs"
136
                        append="true">
137
                        <filelist
138
                                dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings"
139
                                files="org.eclipse.core.variables.prefs" />
140
                </concat>
141

    
142
                <!-- Configure the eclipse workspace -->
143
                <ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" />
144

    
145
                <!-- Configure the gvSIG profile -->
146
                <ant antfile="${build.basedir}/check-gvsig-profile.xml" />
147

    
148
                <property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" />
149

    
150
                <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask"
151
                        classpath="${workspace.basedir}/org.gvsig.maven.base.build/antelopetasks-3.2.10.jar" />
152

    
153
                <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
154
                        <classpath>
155
                                <pathelement
156
                                        location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" />
157
                        </classpath>
158
                </taskdef>
159

    
160
                <xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}">
161
                        <copy
162
                                path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()"
163
                                property="current-gvsig-location" />
164
                </xmltask>
165
                <echo>current-gvsig-location = ${current-gvsig-location}</echo>
166

    
167

    
168
                <stringutil string="${current-gvsig-location}" property="current-gvsig-location">
169

    
170
                        <replace regex="\\" replacement="/" />
171
                </stringutil>
172
                <stringutil string="${workspace.basedir}" property="workspace.basedir">
173

    
174
                        <replace regex="\\" replacement="/" />
175
                </stringutil>
176

    
177
                <replace
178
                        file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs"
179
                        token="@GVSIG_HOME@" value="${current-gvsig-location}" />
180
                <replace
181
                        file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs"
182
                        token="@GVSIG_HOME@" value="${current-gvsig-location}" />
183

    
184
                <!-- Compile, install and generate eclipse projects -->
185
                <ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" 
186
                        /> 
187
                <echo>INFORMATION!!!</echo>
188
                <echo>Restart eclipse and then proceed to import the subprojects
189
                        contained into the main project</echo>
190

    
191
                <!-- TODO: copiar al proyecto de configuración general -->
192
        </target>
193

    
194
        <target name="clean">
195
                <delete dir="target" />
196
        </target>
197

    
198
</project>