Browse Source

Set the --release version to Java 8, when bootstraping with higher versions of Java

master
Jaikiran Pai 5 years ago
parent
commit
a06e1227a2
2 changed files with 29 additions and 4 deletions
  1. +12
    -2
      bootstrap.bat
  2. +17
    -2
      bootstrap.sh

+ 12
- 2
bootstrap.bat View File

@@ -61,10 +61,20 @@ if not "%OS%" == "Windows_NT" if exist %CLASSDIR%\nul deltree/y %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% EQU 0 SET JAVAC_RELEASE_VERSION="--release 8"
DEL %CLASSDIR%\JavacVersionCheck.java %CLASSDIR%\JavacVersionCheck.class >nul 2>&1
echo.
echo ... Compiling Ant Classes
IF "%JAVAC_RELEASE_VERSION%" == "" (
echo ... Compiling Ant Classes
) ELSE (
echo ... Compiling Ant Classes with %JAVAC_RELEASE_VERSION%
)

"%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
"%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 1 goto mainend



+ 17
- 2
bootstrap.sh View File

@@ -127,9 +127,24 @@ mkdir -p build
mkdir -p ${CLASSDIR}
mkdir -p bin

echo ... Compiling Ant Classes
# Check if javac tool supports the --release param
echo "public class JavacVersionCheck {}" > ${CLASSDIR}/JavacVersionCheck.java
"${JAVAC}" --release 8 -d ${CLASSDIR} ${CLASSDIR}/JavacVersionCheck.java 1>&2 2>/dev/null
ret=$?
rm ${CLASSDIR}/JavacVersionCheck.java ${CLASSDIR}/JavacVersionCheck.class 1>&2 2>/dev/null
JAVAC_RELEASE_VERSION=
if [ $ret -eq 0 ]; then
# set --release to 8
JAVAC_RELEASE_VERSION="--release 8"
fi
if [ "${JAVAC_RELEASE_VERSION}" = "" ]; then
echo ... Compiling Ant Classes
else
echo ... Compiling Ant Classes with ${JAVAC_RELEASE_VERSION}
fi

"${JAVAC}" $BOOTJAVAC_OPTS -d ${CLASSDIR} ${TOOLS}/bzip2/*.java ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \
"${JAVAC}" $BOOTJAVAC_OPTS -d ${CLASSDIR} ${JAVAC_RELEASE_VERSION} \
${TOOLS}/bzip2/*.java ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \
${TOOLS}/ant/util/regexp/RegexpMatcher.java \
${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java \
${TOOLS}/ant/property/*.java \


Loading…
Cancel
Save