Revision: 15018
http://gate.svn.sourceforge.net/gate/?rev=15018&view=rev
Author: valyt
Date: 2012-01-12 16:24:24 +0000 (Thu, 12 Jan 2012)
Log Message:
-----------
More work on the launcher.
Modified Paths:
--------------
gate/trunk/bin/gate.sh
gate/trunk/build/launcher/build.xml
gate/trunk/build/launcher/src/gate/Launcher.java
gate/trunk/build.xml
gate/trunk/src/gate/Main.java
Property Changed:
----------------
gate/trunk/bin/
Property changes on: gate/trunk/bin
___________________________________________________________________
Modified: svn:ignore
- gate.jar
.log4j.properties.swp
+ gate.jar
.log4j.properties.swp
gateLauncher.jar
Modified: gate/trunk/bin/gate.sh
===================================================================
--- gate/trunk/bin/gate.sh 2012-01-12 14:08:49 UTC (rev 15017)
+++ gate/trunk/bin/gate.sh 2012-01-12 16:24:24 UTC (rev 15018)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#set -x
PRG="$0"
CURDIR="`pwd`"
@@ -26,11 +26,8 @@
## unknown argument is detected, processing ends and the rest of the
## arguments are passed on to ant run
-config=
-session=
-initdir=
-log4j=
-rh=
+gateparams=()
+vmparams=()
while test "$1" != "";
do
case "$1" in
@@ -47,35 +44,31 @@
-rh path ... set the resources home path, this is a shortcut for
-Druntime.gate.user.resourceshome=path
-h ... show this help
-All other options will be passed on to the "ant run" command, for example:
- -propertyfile <file> ... use <file> instead of \$GATE_HOME/build.properties
- -Drun.java.io.tmpdir=<somedir>
-Note that gate.sh does not use \$JAVA_OPTS. To adjust allocated memory use:
- -Druntime.start.memory=<memorysize>
- -Druntime.max.memory=<memorysize>
+All other options will be passed on to the "java" command, for example:
+ -Djava.io.tmpdir=<somedir>
+ -Xmx<memorysize>
EOF
- #exec bin/ant -h
exit 0
;;
-ld)
- config="-Drun.gate.user.config=$CURDIR/.gate.xml"
- session="-Drun.gate.user.session=$CURDIR/.gate.session"
- initdir="-Drun.gate.user.filechooser.defaultdir=$CURDIR"
+ vmparams=( "${vmparams[@]}" "-Dgate.user.config=$CURDIR/.gate.xml" )
+ vmparams=( "${vmparams[@]}" "-Dgate.user.session=$CURDIR/.gate.session" )
+ vmparams=( "${vmparams[@]}" "-Dgate.user.filechooser.defaultdir=$CURDIR" )
shift
;;
-ln)
shift
base=$1
shift
- config="-Drun.gate.user.config=$CURDIR/$base.xml"
- session="-Drun.gate.user.session=$CURDIR/$base.session"
- initdir="-Drun.gate.user.filechooser.defaultdir=$CURDIR"
+ vmparams=( "${vmparams[@]}" "-Dgate.user.config=$CURDIR/$base.xml" )
+ vmparams=( "${vmparams[@]}" "-Dgate.user.session=$CURDIR/$base.session" )
+ vmparams=( "${vmparams[@]}" "-Dgate.user.filechooser.defaultdir=$CURDIR" )
;;
-ll)
shift
if [ -f "$CURDIR/log4j.properties" ]
then
- log4j="-Drun.log4j.configuration=file://$CURDIR/log4j.properties"
+ vmparams=( "${vmparams[@]}"
"-Dlog4j.configuration=file://$CURDIR/log4j.properties" )
fi
;;
-rh)
@@ -83,15 +76,41 @@
resourceshome=$1
resourceshome=`cd "$resourceshome"; pwd -P`
shift
- rh="-Drun.gate.user.resourceshome=$resourceshome"
- ;;
+ vmparams=( "${vmparams[@]}" "-Dgate.user.resourceshome=$resourceshome" )
+ ;;
+ -d)
+ shift
+ gateparams=( "${gateparams[@]}" "-d" "$1" )
+ shift
+ ;;
+ -i)
+ shift
+ gateparams=( "${gateparams[@]}" "-i" "$1" )
+ shift
+ ;;
*)
- break
+ vmparams=( "${vmparams[@]}" "$1" )
+ shift
;;
esac
done
+# Locate JAVA
+if [ -n "$JAVA_HOME" ]; then
+ if [ -x "$JAVA_HOME/bin/java" ]; then
+ JAVACMD="$JAVA_HOME/bin/java"
+ elif [ -x "$JAVA_HOME/jre/bin/java" ]; then
+ JAVACMD="$JAVA_HOME/jre/bin/java"
+ fi
+elif ( which java 2>&1 > /dev/null ); then
+ JAVACMD="`which java`"
+else
+ echo "Couldn't find java, please set JAVA_HOME"
+ exit 1
+fi
-echo running: "$GATE_HOME/bin/ant" run -f "$GATE_HOME/build.xml" "$config"
"$sessioni" "$initdir" "$log4j" "$rh" "$@"
-exec "$GATE_HOME/bin/ant" run -f "$GATE_HOME/build.xml" "$config" "$session"
"$initdir" "$log4j" "$rh" "$@"
+
+echo "Running GATE using Java at $JAVACMD"
+echo "$JAVACMD" "${vmparams[@]}" -jar "$GATE_HOME/bin/gateLauncher.jar"
"${gateparams[@]}"
+exec "$JAVACMD" "${vmparams[@]}" -jar "$GATE_HOME/bin/gateLauncher.jar"
"${gateparams[@]}"
Modified: gate/trunk/build/launcher/build.xml
===================================================================
--- gate/trunk/build/launcher/build.xml 2012-01-12 14:08:49 UTC (rev 15017)
+++ gate/trunk/build/launcher/build.xml 2012-01-12 16:24:24 UTC (rev 15018)
@@ -1,5 +1,7 @@
<project name="GATE-launcher" basedir="." default="jar" >
+ <!-- Prevent Ant from warning about includeantruntime not being set -->
+ <property name="build.sysclasspath" value="ignore" />
<!-- If gate.home is not set from build.properties or the
environment variable GATE_HOME, assume that this
Modified: gate/trunk/build/launcher/src/gate/Launcher.java
===================================================================
--- gate/trunk/build/launcher/src/gate/Launcher.java 2012-01-12 14:08:49 UTC
(rev 15017)
+++ gate/trunk/build/launcher/src/gate/Launcher.java 2012-01-12 16:24:24 UTC
(rev 15018)
@@ -118,10 +118,12 @@
String osPrefix = "os." + System.getProperty("os.name") + ".";
for(String key : buildProperties.stringPropertyNames()) {
- if(key.startsWith("run.")) {
+ if(key.startsWith("run.") &&
+ System.getProperty(key.substring(4)) == null) {
System.setProperty(key.substring(4), getPropertyValue(key,
new HashSet<String>(), buildProperties, System.getProperties()));
- } else if(key.startsWith(osPrefix)) {
+ } else if(key.startsWith(osPrefix) &&
+ System.getProperty(key.substring(osPrefix.length())) == null ) {
System.setProperty(key.substring(osPrefix.length()),
getPropertyValue(key,
new HashSet<String>(), buildProperties, System.getProperties()));
}
Modified: gate/trunk/build.xml
===================================================================
--- gate/trunk/build.xml 2012-01-12 14:08:49 UTC (rev 15017)
+++ gate/trunk/build.xml 2012-01-12 16:24:24 UTC (rev 15018)
@@ -410,7 +410,7 @@
<!-- <zipgroupfileset refid="libs"/> -->
</jar>
<!-- also build the launcher -->
- <ant dir="build/launcher" inheritAll="false" target="jar" />
+ <ant dir="build/launcher" inheritAll="false" target="jar"/>
</target>
<!-- Optional target useful for creating jars for embedded apps. It splits
@@ -568,15 +568,105 @@
<target name="all" depends="jar, plugins.build">
</target>
- <!-- Run the beast -->
- <target name="run" depends="run-pre,run-nonmac,run-mac" >
+
+ <!-- Run the beast using the default GATE launcher -->
+ <target name="run" depends="run-pre, run-nonmac, run-mac">
+ </target>
+
+ <target name="run-pre">
+ <!-- Prepend extDir to the java.ext.dirs path -->
+ <pathconvert property="ext.dirs">
+ <path>
+ <pathelement location="${extDir}" />
+ <path path="${java.ext.dirs}" />
+ </path>
+ </pathconvert>
+ <!-- Find if the platform is MAC -->
+ <condition property="running.on.mac">
+ <os family="mac"/>
+ </condition>
+ </target>
+
+ <target name="run-nonmac" unless="running.on.mac">
+ <!-- Call the GATE Launcher -->
+ <java jar="bin/gateLauncher.jar"
+ fork="true"
+ spawn="${runtime.spawn}"
+ dir="."
+ maxmemory="${runtime.max.memory}">
+ <jvmarg value="${server.or.client}"/>
+ <sysproperty key="java.ext.dirs" value="${ext.dirs}"/>
+ </java>
+ </target>
+
+ <target name="run-mac" if="running.on.mac">
+ <property name="gate.icon.location"
+ location="GATE.app/Contents/Resources/gate-icon.icns" />
+ <!-- Don't pass a -d32 or -d64 on Tiger (10.4.x) -->
+ <condition property="runtime.arch" value="">
+ <matches pattern="10\.4(?:\..*)?" string="${os.version}" />
+ </condition>
+ <condition property="runtime.arch" value="-d64" else="-d32">
+ <os arch="x86_64" />
+ </condition>
+ <if>
+ <length string="${runtime.arch}" when="greater" length="0" />
+ <then>
+ <echo>Running GATE with ${runtime.arch}</echo>
+ </then>
+ </if>
+
+ <!-- Call the GATE Launcher -->
+ <java jar="bin/gateLauncher.jar"
+ fork="true"
+ spawn="${runtime.spawn}"
+ dir="."
+ maxmemory="${runtime.max.memory}">
+ <jvmarg value="${server.or.client}"/>
+ <sysproperty key="java.ext.dirs" value="${ext.dirs}"/>
+ <sysproperty key="sun.java2d.opengl" value="true"/>
+ <sysproperty key="apple.laf.useScreenMenuBar" value="true"/>
+ <sysproperty key="apple.awt.antialiasing" value="true"/>
+ <sysproperty key="com.apple.mrj.application.growbox.intrudes"
value="false"/>
+ <sysproperty key="com.apple.mrj.application.live-resize" value="true"/>
+ <!-- use "line" rather than "value" as runtime.arch may be empty -->
+ <jvmarg line="${runtime.arch}" />
+ <jvmarg value="-Xdock:name=GATE ${gate.version}"/>
+ <jvmarg value="-Xdock:icon=${gate.icon.location}"/>
+ </java>
+
+ <java classname="gate.Main"
+ classpathref="run.class.path"
+ fork="true"
+ spawn="${runtime.spawn}"
+ dir="."
+ maxmemory="${runtime.max.memory}">
+<!-- <jvmarg value="-Xms${runtime.start.memory}"/> -->
+ <sysproperty key="gate.home" value="${basedir}"/>
+ <sysproperty key="java.ext.dirs" value="${ext.dirs}"/>
+ <sysproperty key="sun.java2d.opengl" value="true"/>
+ <sysproperty key="apple.laf.useScreenMenuBar" value="true"/>
+ <sysproperty key="apple.awt.antialiasing" value="true"/>
+ <sysproperty key="com.apple.mrj.application.growbox.intrudes"
value="false"/>
+ <sysproperty key="com.apple.mrj.application.live-resize" value="true"/>
+ <!-- use "line" rather than "value" as runtime.arch may be empty -->
+ <jvmarg line="${runtime.arch}" />
+ <jvmarg value="-Xdock:name=GATE ${gate.version}"/>
+ <jvmarg value="-Xdock:icon=${gate.icon.location}"/>
+ <syspropertyset refid="run.properties" />
+ <syspropertyset refid="os.properties" />
+ </java>
+ </target>
+
+ <!-- Run the beast using ANT as a launcher -->
+ <target name="runWithAnt" depends="runWAnt-pre,runWAnt-nonmac,runWAnt-mac" >
<echo level="info">
GATE doesn't start? Consult http://gate.ac.uk/wiki/gate-user-faq.html
</echo>
</target>
<!-- Prepares for running GATE -->
- <target name="run-pre">
+ <target name="runWAnt-pre">
<property name="class.path.debug" refid="run.class.path"/>
<echo>
Starting GATE ${gate.version}, build ${gate.build}
@@ -610,7 +700,7 @@
</target>
<!-- Starts GATE on non MAC platforms -->
- <target name="run-nonmac" unless="running.on.mac">
+ <target name="runWAnt-nonmac" unless="running.on.mac">
<java classname="gate.Main"
classpathref="run.class.path"
fork="true"
@@ -629,7 +719,7 @@
</target>
<!-- Starts GATE on MAC platforms -->
- <target name="run-mac" if="running.on.mac">
+ <target name="runWAnt-mac" if="running.on.mac">
<property name="gate.icon.location"
location="GATE.app/Contents/Resources/gate-icon.icns" />
<!-- Don't pass a -d32 or -d64 on Tiger (10.4.x) -->
Modified: gate/trunk/src/gate/Main.java
===================================================================
--- gate/trunk/src/gate/Main.java 2012-01-12 14:08:49 UTC (rev 15017)
+++ gate/trunk/src/gate/Main.java 2012-01-12 16:24:24 UTC (rev 15018)
@@ -20,7 +20,6 @@
import gate.gui.OptionsDialog;
import gate.gui.Splash;
import gate.util.BomStrippingInputStreamReader;
-import gate.util.CorpusBenchmarkTool;
import gate.util.Err;
import gate.util.Files;
import gate.util.GateException;
@@ -584,15 +583,6 @@
" recorded for initialisation"
);
break;
- // -e runs the CorpusBenchmarkTool (e for evaluate)
- case 'e':
- try {
- CorpusBenchmarkTool.main(args);
- } catch (GateException ex) {
- Out.prln("Error running the evaluation tool: " + ex.getMessage());
- System.exit(-1);
- }
- break;
case '?':
// leave the warning to getopt
System.exit(STATUS_ERROR);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs