|
| 1 | +<!-- |
| 2 | + This file contains useful Ant definitions for users of App Engine. |
| 3 | + To use these macrodefs and taskdefs, import the file into your own build.xml: |
| 4 | +
|
| 5 | + <property name="appengine.sdk.dir" location="/some_dir/appengine-java-sdk-trunk"/> |
| 6 | + <import file="${appengine.sdk.dir}/config/user/ant-macros.xml"/> |
| 7 | +
|
| 8 | + For example uses of the macros, see the template project's build.xml. |
| 9 | + --> |
| 10 | +<project name="appengine-ant-macros"> |
| 11 | + |
| 12 | + <property file="ant.properties" /> |
| 13 | + <property name="appengine.tools.classpath" |
| 14 | + location="${appengine.sdk.home}/lib/appengine-tools-api.jar"/> |
| 15 | + |
| 16 | + <!-- |
| 17 | + A macrodef for dev_appserver. Use like: |
| 18 | + |
| 19 | + <dev_appserver war="${war}"/> |
| 20 | + --> |
| 21 | + <macrodef name="dev_appserver" description="Runs the App Engine Development App Server"> |
| 22 | + <attribute name="war" description="The exploded war directory containing the application"/> |
| 23 | + <attribute name="port" default="8080" description="The port the server starts on"/> |
| 24 | + <attribute name="address" default="localhost" description="The interface the server binds to"/> |
| 25 | + <element name="options" optional="true" description="Additional options for dev_appserver"/> |
| 26 | + <element name="args" optional="true" description="Additional arguments for the java task"/> |
| 27 | + |
| 28 | + <sequential> |
| 29 | + <java classname="com.google.appengine.tools.KickStart" |
| 30 | + classpath="${appengine.tools.classpath}" |
| 31 | + fork="true" failonerror="true"> |
| 32 | + <arg value="com.google.appengine.tools.development.DevAppServerMain"/> |
| 33 | + <arg value="--port=@{port}"/> |
| 34 | + <arg value="--address=@{address}"/> |
| 35 | + <options/> |
| 36 | + <arg value="@{war}"/> |
| 37 | + <args/> |
| 38 | + </java> |
| 39 | + </sequential> |
| 40 | + </macrodef> |
| 41 | + |
| 42 | + <!-- |
| 43 | + A macrodef for appcfg. Use like: |
| 44 | + |
| 45 | + <appcfg action="update" war="${war}"/> |
| 46 | +
|
| 47 | + --> |
| 48 | + <macrodef name="appcfg" description="Manages an application"> |
| 49 | + <attribute name="war" description="The exploded war directory containing the application"/> |
| 50 | + <attribute name="action" description="One of (update, rollback, update_indexes, request_logs)"/> |
| 51 | + <element name="options" optional="true" description="Options for appcfg (such as --server, --num_days, etc...)"/> |
| 52 | + <element name="args" optional="true" description="Additional arguments for the java task"/> |
| 53 | + |
| 54 | + <sequential> |
| 55 | + <java classname="com.google.appengine.tools.admin.AppCfg" |
| 56 | + classpath="${appengine.tools.classpath}" |
| 57 | + fork="true" failonerror="true"> |
| 58 | + <arg value="--disable_prompt"/> |
| 59 | + <options/> |
| 60 | + <arg value="@{action}"/> |
| 61 | + <arg value="@{war}"/> |
| 62 | + <args/> |
| 63 | + </java> |
| 64 | + </sequential> |
| 65 | + </macrodef> |
| 66 | + |
| 67 | + <!-- |
| 68 | + A taskdef for ORM enhancement. Use like: |
| 69 | + |
| 70 | + <enhance failonerror="true"> |
| 71 | + <classpath> |
| 72 | + <pathelement path="${appengine.tools.classpath}"/> |
| 73 | + <pathelement path="@{war}/WEB-INF/classes"/> |
| 74 | + <fileset dir="@{war}/WEB-INF/lib" includes="*.jar"/> |
| 75 | + </classpath> |
| 76 | + <fileset dir="@{war}/WEB-INF/classes" includes="**/*.class"/> |
| 77 | + </enhance> |
| 78 | + |
| 79 | + Alternatively, use the <enhance_war/> macrodef below. |
| 80 | + --> |
| 81 | + <taskdef name="enhance" |
| 82 | + classpath="${appengine.tools.classpath}" |
| 83 | + classname="com.google.appengine.tools.enhancer.EnhancerTask"/> |
| 84 | + |
| 85 | + <!-- |
| 86 | + A macrodef for ORM enhancement for a war. Use like: |
| 87 | + |
| 88 | + <enhance_war war="${war}"/> |
| 89 | + --> |
| 90 | + <macrodef name="enhance_war" description="Run the ORM enhancer on an exploded war"> |
| 91 | + <attribute name="war" description="The exploded war directory containing the application"/> |
| 92 | + <element name="args" optional="true" description="Additional arguments to the enhancer"/> |
| 93 | + <sequential> |
| 94 | + <!--enhance failonerror="true"> |
| 95 | + <args/> |
| 96 | + <classpath> |
| 97 | + <pathelement path="${appengine.tools.classpath}"/> |
| 98 | + <pathelement path="@{war}/WEB-INF/classes"/> |
| 99 | + <fileset dir="@{war}/WEB-INF/lib" includes="*.jar"/> |
| 100 | + </classpath> |
| 101 | + <fileset dir="@{war}/WEB-INF/classes" includes="**/*.class"/> |
| 102 | + </enhance--> |
| 103 | + </sequential> |
| 104 | + </macrodef> |
| 105 | + |
| 106 | +</project> |
0 commit comments