diff options
Diffstat (limited to 'mgrapp/bin/mgr')
-rwxr-xr-x | mgrapp/bin/mgr | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/mgrapp/bin/mgr b/mgrapp/bin/mgr new file mode 100755 index 0000000000..70ba710a92 --- /dev/null +++ b/mgrapp/bin/mgr @@ -0,0 +1,64 @@ +#!/bin/sh +# +# Copyright 2008 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ -z "$MGR_HOME" ] +then + MGR_HOME=`which $0 2>/dev/null` + MGR_HOME=`dirname $MGR_HOME` + MGR_HOME=`dirname $MGR_HOME` +fi + +if [ -z "$MGR_HOME" ] +then + echo >&2 "error: MGR_HOME not set, cannot guess" + exit 1 +fi + +if ! [ -f "$MGR_HOME/lib/codereview_manager.jar" ] +then + echo >&2 "error: MGR_HOME $MGR_HOME not compiled" + exit 1 +fi + +if [ -z "$1" ] +then + echo >&2 "usage: $0 app.config [args]" + exit 1 +fi +config_file=$1 +shift + +java_opts= + +m=`GIT_CONFIG=$config_file git config --get codereview.memory` +if [ -n "$m" ] +then + java_opts="$java_opts -Xmx${m}" +fi + +CLASSPATH= +for j in $MGR_HOME/lib/*.jar +do + if [ -z "$CLASSPATH" ] + then + CLASSPATH=$j + else + CLASSPATH=$CLASSPATH:$j + fi +done +export CLASSPATH + +exec java $java_opts com.google.codereview.Main "$config_file" "$@" |