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.

bootstrap.bat 5.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. @echo off
  2. REM You will need to specify JAVA_HOME.
  3. REM For compiling Ant Java 1.4 or higher is required.
  4. REM Licensed to the Apache Software Foundation (ASF) under one or more
  5. REM contributor license agreements. See the NOTICE file distributed with
  6. REM this work for additional information regarding copyright ownership.
  7. REM The ASF licenses this file to You under the Apache License, Version 2.0
  8. REM (the "License"); you may not use this file except in compliance with
  9. REM the License. You may obtain a copy of the License at
  10. REM
  11. REM https://www.apache.org/licenses/LICENSE-2.0
  12. REM
  13. REM Unless required by applicable law or agreed to in writing, software
  14. REM distributed under the License is distributed on an "AS IS" BASIS,
  15. REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. REM See the License for the specific language governing permissions and
  17. REM limitations under the License.
  18. set OLDJAVA=%JAVA%
  19. set OLDJAVAC=%JAVAC%
  20. set BOOTOLDCLASSPATH=%CLASSPATH%
  21. set OLDANTHOME=%ANT_HOME%
  22. set ANT_HOME=.
  23. if "" == "%JAVA%" if "" == "%JAVA_HOME%" set JAVA=java
  24. if "" == "%JAVA%" set JAVA=%JAVA_HOME%\bin\java
  25. if "" == "%JAVAC%" if "" == "%JAVA_HOME%" set JAVAC=javac
  26. if "" == "%JAVAC%" set JAVAC=%JAVA_HOME%\bin\javac
  27. echo.
  28. echo ... Bootstrapping Ant Distribution
  29. if "%OS%" == "Windows_NT" if exist bootstrap\nul rmdir/s/q bootstrap
  30. if not "%OS%" == "Windows_NT" if exist bootstrap\nul deltree/y bootstrap
  31. if "%OS%" == "Windows_NT" if exist build\nul rmdir/s/q build
  32. if not "%OS%" == "Windows_NT" if exist build\nul deltree/y build
  33. SET LOCALCLASSPATH=
  34. for %%i in (lib\optional\*.jar) do call src\script\lcp.bat %%i
  35. if exist "%JAVA_HOME%\lib\tools.jar" call src\script\lcp.bat %JAVA_HOME%\lib\tools.jar
  36. if exist "%JAVA_HOME%\lib\classes.zip" call src\script\lcp.bat %JAVA_HOME%\lib\classes.zip
  37. set TOOLS=src\main\org\apache\tools
  38. set CLASSDIR=build\classes
  39. SET CLASSPATH=%LOCALCLASSPATH%;%CLASSDIR%;src\main;%CLASSPATH%
  40. echo JAVA_HOME=%JAVA_HOME%
  41. echo JAVA=%JAVA%
  42. echo JAVAC=%JAVAC%
  43. echo CLASSPATH=%CLASSPATH%
  44. echo ANT_HOME=%ANT_HOME%
  45. if "%OS%" == "Windows_NT" if exist %CLASSDIR%\nul rmdir/s/q %CLASSDIR%
  46. if not "%OS%" == "Windows_NT" if exist %CLASSDIR%\nul deltree/y %CLASSDIR%
  47. if not exist build\nul mkdir build
  48. if not exist build\classes\nul mkdir build\classes
  49. rem Check if javac tool supports the --release param
  50. SET JAVAC_RELEASE_VERSION=""
  51. echo "public class JavacVersionCheck {}" > %CLASSDIR%\JavacVersionCheck.java
  52. "%JAVAC%" --release 8 -d %CLASSDIR% %CLASSDIR%\JavacVersionCheck.java >nul 2>&1
  53. IF %ERRORLEVEL% EQU 0 SET JAVAC_RELEASE_VERSION="--release 8"
  54. DEL %CLASSDIR%\JavacVersionCheck.java %CLASSDIR%\JavacVersionCheck.class >nul 2>&1
  55. echo.
  56. IF %JAVAC_RELEASE_VERSION% == "" (
  57. echo ... Compiling Ant Classes
  58. "%JAVAC%" %BOOTJAVAC_OPTS% -d %CLASSDIR% %TOOLS%\bzip2\*.java %TOOLS%\tar\*.java %TOOLS%\zip\*.java %TOOLS%\ant\*.java %TOOLS%\ant\types\*.java %TOOLS%\ant\taskdefs\*.java %TOOLS%\ant\util\regexp\RegexpMatcher.java %TOOLS%\ant\util\regexp\RegexpMatcherFactory.java %TOOLS%\ant\taskdefs\condition\*.java %TOOLS%\ant\taskdefs\compilers\*.java %TOOLS%\ant\types\resources\*.java %TOOLS%\ant\property\*.java
  59. ) ELSE (
  60. echo ... Compiling Ant Classes with %JAVAC_RELEASE_VERSION%
  61. "%JAVAC%" %BOOTJAVAC_OPTS% -d %CLASSDIR% %JAVAC_RELEASE_VERSION% %TOOLS%\bzip2\*.java %TOOLS%\tar\*.java %TOOLS%\zip\*.java %TOOLS%\ant\*.java %TOOLS%\ant\types\*.java %TOOLS%\ant\taskdefs\*.java %TOOLS%\ant\util\regexp\RegexpMatcher.java %TOOLS%\ant\util\regexp\RegexpMatcherFactory.java %TOOLS%\ant\taskdefs\condition\*.java %TOOLS%\ant\taskdefs\compilers\*.java %TOOLS%\ant\types\resources\*.java %TOOLS%\ant\property\*.java
  62. )
  63. if ERRORLEVEL 1 goto mainend
  64. echo.
  65. echo ... Copying Required Files
  66. copy %TOOLS%\ant\taskdefs\*.properties %CLASSDIR%\org\apache\tools\ant\taskdefs
  67. copy %TOOLS%\ant\types\*.properties %CLASSDIR%\org\apache\tools\ant\types
  68. echo.
  69. echo ... Building Ant Distribution
  70. if not "%OS%"=="Windows_NT" goto win9xStart
  71. :winNTStart
  72. @setlocal
  73. REM parse command line arguments
  74. rem Need to check if we are using the 4NT shell...
  75. if "%eval[2+2]" == "4" goto setup4NT
  76. rem On NT/2K grab all arguments at once
  77. set ANT_CMD_LINE_ARGS=%*
  78. goto doneStart
  79. :setup4NT
  80. set ANT_CMD_LINE_ARGS=%$
  81. goto doneStart
  82. :win9xStart
  83. rem Slurp the command line arguments. This loop allows for an unlimited number of
  84. rem arguments (up to the command line limit, anyway).
  85. set ANT_CMD_LINE_ARGS=
  86. :setupArgs
  87. if %1a==a goto doneStart
  88. set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
  89. shift
  90. goto setupArgs
  91. :doneStart
  92. rem This label provides a place for the argument list loop to break out
  93. rem and for NT handling to skip to.
  94. "%JAVA%" %ANT_OPTS% org.apache.tools.ant.Main -emacs %ANT_CMD_LINE_ARGS% bootstrap
  95. set ANT_CMD_LINE_ARGS=
  96. if not "%OS%"=="Windows_NT" goto mainEnd
  97. :winNTend
  98. @endlocal
  99. :mainEnd
  100. echo.
  101. echo ... Cleaning Up Build Directories
  102. if "%OS%" == "Windows_NT" if exist %CLASSDIR%\nul rmdir/s/q %CLASSDIR%
  103. if not "%OS%" == "Windows_NT" if exist %CLASSDIR%\nul deltree/y %CLASSDIR%
  104. echo.
  105. echo ... Done Bootstrapping Ant Distribution
  106. set JAVA=%OLDJAVA%
  107. set JAVAC=%OLDJAVAC%
  108. set CLASSPATH=%BOOTOLDCLASSPATH%
  109. set ANT_HOME=%OLDANTHOME%
  110. set OLDJAVA=
  111. set OLDJAVAC=
  112. set BOOTOLDCLASSPATH=
  113. set LOCALCLASSPATH=
  114. set OLDANTHOME=
  115. set TOOLS=