summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap.bat14
-rwxr-xr-xbootstrap.sh19
2 files changed, 29 insertions, 4 deletions
diff --git a/bootstrap.bat b/bootstrap.bat
index 411644412..3d7f39646 100755
--- a/bootstrap.bat
+++ b/bootstrap.bat
@@ -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
diff --git a/bootstrap.sh b/bootstrap.sh
index 2baf08f81..c97abb328 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -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 \