PageRenderTime 17ms CodeModel.GetById 7ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/dist/build.xml

http://datanucleus-appengine.googlecode.com/
XML | 230 lines | 173 code | 23 blank | 34 comment | 0 complexity | 03c79a339cdbccd9936c1b8a02625667 MD5 | raw file
  1<?xml version="1.0" encoding="ISO-8859-1"?>
  2<project name="gae" default="testdist">
  3
  4  <property name="version.major" value="2"/>
  5  <property name="version.minor" value="1"/>
  6  <property name="version.point" value="2"/>
  7  <property name="version.rc" value="-SNAPSHOT"/>
  8  <property name="version" value="${version.major}.${version.minor}.${version.point}${version.rc}"/>
  9  <property name="zip.prefix" value="datanucleus-appengine"/>
 10  <property name="dist.target" value="../target/${zip.prefix}-${version}-dist.zip"/>
 11  <property name="orm.lib.dir" value="../lib"/>
 12  <property name="orm.tmpdist.dir" value="/tmp/testdist"/>
 13  <property name="orm.sdk.tmpdist.dir" value="${orm.tmpdist.dir}"/>
 14  <property name="orm.sdk.tmpdist.lib.dir" value="${orm.sdk.tmpdist.dir}/lib"/>
 15
 16  <target name="dist" description="Build the datanucleus appengine distribution">
 17      <exec executable="mvn" failifexecutionfails="true" failonerror="true" dir="..">
 18        <arg value="clean"/>
 19        <arg value="package"/>
 20      </exec>
 21  </target>
 22
 23  <target name="testdist" depends="dist"
 24          description="Unzip the dist, launch one of the sample apps, and hit it
 25                       with curl to make sure it is functioning properly.">
 26    <!--
 27      Setup a directory for the test distribution
 28      It should look like this:
 29      /tmp/testdist/lib
 30      /tmp/testdist/lib/appengine-tools-api.jar
 31      /tmp/testdist/lib/impl/appengine-local-runtime.jar
 32      /tmp/testdist/lib/impl/appengine-api.jar
 33      /tmp/testdist/lib/impl/appengine-api-stubs.jar
 34      /tmp/testdist/lib/shared/geronimo-servlet_2.5_spec-1.2.jar
 35      /tmp/testdist/lib/shared/geronimo-jsp_2.1_spec-1.0.1.jar
 36      /tmp/testdist/lib/shared/geronimo-el_1.0_spec-1.0.1.jar
 37      /tmp/testdist/lib/shared/appengine-local-runtime-shared.jar
 38      /tmp/testdist/lib/shared/jsp/jasper-compiler-5.0.28.jar
 39      /tmp/testdist/lib/shared/jsp/jasper-runtime-5.0.28.jar
 40      /tmp/testdist/lib/shared/jsp/commons-logging-1.1.1.jar
 41      /tmp/testdist/lib/tools/jsp
 42      /tmp/testdist/lib/agent
 43      /tmp/testdist/lib/agent/appengine-agent.jar
 44      /tmp/testdist/lib/agent/appengine-agentimpl.jar
 45      /tmp/testdist/lib/impl/agent
 46      /tmp/testdist/lib/impl/agent/appengine-agentruntime.jar
 47      /tmp/testdist/lib/user/appengine-api.jar
 48      /tmp/testdist/lib/opt/tools/appengine-local-endpoints/v1/appengine-local-endpoints.jar
 49      /tmp/testdist/lib/opt/user/appengine-local-endpoints/v1/appengine-local-endpoints.jar
 50      /tmp/testdist/lib/override/appengine-dev-jdk-overrides.jar
 51      /tmp/testdist/config/user/ant-macros.xml
 52     -->
 53    <delete dir="${orm.tmpdist.dir}"/>
 54    <mkdir dir="${orm.tmpdist.dir}"/>
 55
 56    <!-- Now setup a directory that contains the sdk jars we need to run the demos -->
 57    <mkdir dir="${orm.sdk.tmpdist.lib.dir}"/>
 58    <copy todir="${orm.sdk.tmpdist.lib.dir}">
 59      <fileset dir="${orm.lib.dir}">
 60        <include name="appengine-tools-api.jar"/>
 61      </fileset>
 62    </copy>
 63
 64    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/impl"/>
 65    <copy todir="${orm.sdk.tmpdist.lib.dir}/impl">
 66      <fileset dir="${orm.lib.dir}">
 67        <include name="appengine-local-runtime.jar"/>
 68        <include name="appengine-api-stubs.jar"/>
 69        <include name="appengine-api.jar"/>
 70      </fileset>
 71    </copy>
 72
 73    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/shared"/>
 74    <copy todir="${orm.sdk.tmpdist.lib.dir}/shared">
 75      <fileset dir="${orm.lib.dir}">
 76        <include name="appengine-local-runtime-shared.jar"/>
 77        <include name="geronimo-servlet*.jar"/>
 78        <include name="geronimo-jsp*.jar"/>
 79        <include name="geronimo-el*.jar"/>
 80      </fileset>
 81    </copy>
 82
 83    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/shared/jsp"/>
 84    <copy todir="${orm.sdk.tmpdist.lib.dir}/shared/jsp">
 85      <fileset dir="${orm.lib.dir}">
 86        <include name="repackaged-appengine-jasper-compiler-5.0.28.jar"/>
 87        <include name="repackaged-appengine-jasper-runtime-5.0.28.jar"/>
 88        <include name="repackaged-appengine-commons-logging-1.1.1.jar"/>
 89      </fileset>
 90    </copy>
 91
 92    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/agent"/>
 93    <copy todir="${orm.sdk.tmpdist.lib.dir}/agent">
 94      <fileset dir="${orm.lib.dir}">
 95        <include name="appengine-agent.jar"/>
 96        <include name="appengine-agentimpl.jar"/>
 97      </fileset>
 98    </copy>
 99
100    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/impl/agent"/>
101    <copy todir="${orm.sdk.tmpdist.lib.dir}/impl/agent">
102      <fileset dir="${orm.lib.dir}">
103        <include name="appengine-agentruntime.jar"/>
104      </fileset>
105    </copy>
106
107    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/user"/>
108    <copy todir="${orm.sdk.tmpdist.lib.dir}/user">
109      <fileset dir="${orm.lib.dir}">
110        <include name="appengine-api-1.0-sdk*.jar"/>
111      </fileset>
112    </copy>
113
114    <!-- directory just needs to exist -->
115    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/tools/jsp"/>
116
117    <mkdir dir="${orm.sdk.tmpdist.dir}/config/user"/>
118    <copy todir="${orm.sdk.tmpdist.dir}/config/user">
119      <fileset dir=".">
120        <include name="ant-macros.xml"/>
121      </fileset>
122    </copy>
123
124    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/opt/tools/appengine-local-endpoints/v1"/>
125    <copy todir="${orm.sdk.tmpdist.lib.dir}/opt/tools/appengine-local-endpoints/v1">
126      <fileset dir="${orm.lib.dir}">
127        <include name="appengine-local-endpoints.jar"/>
128      </fileset>
129    </copy>
130
131    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/opt/user/appengine-local-endpoints/v1"/>
132    <copy todir="${orm.sdk.tmpdist.lib.dir}/opt/user/appengine-local-endpoints/v1">
133      <fileset dir="${orm.lib.dir}">
134        <include name="appengine-local-endpoints.jar"/>
135      </fileset>
136    </copy>
137
138    <mkdir dir="${orm.sdk.tmpdist.dir}/config/sdk"/>
139    <copy todir="${orm.sdk.tmpdist.dir}/config/sdk">
140      <fileset dir=".">
141        <include name="logging.properties"/>
142      </fileset>
143    </copy>
144
145    <mkdir dir="${orm.sdk.tmpdist.lib.dir}/override"/>
146    <copy todir="${orm.sdk.tmpdist.lib.dir}/override">
147      <fileset dir="${orm.lib.dir}">
148        <include name="appengine-dev-jdk-overrides.jar"/>
149      </fileset>
150    </copy>
151
152    <unzip src="${dist.target}" dest="${orm.tmpdist.dir}"/>
153
154    <property name="sdk.dir" value="${orm.sdk.tmpdist.lib.dir}/.."/>
155    <parallel>
156      <daemons>
157        <ant antfile="${orm.tmpdist.dir}/demos/helloorm2/build.xml" target="runserver"
158           dir="${orm.tmpdist.dir}/demos/helloorm2/"/>
159      </daemons>
160      <sequential>
161        <sleep seconds="10"/>
162
163        <!-- create a flight -->
164        <exec executable="curl" failifexecutionfails="true" failonerror="true">
165          <arg value="-d"/>
166          <arg value="orig=BOS&amp;dest=LAX"/>
167          <arg value="http://localhost:8080/addFlight"/>
168        </exec>
169        <exec executable="curl" failifexecutionfails="true" failonerror="true" outputproperty="curl.add.result">
170          <arg value="http://localhost:8080"/>
171        </exec>
172        <condition property="expected.add.response">
173          <contains string="${curl.add.result}" substring="getFlight?key=1"/>
174        </condition>
175        <fail unless="expected.add.response" message="Did not get the expected add response: ${curl.add.result}${line.separator}${line.separator}    BUILD FAILED!!!!"/>
176
177         <!-- issue a jpql query -->
178        <exec executable="curl" failifexecutionfails="true" failonerror="true" outputproperty="curl.query.result">
179          <arg value="-d"/>
180          <arg value="q=SELECT f FROM com.google.appengine.demos.helloorm.Flight AS f where orig = 'BOS'"/>
181          <arg value="http://localhost:8080"/>
182        </exec>
183        <condition property="expected.query.response">
184          <contains string="${curl.query.result}" substring="getFlight?key=1"/>
185        </condition>
186        <fail unless="expected.query.response" message="Did not get the expected query response: ${curl.query.result}${line.separator}${line.separator}    BUILD FAILED!!!!"/>
187
188        <!-- switch to jdo -->
189       <exec executable="curl" failifexecutionfails="true" failonerror="true">
190         <arg value="-d"/>
191         <arg value="persistenceStandard=JDO"/>
192         <arg value="http://localhost:8080/updatePersistenceStandard"/>
193       </exec>
194        <exec executable="curl" failifexecutionfails="true" failonerror="true" outputproperty="curl.switchps.result">
195          <arg value="http://localhost:8080"/>
196        </exec>
197       <condition property="expected.switchps.response">
198         <contains string="${curl.switchps.result}" substring="Persistence standard is JDO"/>
199       </condition>
200       <fail unless="expected.switchps.response" message="Did not get the expected switchps response: ${curl.switchps.result}${line.separator}${line.separator}    BUILD FAILED!!!!"/>
201      </sequential>
202    </parallel>
203  </target>
204
205  <!-- Default value.  Properties can't change once set so if user overrides on the command
206       line this gets ignored.  This is what we want. -->
207  <property name="appengine.sdk.path" value="../../appengine-java-sdk"/>
208  <property name="appengine.sdk.lib.path" value="${appengine.sdk.path}/lib"/>
209  <property name="appengine.sdk.config.path" value="${appengine.sdk.path}/config"/>
210
211  <target name="updatesdkjars"
212          description="Pull in new sdk jars.  Assumes sdk is located at ../../appengine-java-sdk.  Pass -Dappengine.sdk.path=/path/to/sdk to override.">
213      <available file="${appengine.sdk.lib.path}" property="libDirExists"/>
214      <fail unless="libDirExists" message="${appengine.sdk.lib.path} does not exist.  Pass -Dappengine.sdk.path=/path/to/sdk to override the default sdk location."/>
215      <copy  todir="../lib" verbose="true" overwrite="true">
216        <fileset dir="${appengine.sdk.lib.path}" includes="appengine-tools-api.jar"/>
217        <fileset dir="${appengine.sdk.lib.path}/user" includes = "appengine-api-1.0-sdk*.jar"/>
218        <fileset dir="${appengine.sdk.lib.path}/impl" includes = "*.jar"/>
219        <fileset dir="${appengine.sdk.lib.path}/impl/agent" includes = "*.jar"/>
220        <fileset dir="${appengine.sdk.lib.path}/shared" includes = "appengine*.jar"/>
221        <fileset dir="${appengine.sdk.lib.path}/agent" includes = "*.jar"/>
222        <fileset dir="${appengine.sdk.lib.path}/testing" includes = "*.jar"/>
223        <fileset dir="${appengine.sdk.lib.path}/opt/tools/appengine-local-endpoints/v1" includes = "*.jar"/>
224        <fileset dir="${appengine.sdk.lib.path}/override" includes = "*.jar"/>
225      </copy>
226      <copy  todir="." verbose="true" overwrite="true">
227        <fileset dir="${appengine.sdk.config.path}/user" includes="ant-macros.xml"/>
228      </copy>
229  </target>
230</project>