- condensing exe and cli distributions into one for windows (shipping both the .exe and the .bat in the same package)

- renamed the distibutions based on their target OS
- more polishing here and there


git-svn-id: http://google-refine.googlecode.com/svn/trunk@365 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-03-31 02:11:53 +00:00
parent 3c9af6501e
commit 9db9351a0b
3 changed files with 67 additions and 89 deletions

View File

@ -30,11 +30,12 @@
<property name="classes.dir" value="${build.dir}/classes" /> <property name="classes.dir" value="${build.dir}/classes" />
<property name="tests_classes.dir" value="${tests.dir}/classes" /> <property name="tests_classes.dir" value="${tests.dir}/classes" />
<property name="webapp.dir" value="${build.dir}/webapp" /> <property name="webapp.name" value="webapp" />
<property name="bundle.dir" value="${build.dir}/bundle" /> <property name="webapp.dir" value="${build.dir}/${webapp.name}" />
<property name="exe.dir" value="${build.dir}/exe" /> <property name="mac.dir" value="${build.dir}/mac" />
<property name="cli.name" value="gridworks-${version}" /> <property name="windows.dir" value="${build.dir}/windows" />
<property name="cli.dir" value="${build.dir}/cli/${cli.name}" /> <property name="linux.name" value="gridworks-${version}" />
<property name="linux.dir" value="${build.dir}/linux/${linux.name}" />
<path id="class.path"> <path id="class.path">
<fileset dir="${lib.dir}"> <fileset dir="${lib.dir}">
@ -82,17 +83,17 @@
</replace> </replace>
</target> </target>
<target name="bundle" depends="jar, prepare_webapp"> <target name="mac" depends="jar, prepare_webapp">
<taskdef <taskdef
name="jarbundler" name="jarbundler"
classname="net.sourceforge.jarbundler.JarBundler" classname="net.sourceforge.jarbundler.JarBundler"
classpath="${tools.dir}/jarbundler-2.1.0.jar" classpath="${tools.dir}/jarbundler-2.1.0.jar"
/> />
<mkdir dir="${bundle.dir}"/> <mkdir dir="${mac.dir}"/>
<jarbundler <jarbundler
dir="${bundle.dir}" dir="${mac.dir}"
name="Gridworks" name="Gridworks"
mainclass="com.metaweb.gridworks.Gridworks" mainclass="com.metaweb.gridworks.Gridworks"
icon="${graphics.dir}/icon/gridworks.icns" icon="${graphics.dir}/icon/gridworks.icns"
@ -113,14 +114,14 @@
<include name="**/*.jar" /> <include name="**/*.jar" />
</jarfileset> </jarfileset>
<jarfilelist dir="${build.dir}" files="gridworks.jar" /> <jarfilelist dir="${build.dir}" files="gridworks.jar" />
<resourcefileset dir="${webapp.dir}"> <resourcefileset dir="${webapp.dir}/..">
<include name="**" /> <include name="${webapp.name}/**" />
</resourcefileset> </resourcefileset>
</jarbundler> </jarbundler>
</target> </target>
<target name="exe" depends="jar, prepare_webapp"> <target name="windows" depends="jar, prepare_webapp">
<mkdir dir="${exe.dir}"/> <mkdir dir="${windows.dir}"/>
<taskdef <taskdef
name="launch4j" name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask" classname="net.sf.launch4j.ant.Launch4jTask"
@ -129,7 +130,7 @@
<launch4j> <launch4j>
<config <config
headerType="console" headerType="console"
outfile="${exe.dir}/Gridworks.exe" outfile="${windows.dir}/Gridworks.exe"
jarPath="lib/gridworks-${version}-${revision}.jar" jarPath="lib/gridworks-${version}-${revision}.jar"
dontWrapJar="true" dontWrapJar="true"
icon="${graphics.dir}/icon/gridworks.ico"> icon="${graphics.dir}/icon/gridworks.ico">
@ -153,83 +154,70 @@
/> />
</config> </config>
</launch4j> </launch4j>
<copy todir="${exe.dir}/lib"> <copy todir="${windows.dir}/lib">
<fileset dir="${lib.dir}"> <fileset dir="${lib.dir}">
<include name="**/*.jar"/> <include name="**/*.jar"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${exe.dir}/lib/native/windows"> <copy todir="${windows.dir}/lib/native/windows">
<fileset dir="${lib.dir}/native/windows"> <fileset dir="${lib.dir}/native/windows">
<include name="*.dll"/> <include name="*.dll"/>
</fileset> </fileset>
</copy> </copy>
<copy file="${build.dir}/gridworks.jar" tofile="${exe.dir}/lib/gridworks-${version}-${revision}.jar"/> <copy file="${build.dir}/gridworks.jar" tofile="${windows.dir}/lib/gridworks-${version}-${revision}.jar"/>
<copy todir="${exe.dir}/src/main/webapp"> <copy todir="${windows.dir}/webapp">
<fileset dir="${webapp.dir}"> <fileset dir="${webapp.dir}">
<include name="**"/> <include name="**"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${cli.dir}/licenses"> <copy todir="${linux.dir}/licenses">
<fileset dir="${basedir}/licenses"> <fileset dir="${basedir}/licenses">
<include name="**"/> <include name="**"/>
</fileset> </fileset>
</copy> </copy>
<copy file="${conf.dir}/gridworks.l4j.ini" tofile="${exe.dir}/gridworks.l4j.ini"/> <copy file="${conf.dir}/gridworks.l4j.ini" tofile="${windows.dir}/gridworks.l4j.ini"/>
<copy file="${basedir}/README.txt" tofile="${exe.dir}/README.txt"/> <copy file="${basedir}/gridworks.bat" tofile="${windows.dir}/gridworks.bat"/>
<copy file="${basedir}/LICENSE.txt" tofile="${exe.dir}/LICENSE.txt"/> <copy file="${basedir}/README.txt" tofile="${windows.dir}/README.txt"/>
<copy file="${basedir}/LICENSE.txt" tofile="${windows.dir}/LICENSE.txt"/>
<zip destfile="${dist.dir}/gridworks-${version}-${revision}.zip" basedir="${exe.dir}"/> <zip destfile="${dist.dir}/gridworks-${version}-${revision}.zip" basedir="${windows.dir}"/>
</target> </target>
<target name="cli" depends="jar, prepare_webapp"> <target name="linux" depends="jar, prepare_webapp">
<mkdir dir="${cli.dir}"/> <mkdir dir="${linux.dir}"/>
<copy todir="${cli.dir}/lib"> <copy todir="${linux.dir}/lib">
<fileset dir="${lib.dir}"> <fileset dir="${lib.dir}">
<include name="**/*.jar"/> <include name="**/*.jar"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${cli.dir}/lib/native/windows">
<fileset dir="${lib.dir}/native/windows">
<include name="*.dll"/>
</fileset>
</copy>
<copy file="${build.dir}/gridworks.jar" tofile="${cli.dir}/lib/gridworks-${version}-${revision}.jar"/> <copy file="${build.dir}/gridworks.jar" tofile="${linux.dir}/lib/gridworks-${version}-${revision}.jar"/>
<copy todir="${cli.dir}/src/main/webapp"> <copy todir="${linux.dir}/src/main/webapp">
<fileset dir="${webapp.dir}"> <fileset dir="${webapp.dir}">
<include name="**"/> <include name="**"/>
</fileset> </fileset>
</copy> </copy>
<copy todir="${cli.dir}/licenses"> <copy todir="${linux.dir}/licenses">
<fileset dir="${basedir}/licenses"> <fileset dir="${basedir}/licenses">
<include name="**"/> <include name="**"/>
</fileset> </fileset>
</copy> </copy>
<copy file="${basedir}/gridworks.ini" tofile="${cli.dir}/gridworks.ini"/> <copy file="${basedir}/gridworks.ini" tofile="${linux.dir}/gridworks.ini"/>
<copy file="${basedir}/gridworks.bat" tofile="${cli.dir}/gridworks.bat"/> <copy file="${basedir}/LICENSE.txt" tofile="${linux.dir}/LICENSE.txt"/>
<copy file="${basedir}/LICENSE.txt" tofile="${cli.dir}/LICENSE.txt"/> <copy file="${basedir}/README.txt" tofile="${linux.dir}/README.txt"/>
<copy file="${basedir}/README.txt" tofile="${cli.dir}/README.txt"/> <copy file="${basedir}/gridworks" tofile="${linux.dir}/gridworks"/>
<delete file="${cli.dir}/gridworks"/>
<zip destfile="${dist.dir}/gridworks-${version}-${revision}-cli.zip" basedir="${cli.dir}"/>
<delete file="${cli.dir}/gridworks.bat"/>
<delete dir="${cli.dir}/lib/native/windows"/>
<copy file="${basedir}/gridworks" tofile="${cli.dir}/gridworks"/>
<tar longfile="gnu" compression="gzip" destfile="${dist.dir}/gridworks-${version}-${revision}.tar.gz"> <tar longfile="gnu" compression="gzip" destfile="${dist.dir}/gridworks-${version}-${revision}.tar.gz">
<tarfileset dir="${cli.dir}/.." filemode="755"> <tarfileset dir="${linux.dir}/.." filemode="755">
<include name="${cli.name}/gridworks"/> <include name="${linux.name}/gridworks"/>
</tarfileset> </tarfileset>
<tarfileset dir="${cli.dir}/.."> <tarfileset dir="${linux.dir}/..">
<include name="${cli.name}/**"/> <include name="${linux.name}/**"/>
<exclude name="${cli.name}/gridworks"/> <exclude name="${linux.name}/gridworks"/>
</tarfileset> </tarfileset>
</tar> </tar>
</target> </target>

View File

@ -52,9 +52,9 @@ and <action> is one of
test ...................... Test Gridworks test ...................... Test Gridworks
make_dmg <version> ........ Make MacOSX DMG distribution mac_dist <version> ........ Make MacOSX binary distribution
make_exe <version> ........ Make Windows EXE distribution windows_dist <version> .... Make Windows binary distribution
make_cli <version> ........ Make distributions to be run at command line linux_dist <version> ...... Make Linux binary distribution
dist <version> ............ Make all distributions dist <version> ............ Make all distributions
@ -143,13 +143,13 @@ get_revision() {
} }
dist() { dist() {
make_dmg $1 mac_dist $1
make_exe $1 windows_dist $1
make_cli $1 linux_dist $1
echo "Distributions were built." echo "All distributions were built and are located at $GRIDWORKS_DIST_DIR"
echo echo
echo "Upload them, then prepend the GridworksReleases array at" echo "Upload them to the distibution site, then prepend the GridworksReleases array at"
echo echo
echo " http://acre.freebase.com/#app=/user/dfhuynh/labs-site&file=gridworks.js" echo " http://acre.freebase.com/#app=/user/dfhuynh/labs-site&file=gridworks.js"
echo echo
@ -163,42 +163,41 @@ dist() {
echo echo
} }
make_exe() { windows_dist() {
check_macosx check_macosx
dist_prepare dist_prepare
launch4j_prepare launch4j_prepare
get_version $1 get_version $1
get_revision get_revision
ant exe ant windows
} }
make_cli() { linux_dist() {
dist_prepare dist_prepare
get_version $1 get_version $1
get_revision get_revision
ant cli ant linux
} }
make_dmg() { mac_dist() {
check_macosx check_macosx
dist_prepare dist_prepare
get_version $1 get_version $1
get_revision get_revision
ant bundle ant mac
mkdir "$GRIDWORKS_BUILD_DIR/bundle/.background" mkdir -p "$GRIDWORKS_BUILD_DIR/mac/.background"
cp src/graphics/dmg_background/dmg_background.png "$GRIDWORKS_BUILD_DIR/bundle/.background/dmg_background.png" cp src/graphics/dmg_background/dmg_background.png "$GRIDWORKS_BUILD_DIR/mac/.background/dmg_background.png"
SIZE=30 SIZE=30
TITLE="Gridworks $VERSION" TITLE="Gridworks $VERSION"
echo "Building MacOSX DMG for $TITLE" echo "Building MacOSX DMG for $TITLE"
hdiutil create -srcfolder "$GRIDWORKS_BUILD_DIR/bundle" -volname "$TITLE" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${SIZE}m "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg" hdiutil create -srcfolder "$GRIDWORKS_BUILD_DIR/mac" -volname "$TITLE" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${SIZE}m "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg"
DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}') hdiutil attach -readwrite -noverify -noautoopen "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg"
hdiutil attach "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg"
echo ' echo '
tell application "Finder" tell application "Finder"
@ -224,10 +223,8 @@ make_dmg() {
end tell end tell
' | osascript ' | osascript
chmod -Rf go-w /Volumes/Gridworks
sync sync
sync sync
hdiutil detach $DEVICE
hdiutil convert "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg" -format UDZO -imagekey zlib-level=9 -o "$GRIDWORKS_DIST_DIR/gridworks-$VERSION-$REVISION.dmg" hdiutil convert "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg" -format UDZO -imagekey zlib-level=9 -o "$GRIDWORKS_DIST_DIR/gridworks-$VERSION-$REVISION.dmg"
hdiutil internet-enable -yes "$GRIDWORKS_DIST_DIR/gridworks-$VERSION-$REVISION.dmg" hdiutil internet-enable -yes "$GRIDWORKS_DIST_DIR/gridworks-$VERSION-$REVISION.dmg"
rm -f "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg" rm -f "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg"
@ -260,7 +257,6 @@ test() {
run() { run() {
if [ ! -d $GRIDWORKS_BUILD_DIR/classes ] ; then if [ ! -d $GRIDWORKS_BUILD_DIR/classes ] ; then
is_jar=`ls $GRIDWORKS_LIB_DIR | grep gridworks` is_jar=`ls $GRIDWORKS_LIB_DIR | grep gridworks`
echo "\"$is_jar\""
if [ "$is_jar" == "" ] ; then if [ "$is_jar" == "" ] ; then
ant build ant build
echo "" echo ""
@ -305,10 +301,6 @@ execute() {
# -------------------------- script ----------------------------- # -------------------------- script -----------------------------
# ----- We called without arguments print the usage -------------
[ $# -gt 0 ] || usage
# ----- Normalize the current directory ------------------------- # ----- Normalize the current directory -------------------------
cd `dirname $0` cd `dirname $0`
@ -366,6 +358,10 @@ done
ACTION=$1; shift ACTION=$1; shift
if [ "$ACTION" == "" ]; then
ACTION="run"
fi
# ----- Verify and Set Required Environment Variables ------------------------- # ----- Verify and Set Required Environment Variables -------------------------
if [ "$JAVA_OPTIONS" == "" ] ; then if [ "$JAVA_OPTIONS" == "" ] ; then
@ -416,9 +412,6 @@ case "$ACTION" in
build) build)
ant build;; ant build;;
bundle)
ant bundle;;
clean) clean)
ant clean;; ant clean;;
@ -434,14 +427,14 @@ case "$ACTION" in
execute) execute)
execute $*;; execute $*;;
make_dmg) mac_dist)
make_dmg $1;; mac_dist $1;;
make_exe) windows_dist)
make_exe $1;; windows_dist $1;;
make_cli) linux_dist)
make_cli $1;; linux_dist $1;;
dist) dist)
dist $1;; dist $1;;

View File

@ -161,11 +161,8 @@ if ""%ACTION%"" == ""clean"" goto doAnt
if ""%ACTION%"" == ""distclean"" goto doAnt if ""%ACTION%"" == ""distclean"" goto doAnt
if ""%ACTION%"" == ""run"" goto doRun if ""%ACTION%"" == ""run"" goto doRun
goto usage
:doRun :doRun
set CLASSPATH="%GRIDWORKS_BUILD_DIR%\classes;%GRIDWORKS_LIB_DIR%\*" set CLASSPATH="%GRIDWORKS_BUILD_DIR%\classes;%GRIDWORKS_LIB_DIR%\*"
echo %OPTS%
"%JAVA_HOME%\bin\java.exe" -cp %CLASSPATH% %OPTS% -Djava.library.path=lib/native/windows com.metaweb.gridworks.Gridworks "%JAVA_HOME%\bin\java.exe" -cp %CLASSPATH% %OPTS% -Djava.library.path=lib/native/windows com.metaweb.gridworks.Gridworks
goto end goto end