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.

ant.bat 2.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. @echo off
  2. if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
  3. if not "%OS%"=="Windows_NT" goto win9xStart
  4. :winNTStart
  5. @setlocal
  6. rem %~dp0 is name of current script under NT
  7. set DEFAULT_ANT_HOME=%~dp0
  8. rem : operator works similar to make : operator
  9. set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME:\bin\=%
  10. if %ANT_HOME%a==a set ANT_HOME=%DEFAULT_ANT_HOME%
  11. set DEFAULT_ANT_HOME=
  12. rem On NT/2K grab all arguments at once
  13. set ANT_CMD_LINE_ARGS=%*
  14. goto doneStart
  15. :win9xStart
  16. rem Slurp the command line arguments. This loop allows for an unlimited number of
  17. rem agruments (up to the command line limit, anyway).
  18. set ANT_CMD_LINE_ARGS=
  19. :setupArgs
  20. if %1a==a goto doneStart
  21. set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
  22. shift
  23. goto setupArgs
  24. :doneStart
  25. rem This label provides a place for the argument list loop to break out
  26. rem and for NT handling to skip to.
  27. rem find ANT_HOME
  28. if not "%ANT_HOME%"=="" goto checkJava
  29. rem check for ant in Program Files on system drive
  30. if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive
  31. set ANT_HOME=%SystemDrive%\Program Files\ant
  32. goto checkJava
  33. :checkSystemDrive
  34. rem check for ant in root directory of system drive
  35. if not exist "%SystemDrive%\ant" goto noAntHome
  36. set ANT_HOME=%SystemDrive%\ant
  37. goto checkJava
  38. :noAntHome
  39. echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME.
  40. goto end
  41. :checkJava
  42. set _JAVACMD=%JAVACMD%
  43. set LOCALCLASSPATH="%CLASSPATH%"
  44. for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" "%%i"
  45. if "%JAVA_HOME%" == "" goto noJavaHome
  46. if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java
  47. if exist "%JAVA_HOME%\lib\tools.jar" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\tools.jar"
  48. if exist "%JAVA_HOME%\lib\classes.zip" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\classes.zip"
  49. goto checkJikes
  50. :noJavaHome
  51. if "%_JAVACMD%" == "" set _JAVACMD=java
  52. echo.
  53. echo Warning: JAVA_HOME environment variable is not set.
  54. echo If build fails because sun.* classes could not be found
  55. echo you will need to set the JAVA_HOME environment variable
  56. echo to the installation directory of java.
  57. echo.
  58. :checkJikes
  59. if not "%JIKESPATH%" == "" goto runAntWithJikes
  60. :runAnt
  61. %_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
  62. goto end
  63. :runAntWithJikes
  64. %_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH% %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
  65. :end
  66. set LOCALCLASSPATH=
  67. set ANT_CMD_LINE_ARGS=
  68. if not "%OS%"=="Windows_NT" goto mainEnd
  69. :winNTend
  70. @endlocal
  71. :mainEnd
  72. if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"