more appengine infra

git-svn-id: http://google-refine.googlecode.com/svn/trunk@955 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-06-08 22:27:59 +00:00
parent 92d170d059
commit d6c9efceda
5 changed files with 169 additions and 21 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>$APPID</application>
<version>$VERSION</version>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>

View File

@ -0,0 +1,13 @@
# A default java.util.logging configuration.
# (All App Engine logging is through java.util.logging by default).
#
# To use this configuration, copy it into your application's WEB-INF
# folder and add the following to your appengine-web.xml:
#
# <system-properties>
# <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
# </system-properties>
#
# Set the default logging level for all loggers
.level = WARN

View File

@ -30,6 +30,18 @@
<not><isset property="dist.dir"/></not>
</condition>
<condition property="appengine.app_id" value="mygridworks">
<not><isset property="appengine.app_id"/></not>
</condition>
<condition property="appengine.version" value="1">
<not><isset property="appengine.version"/></not>
</condition>
<condition property="appengine.sdk.dir" value="/opt/appengine">
<not><isset property="appengine.sdk.dir"/></not>
</condition>
<property name="fullname" value="gridworks-${version}-${revision}" />
<property name="main.dir" value="${basedir}/main" />
@ -46,7 +58,8 @@
<property name="appengine.dir" value="${basedir}/appengine" />
<property name="appengine.src.dir" value="${appengine.dir}/src" />
<property name="appengine.lib.dir" value="${appengine.dir}/lib" />
<property name="appengine.webapp.dir" value="${appengine.dir}/webapp" />
<property name="appengine.lib.dir" value="${appengine.webapp.dir}/WEB-INF/lib" />
<property name="appengine.classes.dir" value="${appengine.dir}/classes" />
<property name="tests.dir" value="${main.dir}/tests" />
@ -63,12 +76,15 @@
<property name="built.webapp.name" value="webapp" />
<property name="built.webapp.dir" value="${build.dir}/${built.webapp.name}" />
<property name="built.appengine.webapp.dir" value="${build.dir}/appengine" />
<property name="mac.dir" value="${build.dir}/mac" />
<property name="windows.dir" value="${build.dir}/windows" />
<property name="linux.name" value="gridworks-${version}" />
<property name="linux.dir" value="${build.dir}/linux/${linux.name}" />
<!-- ================================================================== -->
<path id="server.class.path">
<fileset dir="${server.lib.dir}">
<include name="**/*.jar" />
@ -86,6 +102,13 @@
<pathelement location="${webapp.classes.dir}"/>
</path>
<path id="appengine.class.path">
<path refid="webapp.class.path"/>
<fileset dir="${appengine.sdk.dir}/lib">
<include name="shared/**/*.jar" />
</fileset>
</path>
<path id="tests.class.path">
<path refid="webapp.class.path"/>
<fileset dir="${server.tests.lib.dir}">
@ -93,6 +116,8 @@
</fileset>
</path>
<!-- ================================================================== -->
<target name="build_server">
<mkdir dir="${server.classes.dir}" />
<javac srcdir="${server.src.dir}" destdir="${server.classes.dir}" debug="true" includeAntRuntime="no">
@ -110,6 +135,14 @@
<copy file="${webapp.src.dir}/log4j.properties" tofile="${webapp.classes.dir}/log4j.properties"/>
</target>
<target name="build_appengine" depends="build_webapp">
<mkdir dir="${appengine.classes.dir}" />
<javac destdir="${appengine.classes.dir}" debug="true" includeAntRuntime="no">
<src path="${appengine.src.dir}"/>
<classpath refid="appengine.class.path" />
</javac>
</target>
<target name="build_tests" depends="build_webapp, build_server">
<mkdir dir="${server.tests.classes.dir}" />
<javac srcdir="${server.tests.src.dir}" destdir="${server.tests.classes.dir}" debug="true" includeAntRuntime="no">
@ -120,6 +153,8 @@
<target name="build" depends="build_server, build_webapp"/>
<!-- ================================================================== -->
<target name="jar_server" depends="build_server">
<jar destfile="${build.dir}/${fullname}-server.jar" basedir="${server.classes.dir}"/>
</target>
@ -128,8 +163,14 @@
<jar destfile="${build.dir}/${fullname}.jar" basedir="${webapp.classes.dir}"/>
</target>
<target name="jar_appengine" depends="build_appengine">
<jar destfile="${build.dir}/${fullname}-appengine.jar" basedir="${appengine.classes.dir}"/>
</target>
<target name="jar" depends="jar_server, jar_webapp"/>
<!-- ================================================================== -->
<target name="prepare_webapp" depends="jar_webapp">
<mkdir dir="${built.webapp.dir}" />
@ -291,6 +332,8 @@
</tar>
</target>
<!-- ================================================================== -->
<target name="prepare_reports">
<mkdir dir="${reports.dir}" />
</target>
@ -367,11 +410,48 @@
</jslint>
</target>
<!-- ================================================================== -->
<target name="prepare_webapp_appengine" depends="jar_appengine">
<mkdir dir="${built.appengine.webapp.dir}" />
<copy todir="${built.appengine.webapp.dir}">
<fileset dir="${webapp.dir}">
<include name="WEB-INF/lib/slf4j**"/>
<exclude name="WEB-INF/lib/slf4j-log4j*"/>
<exclude name="WEB-INF/lib-src/**"/>
<exclude name="WEB-INF/classes/**"/>
</fileset>
</copy>
<copy file="${build.dir}/${fullname}-appengine.jar" tofile="${built.appengine.webapp.dir}/WEB-INF/lib/${fullname}-appengine.jar"/>
<copy todir="${built.appengine.webapp.dir}/WEB-INF/lib" flatten="true">
<fileset dir="${appengine.sdk.dir}/lib/user">
<include name="**/*.jar" />
</fileset>
</copy>
<copy todir="${built.appengine.webapp.dir}">
<fileset dir="${appengine.webapp.dir}">
<include name="**/*"/>
</fileset>
</copy>
<replace file="${built.appengine.webapp.dir}/WEB-INF/appengine-web.xml">
<replacefilter token="$APPID" value="${appengine.app_id}"/>
<replacefilter token="$VERSION" value="${appengine.version}"/>
</replace>
</target>
<!-- ================================================================== -->
<target name="clean">
<delete file="${build.dir}/${fullname}.jar" />
<delete file="${build.dir}/${fullname}-server.jar" />
<delete dir="${server.classes.dir}" />
<delete dir="${webapp.classes.dir}" />
<delete dir="${appengine.classes.dir}" />
<delete dir="${server.tests.classes.dir}" />
</target>

View File

@ -55,27 +55,31 @@ where [options] include:
and <action> is one of
build ..................... Build Gridworks
run ....................... Run Gridworks [default]
build ............................ Build Gridworks
run .............................. Run Gridworks [default]
test ...................... Run all Gridworks tests
server_test ............... Run only the server tests
ui_test ................... Run only the UI tests
test ............................. Run all Gridworks tests
server_test ...................... Run only the server tests
ui_test .......................... Run only the UI tests
appengine_build <id> <version> ... Build Gridworks for Google App Engine
appengine_run <id> <version> ..... Run Gridworks for Google App Engine in local server
appengine_upload <id> <version>... Upload Gridworks to Google App Engine
findbugs .................. Run Findbugs against Gridworks
pmd ....................... Run PMD against Gridworks
cpd ....................... Run Copy/Paste Detection against Gridworks
jslint .................... Run JSlint against Gridworks
findbugs ......................... Run Findbugs against Gridworks
pmd .............................. Run PMD against Gridworks
cpd .............................. Run Copy/Paste Detection against Gridworks
jslint ........................... Run JSlint against Gridworks
whitespace <extension> .... Normalize whitespace in files with the given extension
mac_dist <version> ........ Make MacOSX binary distribution
windows_dist <version> .... Make Windows binary distribution
linux_dist <version> ...... Make Linux binary distribution
dist <version> ............ Make all distributions
whitespace <extension> ........... Normalize whitespace in files with the given extension
clean ..................... Clean compiled classes
distclean ................. Remove all generated files
mac_dist <version> ............... Make MacOSX binary distribution
windows_dist <version> ........... Make Windows binary distribution
linux_dist <version> ............. Make Linux binary distribution
dist <version> ................... Make all distributions
clean ............................ Clean compiled classes
distclean ........................ Remove all generated files
EOF
exit 1
@ -243,7 +247,7 @@ tools_prepare() {
mkdir $GRIDWORKS_TOOLS_DIR || error "Error while making directory $GRIDWORKS_TOOLS_DIR"
fi
}
ant_prepare() {
tools_prepare
@ -271,6 +275,18 @@ ant_prepare() {
fi
}
appengine_prepare() {
if [ -z "$APPENGINE_HOME" ]; then
error "You have to have the APPENGINE_HOME environment variable set and pointing to the local installation of the Google AppEngine SDK."
elif [ ! -f "$APPENGINE_HOME/bin/appcfg.sh" ]; then
error "Environment variable APPENGINE_HOME is set to '$APPENGINE_HOME' which doesn't point to a valid Google App Engine SDK."
fi
APPENGINE="$APPENGINE_HOME/bin/appcfg.sh"
APPENGINE_LOCAL="$APPENGINE_HOME/bin/dev_appserver.sh"
ANT_PARAMS="$ANT_PARAMS -Dappengine.sdk.dir=$APPENGINE_HOME"
}
launch4j_prepare() {
tools_prepare
@ -369,8 +385,7 @@ jslint_prepare() {
tool_download $JSLINT_URL $JSLINT_FILE $JSLINT_DIR
}
# ----------------------------------------------------------------------------------------------
ant() {
@ -551,6 +566,34 @@ server_test() {
$RUN_CMD || error "Failed passing server tests"
}
appengine_build() {
appengine_prepare
get_revision
ANT_PARAMS="-Dappengine.sdk.dir=${APPENGINE_HOME}"
if [ -z "$1" ]; then
error "Must specify the application id"
else
ANT_PARAMS="$ANT_PARAMS -Dappengine.app_id=$1"
fi
if [ "$2" ]; then
ANT_PARAMS="$ANT_PARAMS -Dappengine.version=$2"
fi
ant prepare_webapp_appengine
}
appengine_upload() {
appengine_build $1 $2
"$APPENGINE" update "$GRIDWORKS_BUILD_DIR/appengine"
}
appengine_run() {
appengine_build $1 $2
"$APPENGINE_LOCAL" "$GRIDWORKS_BUILD_DIR/appengine"
}
run() {
FORK=$1
@ -812,6 +855,9 @@ case "$ACTION" in
cpd) cpd;;
jslint) jslint;;
run) run;;
appengine_build) appengine_build $1 $2;;
appengine_run) appengine_run $1 $2;;
appengine_upload) appengine_upload $1 $2;;
mac_dist) mac_dist $1;;
windows_dist) windows_dist $1;;
linux_dist) linux_dist $1;;