Skip to content

Commit 5c89d9e

Browse files
matahajaikiran
authored andcommitted
Fix --release param check in bootstrap.bat
The following check will always fail silently due to batch `echo` always taking strings literally - including double quotes: echo "public class JavacVersionCheck {}" >%CLASSDIR%\JavacVersionCheck.java "%JAVAC%" --release 8 -d %CLASSDIR% %CLASSDIR%\JavacVersionCheck.java >nul 2>&1 With the following error message: JavacVersionCheck.java:1: error: class, interface, or enum expected "public class JavacVersionCheck {}" ^ 1 error Even with that fixed, the next statement will crash and burn on systems that do not have Command Extensions enabled (e.g. invoked with `cmd /y`): IF %ERRORLEVEL% EQU 0 SET JAVAC_RELEASE_VERSION="--release 8" With the following error message: EQU was unexpected at this time. In order to accommodate that, those checks have been corrected. Signed-off-by: Mateusz Kazimierczuk <[email protected]> This closes apache#205 pull request at github.com/apache/ant
1 parent bcff8d9 commit 5c89d9e

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ Martin Landers
278278
Martin Poeschl
279279
Martin van den Bemt
280280
Martin von Gagern
281+
Mateusz Kazimierczuk
281282
Mathieu Champlon
282283
Mathieu Peltier
283284
Matt Albrecht

WHATSNEW

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Fixed bugs:
1616
could result in an unexpected failure. This has now been fixed.
1717
Bugzilla Report 67417
1818

19+
* Fixes an issue in bootstrap.bat when trying to detect if the "javac"
20+
command in the JDK supports the "--release" option.
21+
Github Pull Request #205
22+
1923

2024
Changes from Ant 1.10.13 TO Ant 1.10.14
2125
=======================================

bootstrap.bat

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,24 @@ if not exist build\nul mkdir build
6060
if not exist build\classes\nul mkdir build\classes
6161

6262
rem Check if javac tool supports the --release param
63-
SET JAVAC_RELEASE_VERSION=""
64-
echo "public class JavacVersionCheck {}" > %CLASSDIR%\JavacVersionCheck.java
63+
SET JAVAC_RELEASE_VERSION=
64+
echo public class JavacVersionCheck {} >%CLASSDIR%\JavacVersionCheck.java
6565
"%JAVAC%" --release 8 -d %CLASSDIR% %CLASSDIR%\JavacVersionCheck.java >nul 2>&1
66-
IF %ERRORLEVEL% EQU 0 SET JAVAC_RELEASE_VERSION="--release 8"
66+
IF ERRORLEVEL 0 IF NOT ERRORLEVEL 1 SET JAVAC_RELEASE_VERSION=--release 8
6767
DEL %CLASSDIR%\JavacVersionCheck.java %CLASSDIR%\JavacVersionCheck.class >nul 2>&1
6868
echo.
69-
IF %JAVAC_RELEASE_VERSION% == "" (
69+
IF "%JAVAC_RELEASE_VERSION%" == "" (
7070
echo ... Compiling Ant Classes
7171
"%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
7272
) ELSE (
73-
echo ... Compiling Ant Classes with %JAVAC_RELEASE_VERSION%
73+
echo ... Compiling Ant Classes with "%JAVAC_RELEASE_VERSION%"
7474
"%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
7575
)
7676

77-
if ERRORLEVEL 1 goto mainend
77+
IF ERRORLEVEL 0 IF NOT ERRORLEVEL 1 goto build
78+
goto mainEnd
79+
80+
:build
7881

7982
echo.
8083
echo ... Copying Required Files

contributors.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,10 @@
11551155
<first>Martin</first>
11561156
<last>von Gagern</last>
11571157
</name>
1158+
<name>
1159+
<first>Mateusz</first>
1160+
<last>Kazimierczuk</last>
1161+
</name>
11581162
<name>
11591163
<first>Mathieu</first>
11601164
<last>Champlon</last>

0 commit comments

Comments
 (0)