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>
5 <property file="build.properties"/>
6 <property file="runtime.properties"/>
7 <property name="deps.dir" value="dependencies"/>
9 <property name="gwt.workers" value="1"/>
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}"/>
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}" />
21 <property name="src.dir" value="${basedir}/src"/>
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"/>
33 <!-- set classpath -->
34 <path id="project.class.path">
35 <pathelement location="${gwt.home}/gwt-user.jar"/>
38 <target name="check-dependencies" description="Checks if all dependencies are present">
39 <condition property="dependencies.present">
41 <available file="${gwt.home}" type="dir"/>
44 <echo message="dependencies.present=${dependencies.present}"/>
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}/.."/>
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}/**"/>
58 <mergemapper to="${gwt.www.dir}/${gwt.module}/${gwt.module}.nocache.js"/>
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}" />
67 <arg value="${gwt.www.dir}"/>
68 <arg value="${gwt.module}"/>
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}" />
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}';"
86 <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
87 match="CLOUDBAR_LOCATION = (.*)"
88 replace="CLOUDBAR_LOCATION = "${CLOUDBAR_LOCATION}";"
91 <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
92 match="CLOUDBAR_SERVICES = (.*)"
93 replace="CLOUDBAR_SERVICES = "${CLOUDBAR_SERVICES}";"
96 <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
97 match="CLOUDBAR_MENU = (.*)"
98 replace="CLOUDBAR_MENU = "${CLOUDBAR_MENU}";"
101 <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
102 match="loginUrl: (.*)"
103 replace="loginUrl: "${loginUrl}","
106 <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
107 match="feedbackUrl: (.*)"
108 replace="feedbackUrl: "${feedbackUrl}","
111 <replaceregexp file="${gwt.www.dir}/${gwt.module}/index.html"
112 match="authCookie: (.*)"
113 replace="authCookie: "${authCookie}""
118 <target name="uploadToVM" depends="main">
119 <scp todir="chstath@pithos.dev.grnet.gr:/var/www/pithos_web_client" keyfile="${ssh.key}" passphrase="${passphrase}">
120 <fileset dir="${gwt.www.dir}/${gwt.module}"/>
124 <target name="uploadCSSToVM">
125 <scp todir="chstath@pithos.dev.grnet.gr:/var/www/pithos_web_client" keyfile="${ssh.key}" passphrase="${passphrase}">
126 <fileset dir="${src.dir}/${gwt.root.path}/public" includes="pithos.css"/>
130 <target name="clean" description="Delete all build artifacts">
131 <delete dir="${build.dir}"/>
134 <target name="distclean" depends="clean" description="Delete all downloaded dependencies">
135 <delete dir="${deps.dir}"/>
138 <target name="run-web-dev-mode" description="Run web client in development mode">
139 <java fork="true" classname="com.google.gwt.dev.DevMode" spawn="true">
141 <pathelement location="${src.dir}"/>
142 <pathelement location="${build.classes.dir}"/>
143 <pathelement path="${gwt.home}/gwt-dev.jar"/>
144 <pathelement path="${gwt.home}/gwt-user.jar" />
145 <path refid="project.class.path"/>
147 <jvmarg value="-Xmx256M"/>
148 <jvmarg value="-Xdebug"/>
149 <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=55555"/>
151 <arg value="${gwt.www.dir}"/>
152 <arg value="-noserver"/>
153 <arg value="-startupUrl"/>
154 <arg value="http://127.0.0.1:8080/client"/>
155 <arg value="${gwt.module}"/>