Commit | Line | Data |
---|---|---|
59f0d218 FF |
1 | #!@TERMUX_PREFIX@/bin/sh |
2 | ||
3 | # Licensed to the Apache Software Foundation (ASF) under one or more | |
4 | # contributor license agreements. See the NOTICE file distributed with | |
5 | # this work for additional information regarding copyright ownership. | |
6 | # The ASF licenses this file to You under the Apache License, Version 2.0 | |
7 | # (the "License"); you may not use this file except in compliance with | |
8 | # the License. You may obtain a copy of the License at | |
9 | # | |
10 | # http://www.apache.org/licenses/LICENSE-2.0 | |
11 | # | |
12 | # Unless required by applicable law or agreed to in writing, software | |
13 | # distributed under the License is distributed on an "AS IS" BASIS, | |
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | # See the License for the specific language governing permissions and | |
16 | # limitations under the License. | |
17 | ||
18 | set -e -u | |
19 | ||
20 | # Extract launch and ant arguments, (see details below). | |
21 | ant_exec_args= | |
22 | no_config=false | |
23 | ant_exec_debug=false | |
24 | show_help=false | |
25 | for arg in "$@" ; do | |
26 | if [ "$arg" = "--noconfig" ] ; then | |
27 | no_config=true | |
28 | elif [ "$arg" = "--execdebug" ] ; then | |
29 | ant_exec_debug=true | |
30 | elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then | |
31 | show_help=true | |
32 | ant_exec_args="$ant_exec_args -h" | |
33 | else | |
34 | if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then | |
35 | show_help=true | |
36 | fi | |
37 | ant_exec_args="$ant_exec_args \"$arg\"" | |
38 | fi | |
39 | done | |
40 | ||
41 | if [ -z "$ANT_HOME" ]; then | |
42 | ANT_HOME=@TERMUX_PREFIX@/share/ant | |
43 | fi | |
44 | ||
45 | if ! $no_config ; then | |
46 | if [ -f "$HOME/.ant/ant.conf" ] ; then | |
47 | . $HOME/.ant/ant.conf | |
48 | fi | |
49 | if [ -f "$HOME/.antrc" ] ; then | |
50 | . "$HOME/.antrc" | |
51 | fi | |
52 | fi | |
53 | ||
54 | ANT_LIB="${ANT_HOME}/lib" | |
55 | ||
56 | if [ -z "$LOCALCLASSPATH" ] ; then | |
57 | LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar | |
58 | else | |
59 | LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH | |
60 | fi | |
61 | ||
62 | # Show script help if requested | |
63 | if $show_help ; then | |
64 | echo $0 '[script options] [options] [target [target2 [target3] ..]]' | |
65 | echo 'Script Options:' | |
66 | echo ' --help, --h print this message and ant help' | |
67 | echo ' --noconfig suppress sourcing of /etc/ant.conf,' | |
68 | echo ' $HOME/.ant/ant.conf, and $HOME/.antrc' | |
69 | echo ' configuration files' | |
70 | echo ' --execdebug print ant exec line generated by this' | |
71 | echo ' launch script' | |
72 | echo ' ' | |
73 | fi | |
74 | ||
75 | # Execute ant using eval/exec to preserve spaces in paths, java options, and ant args | |
76 | ant_sys_opts= | |
77 | 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\"" | |
78 | if $ant_exec_debug ; then | |
79 | echo $ant_exec_command $ant_exec_args | |
80 | fi | |
81 | eval $ant_exec_command "$ant_exec_args" |