-
Notifications
You must be signed in to change notification settings - Fork 438
/
bootstrap.bat
executable file
·149 lines (114 loc) · 4.92 KB
/
bootstrap.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
@echo off
REM You will need to specify JAVA_HOME.
REM For compiling Ant Java 1.4 or higher is required.
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
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 https://www.apache.org/licenses/LICENSE-2.0
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.
REM See the License for the specific language governing permissions and
REM limitations under the License.
set OLDJAVA=%JAVA%
set OLDJAVAC=%JAVAC%
set BOOTOLDCLASSPATH=%CLASSPATH%
set OLDANTHOME=%ANT_HOME%
set ANT_HOME=.
if "" == "%JAVA%" if "" == "%JAVA_HOME%" set JAVA=java
if "" == "%JAVA%" set JAVA=%JAVA_HOME%\bin\java
if "" == "%JAVAC%" if "" == "%JAVA_HOME%" set JAVAC=javac
if "" == "%JAVAC%" set JAVAC=%JAVA_HOME%\bin\javac
echo.
echo ... Bootstrapping Ant Distribution
if exist bootstrap\nul rmdir/s/q bootstrap
if exist build\nul rmdir/s/q build
SET LOCALCLASSPATH=
for %%i in (lib\optional\*.jar) do call src\script\lcp.bat %%i
if exist "%JAVA_HOME%\lib\tools.jar" call src\script\lcp.bat %JAVA_HOME%\lib\tools.jar
if exist "%JAVA_HOME%\lib\classes.zip" call src\script\lcp.bat %JAVA_HOME%\lib\classes.zip
set TOOLS=src\main\org\apache\tools
set CLASSDIR=build\classes
SET CLASSPATH=%LOCALCLASSPATH%;%CLASSDIR%;src\main;%CLASSPATH%
SET BOOTJAVAC_OPTS=-proc:none %BOOTJAVAC_OPTS%
echo JAVA_HOME=%JAVA_HOME%
echo JAVA=%JAVA%
echo JAVAC=%JAVAC%
echo CLASSPATH=%CLASSPATH%
echo ANT_HOME=%ANT_HOME%
if exist %CLASSDIR%\nul rmdir/s/q %CLASSDIR%
if not exist build\nul mkdir build
if not exist build\classes\nul mkdir build\classes
rem Check if javac tool supports the --release param
SET JAVAC_RELEASE_VERSION=
echo public class JavacVersionCheck {} >%CLASSDIR%\JavacVersionCheck.java
"%JAVAC%" --release 8 -d %CLASSDIR% %CLASSDIR%\JavacVersionCheck.java >nul 2>&1
IF ERRORLEVEL 0 IF NOT ERRORLEVEL 1 SET JAVAC_RELEASE_VERSION=--release 8
DEL %CLASSDIR%\JavacVersionCheck.java %CLASSDIR%\JavacVersionCheck.class >nul 2>&1
echo.
IF "%JAVAC_RELEASE_VERSION%" == "" (
echo ... Compiling Ant Classes
"%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
) ELSE (
echo ... Compiling Ant Classes with "%JAVAC_RELEASE_VERSION%"
"%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
)
IF ERRORLEVEL 0 IF NOT ERRORLEVEL 1 goto build
goto mainEnd
:build
echo.
echo ... Copying Required Files
copy %TOOLS%\ant\taskdefs\*.properties %CLASSDIR%\org\apache\tools\ant\taskdefs
copy %TOOLS%\ant\types\*.properties %CLASSDIR%\org\apache\tools\ant\types
echo.
echo ... Building Ant Distribution
if not "%OS%"=="Windows_NT" goto win9xStart
:winNTStart
@setlocal
REM parse command line arguments
rem Need to check if we are using the 4NT shell...
if "%eval[2+2]" == "4" goto setup4NT
rem On NT/2K grab all arguments at once
set ANT_CMD_LINE_ARGS=%*
goto doneStart
:setup4NT
set ANT_CMD_LINE_ARGS=%$
goto doneStart
:win9xStart
rem Slurp the command line arguments. This loop allows for an unlimited number of
rem arguments (up to the command line limit, anyway).
set ANT_CMD_LINE_ARGS=
:setupArgs
if %1a==a goto doneStart
set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
shift
goto setupArgs
:doneStart
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.
"%JAVA%" %ANT_OPTS% org.apache.tools.ant.Main -emacs %ANT_CMD_LINE_ARGS% bootstrap
set ANT_CMD_LINE_ARGS=
if not "%OS%"=="Windows_NT" goto mainEnd
:winNTend
@endlocal
:mainEnd
echo.
echo ... Cleaning Up Build Directories
if exist %CLASSDIR%\nul rmdir/s/q %CLASSDIR%
echo.
echo ... Done Bootstrapping Ant Distribution
set JAVA=%OLDJAVA%
set JAVAC=%OLDJAVAC%
set CLASSPATH=%BOOTOLDCLASSPATH%
set ANT_HOME=%OLDANTHOME%
set OLDJAVA=
set OLDJAVAC=
set BOOTOLDCLASSPATH=
set LOCALCLASSPATH=
set OLDANTHOME=
set TOOLS=