termux-packages/packages/ant/ant

82 lines
2.7 KiB
Bash
Executable File

#!@TERMUX_PREFIX@/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
set -e -u
# Extract launch and ant arguments, (see details below).
ant_exec_args=
no_config=false
ant_exec_debug=false
show_help=false
for arg in "$@" ; do
if [ "$arg" = "--noconfig" ] ; then
no_config=true
elif [ "$arg" = "--execdebug" ] ; then
ant_exec_debug=true
elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then
show_help=true
ant_exec_args="$ant_exec_args -h"
else
if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then
show_help=true
fi
ant_exec_args="$ant_exec_args \"$arg\""
fi
done
if [ -z "$ANT_HOME" ]; then
ANT_HOME=@TERMUX_PREFIX@/share/ant
fi
if ! $no_config ; then
if [ -f "$HOME/.ant/ant.conf" ] ; then
. $HOME/.ant/ant.conf
fi
if [ -f "$HOME/.antrc" ] ; then
. "$HOME/.antrc"
fi
fi
ANT_LIB="${ANT_HOME}/lib"
if [ -z "$LOCALCLASSPATH" ] ; then
LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar
else
LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH
fi
# Show script help if requested
if $show_help ; then
echo $0 '[script options] [options] [target [target2 [target3] ..]]'
echo 'Script Options:'
echo ' --help, --h print this message and ant help'
echo ' --noconfig suppress sourcing of /etc/ant.conf,'
echo ' $HOME/.ant/ant.conf, and $HOME/.antrc'
echo ' configuration files'
echo ' --execdebug print ant exec line generated by this'
echo ' launch script'
echo ' '
fi
# Execute ant using eval/exec to preserve spaces in paths, java options, and ant args
ant_sys_opts=
ant_exec_command="exec dalvikvm $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\""
if $ant_exec_debug ; then
echo $ant_exec_command $ant_exec_args
fi
eval $ant_exec_command "$ant_exec_args"