blob: 70ba710a922647e8e8e0e70d1146a4807d7538f7 [file] [log] [blame]
#!/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" "$@"