Fixed target to upload to VM to use properties for ssh key and passphrase
[pithos-web-client] / build.xml
1 <?xml version="1.0" encoding="utf-8" ?>
2 <project name="pithos" default="gwt-compile" basedir=".">
3         <description>The Pithos web client project build file</description>
4
5         <property file="build.properties"/>
6     <property name="deps.dir" value="dependencies"/>
7
8     <property name="gwt.workers" value="1"/>
9
10     <property name="gwt.version" value="2.1.1"/>
11         <property name="gwt.home" value="${deps.dir}/gwt-${gwt.version}"/>
12     <property name="gwt.filename" value="gwt-${gwt.version}.zip"/>
13     <property name="gwt.download.url" value="http://google-web-toolkit.googlecode.com/files/${gwt.filename}"/>
14
15     <property name="gwt.module.class" value="Pithos" />
16     <property name="gwt.root.package" value="gr.grnet.pithos.web" />
17     <property name="gwt.root.path" value="gr/grnet/pithos/web" />
18     <property name="gwt.module" value="${gwt.root.package}.${gwt.module.class}" />
19
20         <property name="src.dir" value="${basedir}/src"/>
21
22         <!-- Build dirs -->
23         <property name="build.dir" value="${basedir}/bin" />
24         <property name="build.classes.dir" value="${build.dir}/classes" />
25         <property name="gwt.www.dir" value="${build.dir}/www" />
26         <property name="gwt.www.admin.dir" value="${build.dir}/wwwadmin" />
27         <property name="dist.war" value="${ant.project.name}.war"/>
28         <property name="war.dir" value="${basedir}/war" />
29         <property name="war.web-inf.dir" value="${war.dir}/WEB-INF"/>
30         <property name="war.lib.dir" value="${war.web-inf.dir}/lib"/>
31
32         <!-- set classpath -->
33         <path id="project.class.path">
34         <pathelement location="${gwt.home}/gwt-user.jar"/>
35         </path>
36
37         <target name="check-dependencies" description="Checks if all dependencies are present">
38         <condition property="dependencies.present">
39             <and>
40                 <available file="${gwt.home}" type="dir"/>
41             </and>
42         </condition>
43         <echo message="dependencies.present=${dependencies.present}"/>
44     </target>
45
46     <target name="fetch-dependencies" unless="dependencies.present" description="Fetch the dpendencies if not present" depends="check-dependencies">
47         <mkdir dir="${deps.dir}"/>
48         <get src="${gwt.download.url}" dest="${deps.dir}/${gwt.filename}" usetimestamp="true"/>
49         <unzip src="${deps.dir}/${gwt.filename}" dest="${gwt.home}/.."/>
50     </target>
51
52         <target name="check-gwt-compile" description="Checks is the web gwt client sources are up-to-date with the compiled artifacts">
53                 <uptodate property="compilation-not-needed">
54                         <srcfiles dir="${src.dir}">
55                 <include name="${gwt.root.path}/**"/>
56             </srcfiles>
57                         <mergemapper to="${gwt.www.dir}/${gwt.module}/${gwt.module}.nocache.js"/>
58                 </uptodate>
59         </target>
60
61         <target name="gwt-compile" depends="check-gwt-compile, fetch-dependencies" unless="compilation-not-needed" description="Compile the gwt web client code to JavaScript">
62                 <java classname="com.google.gwt.dev.Compiler" failonerror="true" fork="true">
63                         <arg value="-localWorkers" />
64                         <arg value="${gwt.workers}" />
65                         <arg value="-war"/>
66                         <arg value="${gwt.www.dir}"/>
67                         <arg value="${gwt.module}"/>
68                         
69                     <classpath>
70                 <pathelement path="${gwt.home}/gwt-dev.jar"/>
71                 <pathelement path="${gwt.home}/gwt-user.jar" />
72                                 <path refid="project.class.path"/>
73                                 <pathelement path="${src.dir}" />
74                     </classpath>
75                 </java>
76         <!--move file="${gwt.www.dir}/${gwt.module}/${gwt.module.class}.html" tofile="${gwt.www.dir}/${gwt.module}/index.html"/-->
77         </target>
78
79     <target name="uploadToVM" depends="gwt-compile">
80         <scp todir="chstath@pithos.dev.grnet.gr:/var/www/pithos_web_client" keyfile="${ssh.key}" passphrase="${passphrase}">
81             <fileset dir="${gwt.www.dir}/${gwt.module}"/>
82         </scp>
83     </target>
84
85         <target name="clean" description="Delete all build artifacts">
86                 <delete dir="${build.dir}"/>
87         </target>
88
89     <target name="distclean" depends="clean" description="Delete all downloaded dependencies">
90         <delete dir="${deps.dir}"/>
91     </target>
92
93     <target name="run-web-dev-mode" description="Run web client in development mode">
94         <java fork="true" classname="com.google.gwt.dev.DevMode" spawn="true">
95             <classpath>
96                 <pathelement location="${src.dir}"/>
97                 <pathelement location="${build.classes.dir}"/>
98                 <pathelement path="${gwt.home}/gwt-dev.jar"/>
99                 <pathelement path="${gwt.home}/gwt-user.jar" />
100                 <path refid="project.class.path"/>
101             </classpath>
102             <jvmarg value="-Xmx256M"/>
103             <jvmarg value="-Xdebug"/>
104             <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=55555"/>
105             <arg value="-war"/>
106             <arg value="${gwt.www.dir}"/>
107             <arg value="-noserver"/>
108             <arg value="-startupUrl"/>
109             <arg value="http://127.0.0.1:8080/client"/>
110             <arg value="${gwt.module}"/>
111         </java>
112     </target>
113 </project>