diff options
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/.gitattributes | 2 | ||||
-rw-r--r-- | src/script/ant | 170 | ||||
-rwxr-xr-x | src/script/ant.bat | 4 | ||||
-rw-r--r-- | src/script/ant.cmd | 4 | ||||
-rwxr-xr-x | src/script/antRun.bat | 5 | ||||
-rw-r--r-- | src/script/antRun.pl | 16 | ||||
-rw-r--r-- | src/script/antenv.cmd | 2 | ||||
-rw-r--r-- | src/script/complete-ant-cmd.pl | 39 | ||||
-rwxr-xr-x | src/script/lcp.bat | 5 | ||||
-rw-r--r-- | src/script/runant.pl | 110 | ||||
-rw-r--r-- | src/script/runrc.cmd | 4 |
11 files changed, 167 insertions, 194 deletions
diff --git a/src/script/.gitattributes b/src/script/.gitattributes index 25bc157af..d6ec7dd7f 100644 --- a/src/script/.gitattributes +++ b/src/script/.gitattributes @@ -1,2 +1,2 @@ ant eol=lf -anrRun eol=lf +antRun eol=lf diff --git a/src/script/ant b/src/script/ant index 8252d779c..a0ca99a87 100644 --- a/src/script/ant +++ b/src/script/ant @@ -22,35 +22,33 @@ use_jikes_default=false ant_exec_debug=false show_help=false -if [ -z "$PROTECT_NL" ] -then +if [ -z "$PROTECT_NL" ]; then PROTECT_NL=true os=`uname -s` rel=`uname -r` # heirloom bourne-shell used by Solaris 10 is not POSIX # it lacks features necessary to protect trailing NL from subshell trimming - if [ "$os" = SunOS -a "$rel" = "5.10" ] - then + if [ "$os" = SunOS -a "$rel" = "5.10" ]; then PROTECT_NL=false fi fi -for arg in "$@" ; do - if [ "$arg" = "--noconfig" ] ; then +for arg in "$@"; do + if [ "$arg" = "--noconfig" ]; then no_config=true - elif [ "$arg" = "--usejikes" ] ; then + elif [ "$arg" = "--usejikes" ]; then use_jikes_default=true - elif [ "$arg" = "--execdebug" ] ; then + elif [ "$arg" = "--execdebug" ]; then ant_exec_debug=true - elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then + 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 + if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ]; then show_help=true fi - if [ "$PROTECT_NL" = "true" ] ; then + if [ "$PROTECT_NL" = "true" ]; then # pad the value with X to protect trailing NLs from subshell output trimming esc_arg="${arg}X" else @@ -64,14 +62,13 @@ for arg in "$@" ; do # subshell (heirloom and posix) will trim the added trailing newline esc_arg="`printf '%s\n' "$esc_arg" | sed -e 's@\([$\"\`\\]\)@\\\\\\1@g' `" - if [ "$PROTECT_NL" = "true" ] ; then + if [ "$PROTECT_NL" = "true" ]; then # remove the padding X added above, this syntax is POSIX compatible but not heirloom-sh esc_arg="${esc_arg%X}" fi quoted_arg="\"$esc_arg\"" - if $ant_exec_debug - then + if $ant_exec_debug; then # using printf to avoid echo line continuation and escape interpretation printf "arg : %s\n" "$arg" printf "quoted_arg: %s\n" "$quoted_arg" @@ -81,37 +78,37 @@ for arg in "$@" ; do done # Source/default ant configuration -if $no_config ; then +if $no_config; then rpm_mode=false usejikes=$use_jikes_default else # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set) if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then - if [ -f "/etc/ant.conf" ] ; then + if [ -f "/etc/ant.conf" ]; then . /etc/ant.conf fi fi # load user ant configuration - if [ -f "$HOME/.ant/ant.conf" ] ; then + if [ -f "$HOME/.ant/ant.conf" ]; then . $HOME/.ant/ant.conf fi - if [ -f "$HOME/.antrc" ] ; then + if [ -f "$HOME/.antrc" ]; then . "$HOME/.antrc" fi # provide default configuration values - if [ -z "$rpm_mode" ] ; then + if [ -z "$rpm_mode" ]; then rpm_mode=false fi - if [ -z "$usejikes" ] ; then + if [ -z "$usejikes" ]; then usejikes=$use_jikes_default fi fi # Setup Java environment in rpm mode -if $rpm_mode ; then - if [ -f /usr/share/java-utils/java-functions ] ; then +if $rpm_mode; then + if [ -f /usr/share/java-utils/java-functions ]; then . /usr/share/java-utils/java-functions set_jvm set_javacmd @@ -123,32 +120,37 @@ cygwin=false; darwin=false; mingw=false; case "`uname`" in - CYGWIN*) cygwin=true ;; - Darwin*) darwin=true - if [ -z "$JAVA_HOME" ] ; then - if [ -x '/usr/libexec/java_home' ] ; then - JAVA_HOME=`/usr/libexec/java_home` - elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then - JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home - fi - fi - ;; - MINGW*) mingw=true ;; + CYGWIN*) + cygwin=true + ;; + Darwin*) + darwin=true + if [ -z "$JAVA_HOME" ]; then + if [ -x '/usr/libexec/java_home' ]; then + JAVA_HOME=`/usr/libexec/java_home` + elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then + JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + fi + ;; + MINGW*) + mingw=true + ;; esac -if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then +if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ]; then ## resolve links - $0 may be a link to ant's home PRG="$0" progname=`basename "$0"` # need this for relative symlinks - while [ -h "$PRG" ] ; do + while [ -h "$PRG" ]; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then - PRG="$link" + PRG="$link" else - PRG=`dirname "$PRG"`"/$link" + PRG=`dirname "$PRG"`"/$link" fi done @@ -160,41 +162,37 @@ fi # For Cygwin and Mingw, ensure paths are in UNIX format before # anything is touched -if $cygwin ; then - [ -n "$ANT_HOME" ] && - ANT_HOME=`cygpath --unix "$ANT_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +if $cygwin; then + [ -n "$ANT_HOME" ] && ANT_HOME=`cygpath --unix "$ANT_HOME"` + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` fi -if $mingw ; then - [ -n "$ANT_HOME" ] && - ANT_HOME="`(cd "$ANT_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +if $mingw; then + [ -n "$ANT_HOME" ] && ANT_HOME="`(cd "$ANT_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" fi # set ANT_LIB location ANT_LIB="${ANT_HOME}/lib" -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then +if [ -z "$JAVACMD" ]; then + if [ -n "$JAVA_HOME" ]; then # IBM's JDK on AIX uses strange locations for the executables - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then JAVACMD="$JAVA_HOME/jre/sh/java" - elif [ -x "$JAVA_HOME/jre/bin/java" ] ; then + elif [ -x "$JAVA_HOME/jre/bin/java" ]; then JAVACMD="$JAVA_HOME/jre/bin/java" else JAVACMD="$JAVA_HOME/bin/java" fi else JAVACMD=`which java 2> /dev/null ` - if [ -z "$JAVACMD" ] ; then + if [ -z "$JAVACMD" ]; then JAVACMD=java fi fi fi -if [ ! -x "$JAVACMD" ] ; then +if [ ! -x "$JAVACMD" ]; then echo "Error: JAVA_HOME is not defined correctly." echo " We cannot execute $JAVACMD" exit 1 @@ -207,41 +205,40 @@ fi # is discouraged as it is not java-version safe. A user should # request optional jars and their dependencies via the OPT_JAR_LIST # variable -if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then +if $rpm_mode && [ -x /usr/bin/build-classpath ]; then LOCALCLASSPATH="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)" # If no optional jars have been specified then build the default list - if [ -z "$OPT_JAR_LIST" ] ; then + if [ -z "$OPT_JAR_LIST" ]; then for file in /etc/ant.d/*; do if [ -f "$file" ]; then case "$file" in - *~) ;; - *#*) ;; - *.rpmsave) ;; - *.rpmnew) ;; - *) - for dep in `cat "$file"`; do - OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep" - done + *~|*#*|*.rpmsave|*.rpmnew) + ;; + *) + for dep in `cat "$file"`; do + OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep" + done + ;; esac fi done fi # If the user requested to try to add some other jars to the classpath - if [ -n "$OPT_JAR_LIST" ] ; then + if [ -n "$OPT_JAR_LIST" ]; then _OPTCLASSPATH="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)" - if [ -n "$_OPTCLASSPATH" ] ; then + if [ -n "$_OPTCLASSPATH" ]; then LOCALCLASSPATH="$LOCALCLASSPATH:$_OPTCLASSPATH" fi fi # Explicitly add javac path to classpath, assume JAVA_HOME set # properly in rpm mode - if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then + if [ -f "$JAVA_HOME/lib/tools.jar" ]; then LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar" fi - if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then + if [ -f "$JAVA_HOME/lib/classes.zip" ]; then LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip" fi @@ -251,11 +248,11 @@ if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then # # if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour # with ant-found jars first and user CLASSPATH after - if [ -n "$CLASSPATH" ] ; then - # merge local and specified classpath - if [ -z "$LOCALCLASSPATH" ] ; then + if [ -n "$CLASSPATH" ]; then + # merge local and specified classpath + if [ -z "$LOCALCLASSPATH" ]; then LOCALCLASSPATH="$CLASSPATH" - elif [ -n "$CLASSPATH_OVERRIDE" ] ; then + elif [ -n "$CLASSPATH_OVERRIDE" ]; then LOCALCLASSPATH="$CLASSPATH:$LOCALCLASSPATH" else LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH" @@ -266,20 +263,19 @@ if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then fi else # not using rpm_mode; use launcher to determine classpaths - if [ -z "$LOCALCLASSPATH" ] ; then + if [ -z "$LOCALCLASSPATH" ]; then LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar else LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH fi fi -if [ -n "$JAVA_HOME" ] ; then +if [ -n "$JAVA_HOME" ]; then # OSX hack to make Ant work with jikes - if $darwin ; then + if $darwin; then OSXHACK="${JAVA_HOME}/../Classes" - if [ -d "${OSXHACK}" ] ; then - for i in "${OSXHACK}"/*.jar - do + if [ -d "${OSXHACK}" ]; then + for i in "${OSXHACK}"/*.jar; do JIKESPATH="$JIKESPATH:$i" done fi @@ -297,7 +293,7 @@ fi # in the name in the path. Let's assume that paths containing ; are more # rare than windows style paths on cygwin. if $cygwin; then - if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then + if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null; then format=mixed else format=windows @@ -307,7 +303,7 @@ if $cygwin; then [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --$format "$JAVA_HOME"` LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"` LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"` - if [ -n "$CLASSPATH" ] ; then + if [ -n "$CLASSPATH" ]; then CP_TEMP=`cygpath --path --unix "$CLASSPATH"` CLASSPATH=`cygpath --path --$format "$CP_TEMP"` fi @@ -315,7 +311,7 @@ if $cygwin; then fi # Show script help if requested -if $show_help ; then +if $show_help; then echo $0 '[script options] [options] [target [target2 [target3] ..]]' echo 'Script Options:' echo ' --help, --h print this message and ant help' @@ -326,33 +322,33 @@ if $show_help ; then echo ' set explicitly in configuration files' echo ' --execdebug print ant exec line generated by this' echo ' launch script' - echo ' ' + echo '' fi # add a second backslash to variables terminated by a backslash under cygwin if $cygwin; then case "$ANT_HOME" in *\\ ) - ANT_HOME="$ANT_HOME\\" + ANT_HOME="$ANT_HOME\\" ;; esac case "$CYGHOME" in *\\ ) - CYGHOME="$CYGHOME\\" + CYGHOME="$CYGHOME\\" ;; esac case "$JIKESPATH" in *\\ ) - JIKESPATH="$JIKESPATH\\" + JIKESPATH="$JIKESPATH\\" ;; esac case "$LOCALCLASSPATH" in *\\ ) - LOCALCLASSPATH="$LOCALCLASSPATH\\" + LOCALCLASSPATH="$LOCALCLASSPATH\\" ;; esac case "$CLASSPATH" in *\\ ) - CLASSPATH="$CLASSPATH\\" + CLASSPATH="$CLASSPATH\\" ;; esac fi @@ -371,7 +367,7 @@ else fi fi ant_exec_command="exec \"\$JAVACMD\" $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 +if $ant_exec_debug; then # using printf to avoid echo line continuation and escape interpretation confusion printf "%s\n" "$ant_exec_command $ant_exec_args" fi diff --git a/src/script/ant.bat b/src/script/ant.bat index 3486e144c..a13cabc99 100755 --- a/src/script/ant.bat +++ b/src/script/ant.bat @@ -6,9 +6,9 @@ REM this work for additional information regarding copyright ownership. REM The ASF licenses this file to You under the Apache License, Version 2.0 REM (the "License"); you may not use this file except in compliance with REM the License. You may obtain a copy of the License at -REM +REM REM http://www.apache.org/licenses/LICENSE-2.0 -REM +REM REM Unless required by applicable law or agreed to in writing, software REM distributed under the License is distributed on an "AS IS" BASIS, REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/src/script/ant.cmd b/src/script/ant.cmd index d221a4095..902a1a783 100644 --- a/src/script/ant.cmd +++ b/src/script/ant.cmd @@ -1,4 +1,4 @@ -/* +/* 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. @@ -13,7 +13,7 @@ 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. - + Run ant */ diff --git a/src/script/antRun.bat b/src/script/antRun.bat index 10d2bbc78..24eade924 100755 --- a/src/script/antRun.bat +++ b/src/script/antRun.bat @@ -6,9 +6,9 @@ REM this work for additional information regarding copyright ownership. REM The ASF licenses this file to You under the Apache License, Version 2.0 REM (the "License"); you may not use this file except in compliance with REM the License. You may obtain a copy of the License at -REM +REM REM http://www.apache.org/licenses/LICENSE-2.0 -REM +REM REM Unless required by applicable law or agreed to in writing, software REM distributed under the License is distributed on an "AS IS" BASIS, REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -47,4 +47,3 @@ rem echo %ANT_RUN_CMD% if "%OS%"=="Windows_NT" @endlocal if "%OS%"=="WINNT" @endlocal - diff --git a/src/script/antRun.pl b/src/script/antRun.pl index 0bc5cc5e9..bc493ddf0 100644 --- a/src/script/antRun.pl +++ b/src/script/antRun.pl @@ -20,7 +20,7 @@ # antRun.pl # # wrapper script for invoking commands on a platform with Perl installed -# this is akin to antRun.bat, and antRun the SH script +# this is akin to antRun.bat, and antRun the SH script ####################################################################### #be fussy about variables use strict; @@ -29,21 +29,20 @@ use strict; #use warnings; #and set $debug to 1 to turn on trace info (currently unused) -my $debug=1; +my $debug = 1; ####################################################################### # change drive and directory to "%1" my $ANT_RUN_CMD = @ARGV[0]; # assign current run command to "%2" -chdir (@ARGV[0]) || die "Can't cd to $ARGV[0]: $!\n"; +chdir(@ARGV[0]) || die "Can't cd to $ARGV[0]: $!\n"; if ($^O eq "NetWare") { # There is a bug in Perl 5 on NetWare, where chdir does not - # do anything. On NetWare, the following path-prefixed form should + # do anything. On NetWare, the following path-prefixed form should # always work. (afaict) - $ANT_RUN_CMD .= "/".@ARGV[1]; -} -else { + $ANT_RUN_CMD .= "/" . @ARGV[1]; +} else { $ANT_RUN_CMD = @ARGV[1]; } @@ -55,8 +54,7 @@ shift; my $returnValue = system $ANT_RUN_CMD, @ARGV; if ($returnValue eq 0) { exit 0; -} -else { +} else { # only 0 and 1 are widely recognized as exit values # so change the exit value to 1 exit 1; diff --git a/src/script/antenv.cmd b/src/script/antenv.cmd index 170d89f34..7913801d1 100644 --- a/src/script/antenv.cmd +++ b/src/script/antenv.cmd @@ -1,4 +1,4 @@ -/* +/* 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. diff --git a/src/script/complete-ant-cmd.pl b/src/script/complete-ant-cmd.pl index 40c5a9ad4..c1b7ba120 100644 --- a/src/script/complete-ant-cmd.pl +++ b/src/script/complete-ant-cmd.pl @@ -15,10 +15,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# A script to allow Bash or Z-Shell to complete an Ant command-line. +# A script to allow Bash or Z-Shell to complete an Ant command-line. # # To install for Bash 2.0 or better, add the following to ~/.bashrc: -# +# # complete -C complete-ant-cmd.pl ant build.sh # # To install for Z-Shell 2.5 or better, add the following to ~/.zshrc: @@ -37,11 +37,11 @@ my $word = $ARGV[1]; my @completions; if ($word =~ /^-/) { - list( restrict( $word, getArguments() )); + list(restrict($word, getArguments())); } elsif ($cmdLine =~ /-(f|file|buildfile)\s+\S*$/) { - list( getBuildFiles($word) ); + list(getBuildFiles($word)); } else { - list( restrict( $word, getTargets() )); + list(restrict($word, getTargets())); } exit(0); @@ -54,18 +54,18 @@ sub list { sub restrict { my ($word, @completions) = @_; - grep( /^\Q$word\E/, @completions ); + grep(/^\Q$word\E/, @completions); } sub getArguments { - qw(-buildfile -debug -emacs -f -file -find -help -listener -logfile - -logger -projecthelp -quiet -verbose -version); + qw(-buildfile -debug -emacs -f -file -find -help -listener -logfile + -logger -projecthelp -quiet -verbose -version); } sub getBuildFiles { my ($word) = @_; - grep( /\.xml$/, glob( "$word*" )); + grep(/\.xml$/, glob("$word*")); } sub getTargets { @@ -83,10 +83,10 @@ sub getTargets { my $cacheFile = $buildFile; $cacheFile =~ s|(.*/)?(.*)|${1}.ant-targets-${2}|; if ((!-e $cacheFile) || (-z $cacheFile) || (-M $buildFile) < (-M $cacheFile)) { - open( CACHE, '>'.$cacheFile ) || die "can\'t write $cacheFile: $!\n"; - open( HELP, "$antCmd -projecthelp -debug -buildfile '$buildFile'|" ) || return(); + open(CACHE, '>'.$cacheFile) || die "can\'t write $cacheFile: $!\n"; + open(HELP, "$antCmd -projecthelp -debug -buildfile '$buildFile'|") || return(); my %targets; - while( <HELP> ) { + while (<HELP>) { # Exclude target names starting with dash, because they cannot be # specified on the command line. if (/^\s+\+Target:\s+(?!-)(\S+)/) { @@ -94,22 +94,21 @@ sub getTargets { } } my @targets = sort keys %targets; - for (@targets) { print CACHE "$_\n"; } + for (@targets) { + print CACHE "$_\n"; + } return @targets; } - + # Read the target-cache - open( CACHE, $cacheFile ) || die "can\'t read $cacheFile: $!\n"; + open(CACHE, $cacheFile) || die "can\'t read $cacheFile: $!\n"; my @targets; while (<CACHE>) { chop; s/\r$//; # for Cygwin - push( @targets, $_ ); + push(@targets, $_); } - close( CACHE ); + close(CACHE); @targets; } - - - diff --git a/src/script/lcp.bat b/src/script/lcp.bat index 4bf2e7ce1..6a1acbec9 100755 --- a/src/script/lcp.bat +++ b/src/script/lcp.bat @@ -5,9 +5,9 @@ REM this work for additional information regarding copyright ownership. REM The ASF licenses this file to You under the Apache License, Version 2.0 REM (the "License"); you may not use this file except in compliance with REM the License. You may obtain a copy of the License at -REM +REM REM http://www.apache.org/licenses/LICENSE-2.0 -REM +REM REM Unless required by applicable law or agreed to in writing, software REM distributed under the License is distributed on an "AS IS" BASIS, REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,4 +28,3 @@ goto argCheck :gotAllArgs set LOCALCLASSPATH=%LOCALCLASSPATH%;%_CLASSPATHCOMPONENT% - diff --git a/src/script/runant.pl b/src/script/runant.pl index fc26faa55..5b9a31f2b 100644 --- a/src/script/runant.pl +++ b/src/script/runant.pl @@ -27,7 +27,7 @@ # the code is not totally portable due to classpath and directory splitting # issues. oops. (NB, use File::Spec::Functions will help and the code is # structured for the catfile() call, but because of perl version funnies -# the code is not included. +# the code is not included. ####################################################################### # # Assumptions: @@ -47,7 +47,7 @@ use strict; #use warnings; #and set $debug to 1 to turn on trace info -my $debug=1; +my $debug = 1; ####################################################################### # @@ -55,43 +55,34 @@ my $debug=1; # my $HOME = $ENV{ANT_HOME}; -if ($HOME eq "") - { +if (!$HOME) { die "\n\nANT_HOME *MUST* be set!\n\n"; - } +} -my $JAVACMD = $ENV{JAVACMD}; -$JAVACMD = "java" if $JAVACMD eq ""; +my $JAVACMD = $ENV{JAVACMD} || "java"; -my $onnetware = 0; -if ($^O eq "NetWare") -{ - $onnetware = 1; -} +my $onnetware = ($^O eq "NetWare"); my $oncygwin = ($^O eq "cygwin"); -#ISSUE: what java wants to split up classpath varies from platform to platform +#ISSUE: what java wants to split up classpath varies from platform to platform #and perl is not too hot at hinting which box it is on. #here I assume ":" 'cept on win32, dos, and netware. Add extra tests here as needed. -my $s=":"; -if(($^O eq "MSWin32") || ($^O eq "dos") || ($^O eq "cygwin") || - ($onnetware == 1)) - { - $s=";"; - } +my $s = ":"; +if (($^O eq "MSWin32") || ($^O eq "dos") || $oncygwin || $onnetware) { + $s=";"; +} #build up standard classpath my $localpath = "$HOME/lib/ant-launcher.jar"; #set JVM options and Ant arguments, if any -my @ANT_OPTS=split(" ", $ENV{ANT_OPTS}); -my @ANT_ARGS=split(" ", $ENV{ANT_ARGS}); +my @ANT_OPTS = split(" ", $ENV{ANT_OPTS}); +my @ANT_ARGS = split(" ", $ENV{ANT_ARGS}); #jikes -if($ENV{JIKESPATH} ne "") - { - push @ANT_OPTS, "-Djikes.class.path=$ENV{JIKESPATH}"; - } +if ($ENV{JIKESPATH}) { + push @ANT_OPTS, "-Djikes.class.path=$ENV{JIKESPATH}"; +} #construct arguments to java my @ARGS; @@ -99,52 +90,43 @@ push @ARGS, @ANT_OPTS; my $CYGHOME = ""; -my $classpath=$ENV{CLASSPATH}; -if ($oncygwin == 1) { - $localpath = `cygpath --path --windows $localpath`; - chomp ($localpath); - if (! $classpath eq "") - { - $classpath = `cygpath --path --windows "$classpath"`; - chomp ($classpath); - } - $HOME = `cygpath --path --windows $HOME`; - chomp ($HOME); - $CYGHOME = `cygpath --path --windows $ENV{HOME}`; - chomp ($CYGHOME); +my $classpath = $ENV{CLASSPATH}; +if ($oncygwin) { + $localpath = `cygpath --path --windows $localpath`; + chomp ($localpath); + if ($classpath) { + $classpath = `cygpath --path --windows "$classpath"`; + chomp ($classpath); + } + $HOME = `cygpath --path --windows $HOME`; + chomp ($HOME); + $CYGHOME = `cygpath --path --windows $ENV{HOME}`; + chomp ($CYGHOME); } push @ARGS, "-classpath", "$localpath"; push @ARGS, "-Dant.home=$HOME"; -if ( ! $CYGHOME eq "" ) -{ - push @ARGS, "-Dcygwin.user.home=\"$CYGHOME\"" +if ($CYGHOME) { + push @ARGS, "-Dcygwin.user.home=\"$CYGHOME\"" } push @ARGS, "org.apache.tools.ant.launch.Launcher", @ANT_ARGS; push @ARGS, @ARGV; -if (! $classpath eq "") -{ - if ($onnetware == 1) - { - # make classpath literally $CLASSPATH - # this is to avoid pushing us over the 512 character limit - # even skip the ; - that is already in $localpath - push @ARGS, "-lib", "\$CLASSPATH"; - } - else - { - push @ARGS, "-lib", "$classpath"; - } +if ($classpath) { + if ($onnetware) { + # make classpath literally $CLASSPATH + # this is to avoid pushing us over the 512 character limit + # even skip the ; - that is already in $localpath + push @ARGS, "-lib", "\$CLASSPATH"; + } else { + push @ARGS, "-lib", "$classpath"; + } } print "\n $JAVACMD @ARGS\n\n" if ($debug); my $returnValue = system $JAVACMD, @ARGS; -if ($returnValue eq 0) - { - exit 0; - } -else - { - # only 0 and 1 are widely recognized as exit values - # so change the exit value to 1 - exit 1; - } +if ($returnValue eq 0) { + exit 0; +} else { + # only 0 and 1 are widely recognized as exit values + # so change the exit value to 1 + exit 1; +} diff --git a/src/script/runrc.cmd b/src/script/runrc.cmd index c68f04d4a..c17fd0f65 100644 --- a/src/script/runrc.cmd +++ b/src/script/runrc.cmd @@ -1,4 +1,4 @@ -/* +/* 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. @@ -15,7 +15,7 @@ limitations under the License. Run RC file, name is in the first arg, second arg is either PATH - ENV or -r or nothing + ENV or -r or nothing */ parse arg name path rest |