runant.pl revision 809
0N/A# Licensed to the Apache Software Foundation (ASF) under one or more 0N/A# contributor license agreements. See the NOTICE file distributed with 0N/A# this work for additional information regarding copyright ownership. 0N/A# The ASF licenses this file to You under the Apache License, Version 2.0 0N/A# (the "License"); you may not use this file except in compliance with 756N/A# the License. You may obtain a copy of the License at 0N/A# Unless required by applicable law or agreed to in writing, software 0N/A# distributed under the License is distributed on an "AS IS" BASIS, 0N/A# 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. ####################################################################### # wrapper script for invoking ant in a platform with Perl installed # this may include cgi-bin invocation, which is considered somewhat daft. # (slo: that should be a separate file which can be derived from this # and returns the XML formatted output) # 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. # author: Steve Loughran steve_l@sourceforge.net ####################################################################### # - ANT_HOME has been set # - target platform uses ":" as classpath separator or perl indicates it is dos/win32 # - target platform uses "/" as directory separator. #be fussy about variables #platform specifics (disabled) #use File::Spec::Functions; #turn warnings on during dev; generates a few spurious uninitialised var access warnings #and set $debug to 1 to turn on trace info ####################################################################### # check to make sure environment is setup die "\n\nANT_HOME *MUST* be set!\n\n";
#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. if(($^O
eq "MSWin32") || ($^O
eq "dos") || ($^O
eq "cygwin") ||
#build up standard classpath #set JVM options and Ant arguments, if any push @
ANT_OPTS,
"-Djikes.class.path=$ENV{JIKESPATH}";
#construct arguments to java push @
ARGS,
"-classpath",
"$localpath";
push @
ARGS,
"-Dant.home=$HOME";
push @
ARGS,
"-Dcygwin.user.home=\"$CYGHOME\"" push @
ARGS,
"org.apache.tools.ant.launch.Launcher", @
ANT_ARGS;
# 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";
push @
ARGS,
"-lib",
"$classpath";
print "\n $JAVACMD @ARGS\n\n" if ($
debug);
# only 0 and 1 are widely recognized as exit values # so change the exit value to 1