You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

antRun.pl 2.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/perl
  2. #
  3. # Copyright 2001,2003-2004 The Apache Software Foundation
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. #######################################################################
  18. #
  19. # antRun.pl
  20. #
  21. # wrapper script for invoking commands on a platform with Perl installed
  22. # this is akin to antRun.bat, and antRun the SH script
  23. #
  24. # created: 2001-10-18
  25. # author: Jeff Tulley jtulley@novell.com
  26. #######################################################################
  27. #be fussy about variables
  28. use strict;
  29. #turn warnings on during dev; generates a few spurious uninitialised var access warnings
  30. #use warnings;
  31. #and set $debug to 1 to turn on trace info (currently unused)
  32. my $debug=1;
  33. #######################################################################
  34. # change drive and directory to "%1"
  35. my $ANT_RUN_CMD = @ARGV[0];
  36. # assign current run command to "%2"
  37. chdir (@ARGV[0]) || die "Can't cd to $ARGV[0]: $!\n";
  38. if ($^O eq "NetWare") {
  39. # There is a bug in Perl 5 on NetWare, where chdir does not
  40. # do anything. On NetWare, the following path-prefixed form should
  41. # always work. (afaict)
  42. $ANT_RUN_CMD .= "/".@ARGV[1];
  43. }
  44. else {
  45. $ANT_RUN_CMD = @ARGV[1];
  46. }
  47. # dispose of the first two arguments, leaving only the command's args.
  48. shift;
  49. shift;
  50. # run the command
  51. my $returnValue = system $ANT_RUN_CMD, @ARGV;
  52. if ($returnValue eq 0) {
  53. exit 0;
  54. }
  55. else {
  56. # only 0 and 1 are widely recognized as exit values
  57. # so change the exit value to 1
  58. exit 1;
  59. }