Bump version to 0.16next
[pithos-web-client] / build.xml
1 <?xml version="1.0" encoding="utf-8" ?>
2 <project name="pithos" default="main" basedir=".">
3         <description>The Pithos web client project build file</description>
4
5         <property file="build.properties"/>
6         <property file="runtime.properties"/>
7     <property name="deps.dir" value="dependencies"/>
8
9     <property name="gwt.workers" value="2"/>
10
11     <property name="gwt.version" value="2.4.0"/>
12         <property name="gwt.home" value="${deps.dir}/gwt-${gwt.version}"/>
13     <property name="gwt.filename" value="gwt-${gwt.version}.zip"/>
14     <property name="gwt.download.url" value="http://google-web-toolkit.googlecode.com/files/${gwt.filename}"/>
15
16     <property name="gwt.module.class" value="Pithos" />
17     <property name="gwt.root.package" value="gr.grnet.pithos.web" />
18     <property name="gwt.root.path" value="gr/grnet/pithos/web" />
19     <property name="gwt.module" value="${gwt.root.package}.${gwt.module.class}" />
20
21         <property name="src.dir" value="${basedir}/src"/>
22
23         <!-- Build dirs -->
24         <property name="build.dir" value="${basedir}/bin" />
25         <property name="build.classes.dir" value="${build.dir}/classes" />
26         <property name="gwt.www.dir" value="${build.dir}/www" />
27         <property name="gwt.www.admin.dir" value="${build.dir}/wwwadmin" />
28         <property name="dist.war" value="${ant.project.name}.war"/>
29         <property name="war.dir" value="${basedir}/war" />
30         <property name="war.web-inf.dir" value="${war.dir}/WEB-INF"/>
31         <property name="war.lib.dir" value="${war.web-inf.dir}/lib"/>
32
33         <!-- set classpath -->
34         <path id="project.class.path">
35         <pathelement location="${gwt.home}/gwt-user.jar"/>
36         </path>
37
38         <target name="check-dependencies" description="Checks if all dependencies are present">
39         <condition property="dependencies.present">
40             <and>
41                 <available file="${gwt.home}" type="dir"/>
42             </and>
43         </condition>
44         <echo message="dependencies.present=${dependencies.present}"/>
45     </target>
46
47     <target name="fetch-dependencies" unless="dependencies.present" description="Fetch the dpendencies if not present" depends="check-dependencies">
48         <mkdir dir="${deps.dir}"/>
49         <get src="${gwt.download.url}" dest="${deps.dir}/${gwt.filename}" usetimestamp="true"/>
50         <unzip src="${deps.dir}/${gwt.filename}" dest="${gwt.home}/.."/>
51     </target>
52
53         <target name="check-gwt-compile" description="Checks is the web gwt client sources are up-to-date with the compiled artifacts">
54                 <uptodate property="compilation-not-needed">
55                         <srcfiles dir="${src.dir}">
56                 <include name="${gwt.root.path}/**"/>
57             </srcfiles>
58                         <mergemapper to="${gwt.www.dir}/${gwt.module}/${gwt.module}.nocache.js"/>
59                 </uptodate>
60         </target>
61
62         <target name="gwt-compile" depends="check-gwt-compile, fetch-dependencies" unless="compilation-not-needed" description="Compile the gwt web client code to JavaScript">
63                 <java classname="com.google.gwt.dev.Compiler" failonerror="true" fork="true">
64                         <arg value="-localWorkers" />
65                         <arg value="${gwt.workers}" />
66                         <arg value="-war"/>
67                         <arg value="${gwt.www.dir}"/>
68                         <arg value="${gwt.module}"/>
69                         
70                     <classpath>
71                 <pathelement path="${gwt.home}/gwt-dev.jar"/>
72                 <pathelement path="${gwt.home}/gwt-user.jar" />
73                                 <path refid="project.class.path"/>
74                                 <pathelement path="${src.dir}" />
75                     </classpath>
76                 </java>
77         </target>
78     
79     <target name="main" depends="gwt-compile">
80         <!--Fix the index html file variables -->
81             <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
82                            match="CLOUDBAR_ACTIVE_SERVICE = (.*)"
83                            replace="CLOUDBAR_ACTIVE_SERVICE = '${CLOUDBAR_ACTIVE_SERVICE}';"
84                            byline="true"
85             />
86             <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
87                            match="CLOUDBAR_LOCATION = (.*)"
88                            replace="CLOUDBAR_LOCATION = &quot;${CLOUDBAR_LOCATION}&quot;;"
89                            byline="true"
90             />
91             <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
92                            match="CLOUDBAR_SERVICES = (.*)"
93                            replace="CLOUDBAR_SERVICES = &quot;${CLOUDBAR_SERVICES}&quot;;"
94                            byline="true"
95             />
96             <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
97                            match="CLOUDBAR_MENU = (.*)"
98                            replace="CLOUDBAR_MENU = &quot;${CLOUDBAR_MENU}&quot;;"
99                            byline="true"
100             />
101             <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
102                            match="loginUrl: (.*)"
103                            replace="loginUrl: &quot;${loginUrl}&quot;,"
104                            byline="true"
105             />
106             <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
107                            match="feedbackUrl: (.*)"
108                            replace="feedbackUrl: &quot;${feedbackUrl}&quot;,"
109                            byline="true"
110             />
111             <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
112                            match="authCookie: (.*)"
113                            replace="authCookie: &quot;${authCookie}&quot;,"
114                            byline="true"
115             />
116             <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
117                            match="version: (.*)"
118                            replace="version: &quot;${version}&quot;"
119                            byline="true"
120             />
121     </target>
122
123     <target name="uploadToVM" depends="main">
124         <scp todir="chstath@pithos.dev.grnet.gr:/var/www/pithos_web_client" keyfile="${ssh.key}" passphrase="${passphrase}">
125             <fileset dir="${gwt.www.dir}/${gwt.module}"/>
126         </scp>
127     </target>
128
129     <target name="uploadCSSToVM">
130         <scp todir="chstath@pithos.dev.grnet.gr:/var/www/pithos_web_client" keyfile="${ssh.key}" passphrase="${passphrase}">
131             <fileset dir="${src.dir}/${gwt.root.path}/public" includes="pithos.css"/>
132         </scp>
133     </target>
134
135   <target name="rsyncToDev">
136     <exec executable="${basedir}/rsync-to-dev.sh"></exec>
137   </target>
138
139         <target name="clean" description="Delete all build artifacts">
140                 <delete dir="${build.dir}"/>
141         </target>
142
143     <target name="distclean" depends="clean" description="Delete all downloaded dependencies">
144         <delete dir="${deps.dir}"/>
145     </target>
146
147     <target name="run-web-dev-mode" description="Run web client in development mode">
148         <java fork="true" classname="com.google.gwt.dev.DevMode" spawn="true">
149             <classpath>
150                 <pathelement location="${src.dir}"/>
151                 <pathelement location="${build.classes.dir}"/>
152                 <pathelement path="${gwt.home}/gwt-dev.jar"/>
153                 <pathelement path="${gwt.home}/gwt-user.jar" />
154                 <path refid="project.class.path"/>
155             </classpath>
156             <jvmarg value="-Xmx256M"/>
157             <jvmarg value="-Xdebug"/>
158             <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=55555"/>
159             <arg value="-war"/>
160             <arg value="${gwt.www.dir}"/>
161             <arg value="-noserver"/>
162             <arg value="-startupUrl"/>
163             <arg value="http://127.0.0.1:8080/client"/>
164             <arg value="${gwt.module}"/>
165         </java>
166     </target>
167 </project>