[armedbear-cvs] r13264 - in trunk/abcl/examples/google-app-engine: . war/WEB-INF

Mark Evenson mevenson at common-lisp.net
Sat Apr 9 07:12:48 UTC 2011


Author: mevenson
Date: Sat Apr  9 03:12:47 2011
New Revision: 13264

Log:
Fix the GAE example so that the 'ant runserver' target works.

Now invoke ABCL to compile the necessary FASL.

The web.xml descriptor contained an incorrect absolute path for the
welcome file.

In the interest of speeding up the (presumably) morecommon use case of
merely running the example, the GAE build.xml now merely checks for
the presence of 'abcl.jar' rather than invoking the main ABCL build
each time.

Modified:
   trunk/abcl/examples/google-app-engine/README
   trunk/abcl/examples/google-app-engine/build.xml
   trunk/abcl/examples/google-app-engine/war/WEB-INF/web.xml

Modified: trunk/abcl/examples/google-app-engine/README
==============================================================================
--- trunk/abcl/examples/google-app-engine/README	(original)
+++ trunk/abcl/examples/google-app-engine/README	Sat Apr  9 03:12:47 2011
@@ -5,12 +5,32 @@
 
 Running ABCL in a Google App Engine container.
 
-This example shows how to run your servlet off ABCL in general
+This example shows how to run your Java servlet off ABCL in general
 and in Google App Engine (GAE) in particular.
 
 When uploading your code to the server, be sure to put abcl.jar
 in war/WEB-INF/lib.
 
 
+Running Locally
+---------------
+
+1.  Download the [Google App Engine SDK for Java][1], unzipping the
+    distribution somewhere on your filesystem
+    (e.g. "~/work/appengine-java-sdk-1.4.3").
+
+[1]: http://googleappengine.googlecode.com/files/appengine-java-sdk-1.4.3.zip
+
+2.  Simply invoke Ant on the `build.xml' in this directory with the
+    `runserver' target, setting the `sdk.dir' JVM property to specify
+    the location of the SDK.
+
+        unix$ ant -Dsdk.dir=$HOME/work/appengine-java-sdk-1.4.3/ runserver
+
+3.  Visit `http://localhost:8080/hello' in a web browser to see the example run.
+
+
+
+
 
 

Modified: trunk/abcl/examples/google-app-engine/build.xml
==============================================================================
--- trunk/abcl/examples/google-app-engine/build.xml	(original)
+++ trunk/abcl/examples/google-app-engine/build.xml	Sat Apr  9 03:12:47 2011
@@ -1,72 +1,92 @@
 <project default="compile">
-
+  <!-- 
+       'sdk.dir' contains the location of the Google AppEngine for Java SDK
+       http://googleappengine.googlecode.com/files/appengine-java-sdk-1.4.3.zip
+  -->
   <property name="sdk.dir" 
-            location="../../../appengine-java-sdk" />
+            location="${user.home}/work/appengine-java-sdk-1.4.3/" />
   <import file="${sdk.dir}/config/user/ant-macros.xml" />
 
   <path id="project.classpath">
-	<pathelement path="war/WEB-INF/classes" />
-	<fileset dir="war/WEB-INF/lib">
-	  <include name="**/*.jar" />
-	</fileset>
-	<fileset dir="${sdk.dir}/lib">
-	  <include name="shared/**/*.jar" />
-	</fileset>
+    <pathelement path="war/WEB-INF/classes" />
+    <fileset dir="war/WEB-INF/lib">
+      <include name="**/*.jar" />
+    </fileset>
+    <fileset dir="${sdk.dir}/lib">
+      <include name="shared/**/*.jar" />
+    </fileset>
   </path>
 
   <target name="copyjars"
 	  description="Copies the App Engine and ABCL JARs to the WAR.">
-	<copy
-		todir="war/WEB-INF/lib"
-		flatten="true">
-	  <fileset dir="${sdk.dir}/lib/user">
-		  <include name="**/*.jar" />
-	  </fileset>
-	  <fileset dir="../..">
-		  <include name="dist/*.jar" />
-	  </fileset>
-	</copy>
-	<copy
-		todir="war/fasls">
-	  <fileset dir="src">
-		<include name="*.abcl" />
-	  </fileset>
-	</copy>
-  </target>
+    <copy
+        todir="war/WEB-INF/lib"
+        flatten="true">
+      <fileset dir="${sdk.dir}/lib/user">
+        <include name="**/*.jar" />
+      </fileset>
+      <fileset dir="../..">
+        <include name="dist/*.jar" />
+      </fileset>
+    </copy>
+    <copy
+        todir="war/fasls">
+      <fileset dir="src">
+        <include name="*.abcl" />
+      </fileset>
+    </copy>
+  </target>
+  
+  <target name="compile"
+          depends="compile.java,compile.lisp"/>
 
-  <target name="compile" depends="copyjars,abcl.jar"
+  <target name="compile.java" depends="copyjars,abcl.jar"
 	  description="Compiles Java source and copies other source files to the WAR.">
-	<mkdir dir="war/WEB-INF/classes" />
-	<copy todir="war/WEB-INF/classes">
-	  <fileset dir="src">
-		  <exclude name="**/*.java" />
-	  </fileset>
-	</copy>
-	<javac
-		srcdir="src"
-		destdir="war/WEB-INF/classes"
-		classpathref="project.classpath"
-                includeantruntime="false"
-		debug="on" />
-  </target>
-
-  <target name="abcl.jar">
-    <ant dir="../.." target="abcl.jar"/>
+    <mkdir dir="war/WEB-INF/classes" />
+    <copy todir="war/WEB-INF/classes">
+      <fileset dir="src">
+        <exclude name="**/*.java" />
+      </fileset>
+    </copy>
+    <javac srcdir="src"
+           destdir="war/WEB-INF/classes"
+           classpathref="project.classpath"
+           includeantruntime="false"
+           debug="on" />
+  </target>
+  
+  <property name="abcl.jar" value="${basedir}/../../dist/abcl.jar"/>
+  <target name="compile.lisp" depends="abcl.jar">
+    <java fork="true"
+          classpath="${abcl.jar}"
+          classname="org.armedbear.lisp.Main"
+          inputstring="(compile-file "${basedir}/war/WEB-INF/classes/first-servlet.lisp")">
+      <arg value="--noinit"/>
+    </java>
+  </target>
+
+  <available file="${abcl.jar}" property="abcl.jar.p"/>
+  <target name="abcl.jar" unless="abcl.jar.p">
+    <ant dir="${basedir}/../.." target="abcl.jar"/>
   </target>
 
   <target name="clean" description="Cleans all the jars and fasls.">
     <delete>
-      <fileset dir="." includes="**/*.jar" />
-      <fileset dir="." includes="**/*.class" />
-      <fileset dir="." includes="**/*.abcl" />
+      <fileset dir="${basedir}">
+        <include name="**/*.jar" />
+        <include name="**/*.class" />
+        <include name="**/*.abcl" />
+      </fileset>
     </delete>
   </target>
-  <target name="runserver" depends="compile"
+
+  <target name="runserver" 
+          depends="compile"
 	  description="Starts the development server.">
-	<dev_appserver war="war" />
+    <dev_appserver war="war" />
   </target>
   <target name="runserver-debug" depends="compile"
 	  description="Starts the development server.">
-	<dev_appserver war="war" port="8888"/>
+    <dev_appserver war="war" port="8888"/>
   </target>
 </project>
\ No newline at end of file

Modified: trunk/abcl/examples/google-app-engine/war/WEB-INF/web.xml
==============================================================================
--- trunk/abcl/examples/google-app-engine/war/WEB-INF/web.xml	(original)
+++ trunk/abcl/examples/google-app-engine/war/WEB-INF/web.xml	Sat Apr  9 03:12:47 2011
@@ -13,6 +13,6 @@
 		<url-pattern>/hello</url-pattern>
 	</servlet-mapping>
 	<welcome-file-list>
-		<welcome-file>/index.html</welcome-file>
+		<welcome-file>index.html</welcome-file>
 	</welcome-file-list>
 </web-app>
\ No newline at end of file




More information about the armedbear-cvs mailing list