- build a windows distribution

- update to the latest ant to use in case one is not present locally


git-svn-id: http://google-refine.googlecode.com/svn/trunk@85 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-02-10 07:30:16 +00:00
parent 36e609d649
commit 91d0133a76
8 changed files with 102 additions and 33 deletions

View File

@ -6,7 +6,7 @@
| |
+--> +-->
<project name="gridworks" default="compile" basedir="."> <project name="gridworks" default="build" basedir=".">
<property environment="env"/> <property environment="env"/>
@ -17,31 +17,31 @@
<property name="build.dir" value="${basedir}/build" /> <property name="build.dir" value="${basedir}/build" />
<property name="classes.dir" value="${build.dir}/classes" /> <property name="classes.dir" value="${build.dir}/classes" />
<property name="bundle.dir" value="${build.dir}/bundle" /> <property name="bundle.dir" value="${build.dir}/bundle" />
<property name="exe.dir" value="${build.dir}/exe" />
<taskdef
name="jarbundler"
classpath="${tools.dir}/jarbundler-2.1.0.jar"
classname="net.sourceforge.jarbundler.JarBundler"
/>
<path id="class.path"> <path id="class.path">
<fileset dir="${lib.dir}"> <fileset dir="${lib.dir}">
<include name="**/*.jar" /> <include name="**/*.jar" />
</fileset> </fileset>
</path> </path>
<target name="compile"> <target name="build">
<mkdir dir="${classes.dir}" /> <mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true"> <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" includeAntRuntime="no">
<classpath refid="class.path" /> <classpath refid="class.path" />
</javac> </javac>
</target> </target>
<target name="jar" depends="compile"> <target name="jar" depends="build">
<jar destfile="${build.dir}/gridworks.jar" basedir="${classes.dir}"/> <jar destfile="${build.dir}/gridworks.jar" basedir="${classes.dir}"/>
</target> </target>
<target name="bundle" depends="jar"> <target name="bundle" depends="jar">
<taskdef
name="jarbundler"
classname="net.sourceforge.jarbundler.JarBundler"
classpath="${tools.dir}/jarbundler-2.1.0.jar"
/>
<mkdir dir="${bundle.dir}"/> <mkdir dir="${bundle.dir}"/>
<jarbundler <jarbundler
dir="${bundle.dir}" dir="${bundle.dir}"
@ -54,7 +54,7 @@
workingdirectory="$APP_PACKAGE/Contents/Resources" workingdirectory="$APP_PACKAGE/Contents/Resources"
jvmversion="1.6+" jvmversion="1.6+"
bundleid="com.metaweb.gridworks.Gridworks" bundleid="com.metaweb.gridworks.Gridworks"
vmoptions="-Xms256M -Xmx1024M" vmoptions="${java.options}"
antialiasedgraphics="true" antialiasedgraphics="true"
antialiasedtext="true" antialiasedtext="true"
liveresize="true" liveresize="true"
@ -68,10 +68,52 @@
<resourcefileset dir="${basedir}/src/main/"> <resourcefileset dir="${basedir}/src/main/">
<include name="webapp/**" /> <include name="webapp/**" />
</resourcefileset> </resourcefileset>
</jarbundler> </jarbundler>
</target> </target>
<target name="exe" depends="jar">
<mkdir dir="${exe.dir}"/>
<taskdef
name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${tools.dir}/launch4j/launch4j.jar:${tools.dir}/launch4j/lib/xstream.jar"
/>
<launch4j>
<config
headerType="console"
outfile="${exe.dir}/Gridworks.exe"
jarPath="lib/gridworks-${version}.jar"
dontWrapJar="true"
icon="${graphics.dir}/icon/gridworks.ico">
<classPath mainClass="com.metaweb.gridworks.Gridworks">
<cp>${lib.dir}/*.jar</cp>
</classPath>
<jre minVersion="1.6.0" jdkPreference="preferJre">
<opt>${java.version}</opt>
</jre>
<versionInfo
fileVersion="${version}.0.0"
txtFileVersion="${version}"
fileDescription="gridworks"
copyright="Copyright (c) 2010, Metaweb Technologies, Inc."
productVersion="${version}.0.0"
txtProductVersion="${version}.0.0"
productName="Gridworks"
companyName="Metaweb Technologies, Inc."
internalName="gridworks"
originalFilename="gridworks.exe"
/>
</config>
</launch4j>
<copy todir="${exe.dir}/lib">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy file="${build.dir}/gridworks.jar" tofile="${exe.dir}/lib/gridworks-${version}.jar"/>
<zip destfile="${dist.dir}/gridworks-${version}.zip" basedir="${exe.dir}"/>
</target>
<target name="clean"> <target name="clean">
<delete file="${build.dir}/gridworks.jar" /> <delete file="${build.dir}/gridworks.jar" />
<delete dir="${classes.dir}" /> <delete dir="${classes.dir}" />

View File

@ -43,6 +43,7 @@ and <action> is one of
run ....................... Run Gridworks run ....................... Run Gridworks
make_dmg <version> ........ Make MacOSX DMG distribution make_dmg <version> ........ Make MacOSX DMG distribution
make_exe <version> ........ Make Windows EXE distribution
clean ..................... Clean compiled classes clean ..................... Clean compiled classes
distclean ................. Remove all generated files distclean ................. Remove all generated files
@ -74,18 +75,18 @@ ant_prepare() {
ANT=`which ant` ANT=`which ant`
if [ "$ANT" = "" ] ; then if [ "$ANT" = "" ] ; then
ANT_TAR=`ls thirdparty | grep apache-ant` ANT_TAR=`find thirdparty | grep apache-ant | grep -v svn`
ANT_DIR="$GRIDWORKS_BUILD_DIR/ant" ANT_DIR=`echo $ANT_TAR | sed 's/.tar.gz//'`
ANT="$ANT_DIR/bin/ant"
if [ ! -d $ANT_DIR ] ; then if [ ! -d $ANT_DIR ] ; then
tar xzf $ANT_TAR -C $BUILD_DIR || exit 1 tar xzf $ANT_TAR -C $GRIDWORKS_BUILD_DIR || exit 1
fi fi
ANT="$ANT_DIR/bin/ant"
fi fi
} }
ant() { ant() {
ant_prepare ant_prepare
$ANT -f build.xml -Dbuild.dir="$GRIDWORKS_BUILD_DIR" -Ddist.dir="$GRIDWORKS_DIST_DIR" -Dversion="$VERSION" $1 || exit 1 $ANT -f build.xml -Dbuild.dir="$GRIDWORKS_BUILD_DIR" -Ddist.dir="$GRIDWORKS_DIST_DIR" -Dversion="$VERSION" -Djava.options="$JAVA_OPTIONS" $1 || exit 1
} }
dist_prepare() { dist_prepare() {
@ -93,7 +94,29 @@ dist_prepare() {
mkdir $GRIDWORKS_DIST_DIR || exit 1 mkdir $GRIDWORKS_DIST_DIR || exit 1
fi fi
} }
launch4j_prepare() {
LAUNCH4J_TAR=`find thirdparty | grep launch4j | grep -v svn`
LAUNCH4J_DIR="thirdparty/launch4j"
if [ ! -d "$LAUNCH4J_DIR" ] ; then
tar xzf $LAUNCH4J_TAR -C thirdparty || exit 1
fi
}
make_exe() {
check_macosx
dist_prepare
launch4j_prepare
VERSION=$1
if [ "$VERSION" == "" ] ; then
fail "Must specify a version number"
fi
ant exe
}
make_dmg() { make_dmg() {
check_macosx check_macosx
dist_prepare dist_prepare
@ -215,7 +238,7 @@ ACTION=$1; shift
# ----- Verify and Set Required Environment Variables ------------------------- # ----- Verify and Set Required Environment Variables -------------------------
if [ "$JAVA_OPTIONS" == "" ] ; then if [ "$JAVA_OPTIONS" == "" ] ; then
JAVA_OPTIONS="-Xms256M -Xmx1024M -XX:+UseLargePages -XX:+UseConcMarkSweepGC -XX:+UseParallelGC" JAVA_OPTIONS="-Xms256M -Xmx1024M -XX:+UseLargePages -XX:+UseParallelGC"
fi fi
add_option "$JAVA_OPTIONS" add_option "$JAVA_OPTIONS"
@ -250,7 +273,7 @@ fi
case "$ACTION" in case "$ACTION" in
build) build)
ant compile;; ant build;;
bundle) bundle)
ant bundle;; ant bundle;;
@ -266,6 +289,9 @@ case "$ACTION" in
make_dmg) make_dmg)
make_dmg $1;; make_dmg $1;;
make_exe)
make_exe $1;;
*) *)
usage; ;; usage; ;;

View File

@ -37,13 +37,16 @@ echo /x enable JMX monitoring (for jconsole and friends)
echo. echo.
echo and <action> is one of echo and <action> is one of
echo. echo.
echo build ..... Build Gridworks echo build ..................... Build Gridworks
echo run ....... Run Gridworks echo run ....................... Run Gridworks
echo.
echo clean ..................... Clean compiled classes
echo distclean ................. Remove all generated files
echo. echo.
goto end goto end
:fail :fail
echo See: '%0 /h' for usage. echo Type 'gridworks /h' for usage.
goto end goto end
:endUtils :endUtils
@ -97,7 +100,7 @@ goto loop
rem --- Fold in Environment Vars -------------------------------------------- rem --- Fold in Environment Vars --------------------------------------------
if not "%JAVA_OPTIONS%" == "" goto gotJavaOptions if not "%JAVA_OPTIONS%" == "" goto gotJavaOptions
set JAVA_OPTIONS=-Xms256M -Xmx1024M set JAVA_OPTIONS=-Xms256M -Xmx1024M -XX:+UseLargePages -XX:+UseParallelGC
:gotJavaOptions :gotJavaOptions
set OPTS=%OPTS% %JAVA_OPTIONS% set OPTS=%OPTS% %JAVA_OPTIONS%
@ -127,23 +130,21 @@ set GRIDWORKS_LIB_DIR=lib
rem ----- Respond to the action ---------------------------------------------------------- rem ----- Respond to the action ----------------------------------------------------------
set ACTION=%1 set ACTION=%1
if not "%ACTION%" == "" goto gotAction
set ACTION="run"
:gotAction
if ""%ACTION%"" == ""build"" goto doBuild if ""%ACTION%"" == ""build"" goto doAnt
if ""%ACTION%"" == ""clean"" goto doAnt
if ""%ACTION%"" == ""distclean"" goto doAnt
if ""%ACTION%"" == ""run"" goto doRun if ""%ACTION%"" == ""run"" goto doRun
goto usage goto usage
:doBuild
ant -f build.xml compile
goto end
:doRun :doRun
set CLASSPATH="%GRIDWORKS_BUILD_DIR%\classes;%GRIDWORKS_LIB_DIR%\*" set CLASSPATH="%GRIDWORKS_BUILD_DIR%\classes;%GRIDWORKS_LIB_DIR%\*"
"%JAVA_HOME%\bin\java.exe" -cp %CLASSPATH% %OPTS% com.metaweb.gridworks.Gridworks "%JAVA_HOME%\bin\java.exe" -cp %CLASSPATH% %OPTS% com.metaweb.gridworks.Gridworks
goto end goto end
:doAnt
ant -f build.xml -Dbuild.dir="%GRIDWORKS_BUILD_DI%" -Ddist.dir="%GRIDWORKS_DIST_DIR%" -Dversion="%VERSION%" %ACTION%
goto end
:end :end

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
thirdparty/apache-ant-1.8.0.tar.gz vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
thirdparty/launch4j-3.0.1-macosx.tar.gz vendored Normal file

Binary file not shown.

Binary file not shown.