Switch to appbundler & specify target Java version on build

This commit is contained in:
Tom Morris 2013-03-26 17:05:17 -04:00
parent 7813439dc8
commit ae30c19f6b
2 changed files with 42 additions and 59 deletions

View File

@ -19,6 +19,8 @@
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="java_version" value="1.6"/>
<property name="appengine.app_id" value="openrefine-broker"/>
<property name="appengine.version" value="1"/>
<property name="appengine.sdk.dir" value="/opt/appengine"/>
@ -119,7 +121,7 @@
<target name="build_server">
<mkdir dir="${server.classes.dir}" />
<javac encoding="utf-8" srcdir="${server.src.dir}" destdir="${server.classes.dir}" debug="true" includeAntRuntime="no">
<javac source="${java_version}" target="${java_version}" encoding="utf-8" srcdir="${server.src.dir}" destdir="${server.classes.dir}" debug="true" includeAntRuntime="no">
<classpath refid="server.class.path" />
</javac>
<copy file="${server.src.dir}/log4j.properties" tofile="${server.classes.dir}/log4j.properties"/>
@ -127,7 +129,7 @@
<target name="build_webapp">
<mkdir dir="${webapp.classes.dir}" />
<javac encoding="utf-8" destdir="${webapp.classes.dir}" debug="true" includeAntRuntime="no">
<javac source="${java_version}" target="${java_version}" encoding="utf-8" destdir="${webapp.classes.dir}" debug="true" includeAntRuntime="no">
<src path="${webapp.src.dir}"/>
<classpath refid="webapp.class.path" />
</javac>
@ -136,7 +138,7 @@
<target name="build_tests" depends="build_webapp, build_server">
<mkdir dir="${server.tests.classes.dir}" />
<javac encoding="utf-8" srcdir="${server.tests.src.dir}" destdir="${server.tests.classes.dir}" debug="true" includeAntRuntime="no">
<javac source="${java_version}" target="${java_version}" encoding="utf-8" srcdir="${server.tests.src.dir}" destdir="${server.tests.classes.dir}" debug="true" includeAntRuntime="no">
<classpath refid="tests.class.path" />
</javac>
<copy file="${server.tests.src.dir}/tests.log4j.properties" tofile="${server.tests.classes.dir}/tests.log4j.properties"/>
@ -150,7 +152,7 @@
<target name="build_broker_core">
<mkdir dir="${broker.core.dir}/module/MOD-INF/classes" />
<javac encoding="utf-8" destdir="${broker.core.dir}/module/MOD-INF/classes" debug="true" includeAntRuntime="no">
<javac source="${java_version}" target="${java_version}" encoding="utf-8" destdir="${broker.core.dir}/module/MOD-INF/classes" debug="true" includeAntRuntime="no">
<src path="${broker.core.dir}/src/"/>
<classpath refid="broker.class.path" />
</javac>
@ -158,7 +160,7 @@
<target name="build_broker_appengine" depends="build_broker_core">
<mkdir dir="${broker.appengine.dir}/module/MOD-INF/classes" />
<javac encoding="utf-8" destdir="${broker.appengine.dir}/module/MOD-INF/classes" debug="true" includeAntRuntime="no">
<javac source="${java_version}" target="${java_version}" encoding="utf-8" destdir="${broker.appengine.dir}/module/MOD-INF/classes" debug="true" includeAntRuntime="no">
<src path="${broker.appengine.dir}/src/"/>
<classpath refid="broker.appengine.class.path" />
</javac>
@ -221,58 +223,43 @@
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="lib/appbundler-1.0.jar" />
classpath="${appbundler.dir}/appbundler-1.0.jar" />
<bundleapp outputdirectory="${mac.dir}"
name="OpenRefine"
displayname="OpenRefine ${version}"
icon="${graphics.dir}/icon/openrefine.icns"
identifier="org.openrefine.refine.Refine"
shortversion="${version}"
mainclassname="com.google.refine.Refine">
<classpath>
<include name="${build.dir}/${fullname}-server.jar" />
<exclude name="${server.lib.dir}/**/.svn" />
<include name="${server.lib.dir}/**/*.jar" />
</classpath>
<librarypath dir="${built.webapp.dir}/..">
<include name="${built.webapp.name}/**" />
</librarypath>
mainclassname="com/google/refine/Refine">
<runtime dir="${env.JAVA_HOME}"/>
<classpath dir="${build.dir}">
<include name="${fullname}-server.jar" />
</classpath>
<classpath dir="${server.lib.dir}">
<include name="**/*.jar" />
</classpath>
<option value="-Xms256M"/>
<option value="-Xmx1024M"/>
<option value="-Drefine.version=${revision}"/>
<option value="-Drefine.webapp=$APP_ROOT/Contents/Resource/${built.webapp.name}"/>
</bundleapp>
<!--- Old jarbundler code
<taskdef
name="jarbundler"
classname="net.sourceforge.jarbundler.JarBundler"
classpath="${jarbundler.dir}/jarbundler-2.2.0.jar"
/>
<jarbundler
dir="${mac.dir}"
name="OpenRefine"
shortname="Refine"
mainclass="com.google.refine.Refine"
icon="${graphics.dir}/icon/openrefine.icns"
version="${version}"
infostring="OpenRefine ${version}"
<copy todir="${mac.dir}/OpenRefine.app/Contents/Resource">
<fileset dir="${build.dir}" id="librarypathset" >
<include name="${built.webapp.name}/**/**" />
<exclude name="**/*.class" />
</fileset>
</copy>
<!--- Options from old jarbundler code not supported by appbundler
aboutmenuname="OpenRefine"
workingdirectory="$APP_PACKAGE/Contents/Resources"
jvmversion="1.6+"
bundleid="org.openrefine.refine.Refine"
vmoptions="-Xms256M -Xmx1024M -Drefine.version=${revision}"
antialiasedgraphics="true"
antialiasedtext="true"
liveresize="true"
growboxintrudes="true"
screenmenu="true">
<jarfilelist dir="${build.dir}" files="${fullname}-server.jar" />
<jarfileset dir="${server.lib.dir}">
<exclude name="**/.svn" />
<include name="**/*.jar" />
</jarfileset>
<resourcefileset dir="${built.webapp.dir}/..">
<include name="${built.webapp.name}/**" />
</resourcefileset>
</jarbundler>
-->
</target>
@ -300,7 +287,7 @@
fileVersion="${full_version}"
txtFileVersion="${version}"
fileDescription="openrefine"
copyright="Copyright (c) 2012 OpenRefine contributors, 2010, Google, Inc."
copyright="Copyright (c) 2013 OpenRefine contributors, 2010, Google, Inc."
productVersion="${full_version}"
txtProductVersion="${full_version}"
productName="OpenRefine"

28
refine
View File

@ -372,17 +372,14 @@ launch4j_prepare() {
fi
}
jarbundler_prepare() {
appbundler_prepare() {
tools_prepare
JARBUNDLER_URL="http://www.informagen.com/JarBundler/dist/jarbundler.tar.gz"
JARBUNDLER_DIR="jarbundler-2.2.0"
JARBUNDLER_URL="http://java.net/projects/appbundler/downloads/download/appbundler-1.0.jar"
JARBUNDLER_DIR="jarbundler-1.0"
JARBUNDLER_FILE=`echo $JARBUNDLER_URL | sed 's|.*/||'`
APPBUNDLER_URL="http://java.net/projects/appbundler/downloads/download/appbundler-1.0.jar"
APPBUNDLER_DIR="."
APPBUNDLER_FILE=`echo $APPBUNDLER_URL | sed 's|.*/||'`
tool_download $JARBUNDLER_URL $JARBUNDLER_FILE $JARBUNDLER_DIR
tool_download $APPBUNDLER_URL $APPBUNDLER_FILE $APPBUNDLER_DIR
}
virtualenv_prepare() {
@ -524,15 +521,15 @@ mac_dist() {
get_version $1
get_revision
jarbundler_prepare
appbundler_prepare
ANT_PARAMS="-Djarbundler.dir=${REFINE_TOOLS_DIR}/${JARBUNDLER_DIR}"
ANT_PARAMS="-Dappbundler.dir=${REFINE_TOOLS_DIR}/${APPBUNDLER_DIR}"
ant mac
mkdir -p "$REFINE_BUILD_DIR/mac/.background"
cp graphics/dmg_background/dmg_background.png "$REFINE_BUILD_DIR/mac/.background/dmg_background.png"
SIZE=60
SIZE=200
if [ -f "$REFINE_BUILD_DIR/temp_refine.dmg" ] ; then
rm "$REFINE_BUILD_DIR/temp_refine.dmg"
@ -579,7 +576,7 @@ mac_dist() {
hdiutil convert "$REFINE_BUILD_DIR/temp_refine.dmg" -format UDZO -imagekey zlib-level=9 -o "$REFINE_DIST_DIR/openrefine-$VERSION-$REVISION.dmg" || error "Error compressing DMG"
hdiutil internet-enable -yes "$REFINE_DIST_DIR/openrefine-$VERSION-$REVISION.dmg" || error "Error internet-enabling DMG"
rm -f "$REFINE_BUILD_DIR/temp_refine.dmg"
#rm -f "$REFINE_BUILD_DIR/temp_refine.dmg"
}
test() {
@ -864,8 +861,9 @@ load_configs refine.ini
if [ "$OS" = "macosx" ] ; then
if [ -z "$JAVA_HOME" ] ; then
# Mac OS X defaults to Java 5. So update JAVA_HOME unless the user manually set it.
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"
# We need want recent Java because we're bundling JRE - may want to warn and force developer to set JAVA_HOME
# The /usr/libexec/java_home utility may be tied to the Java prefs app, so could go away when Apple removes it
export JAVA_HOME=$(/usr/libexec/java_home)
fi
fi
@ -979,8 +977,6 @@ add_option "-Dpython.path=$JYTHONPATH"
add_option "-Dpython.cachedir=$HOME/.local/share/google/refine/cachedir"
# ----- Respond to the action given --------------------------------------------
echo $ACTION
case "$ACTION" in
build) build_prepare; ant build;;
clean) ant clean;;