I use Mercurial as SCM, and the command hg id -i and hg id -n give's me the 
current revision id and hash. To be able to have full control on what 
version is running on the server side, we use the following ant tasks:

This one filter an "appengine-web.xml.in" file, that is under version 
control, and that has the appid and appversion as ant filter properties:

<target name="update-app-version" description="Update the appengine-web.xml 
with the current mercurial revision as app version">
<exec executable="hg" outputproperty="mercurial.changeset">
<arg value="id" />
<arg value="-i" />
</exec>
<exec executable="hg" outputproperty="mercurial.revision">
<arg value="id" />
<arg value="-n" />
</exec>
 <property name="appversion" 
value="${version}-${release}-${mercurial.revision}-${mercurial.changeset}-${stability}"
 
/>
<filter token="appid" value="${appid}" />
<filter token="appversion" value="${appversion}" />
<copy file="war/WEB-INF/appengine-web.xml.in" 
tofile="war/WEB-INF/appengine-web.xml" filtering="true" overwrite="true" />
<echo message="App version set to ${appversion}" />
</target>

And this is a modified version of the one that comes with the SDK who lets 
you set a system property as your password, giving you an automated 
deployment, if needed (like let's your CI sistem deploy new versions 
periodicaly):

<target name="deploy" depends="update-app-version" description="Uploads the 
application to App Engine.">
<java classname="com.google.appengine.tools.admin.AppCfg" fork="true" 
inputstring="${deploy.password}" failonerror="true">
<classpath>
<path location="${appengine.tools.classpath}" />
<path refid="project.classpath" />
</classpath>
<arg value="--email=${deploy.email}" />
<arg value="--passin" />
<arg value="update" />
<arg value="war" />
</java>
</target>

Just set the "deploy.email" and "deploy.password" properties either on a 
file at your home directory or as a command line argument. In our build 
file, we set the appid and base versions as properties too, giving you full 
control when deploying while keeping the defaults to make things easier.

Hope this helps.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/7ASGVakqlZMJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to