Skip to content

Commit 4b511ed

Browse files
committed
check Java version and bail out if unsupported
1 parent 1d26fd0 commit 4b511ed

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

build.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ information: Portions Copyright [yyyy] [name of copyright owner]
1818
1919
CDDL HEADER END
2020
21-
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
21+
Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
2222
2323
-->
2424
<project name="OpenGrok" default="jar" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
@@ -153,6 +153,16 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
153153
<pathelement path="${java.class.path}"/>
154154
</path>
155155

156+
<target name="get-java-version">
157+
<condition property="java.version.checked">
158+
<equals arg1="${ant.java.version}" arg2="1.8"/>
159+
</condition>
160+
</target>
161+
162+
<target name="check-java-version" depends="get-java-version" unless="java.version.checked">
163+
<fail message="Unsupported Java version: ${ant.java.version}. Make sure that the Java version is 1.8 or greater."/>
164+
</target>
165+
156166
<target name="-check-jflex" description="Check that jflex jar file is present">
157167
<available file="jflex-${jflex-version}.jar" type="file" property="JFlex.present">
158168
<filepath refid="lib.search.path"/>
@@ -292,9 +302,12 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
292302
</target>
293303

294304
<property name="coverage.dir" value="${basedir}/coverage"/>
295-
<target name="-pre-compile" depends="jrcs,jflex,download-lucene,download-servlet-api"/>
305+
306+
<target name="-pre-compile" depends="check-java-version,jrcs,jflex,download-lucene,download-servlet-api"/>
307+
296308
<target name="eclipse" depends="-pre-compile"
297309
description="satisfy eclipse dependencies"/>
310+
298311
<target name="-post-clean">
299312
<delete dir="${src.generatedsrc.dir}"/>
300313
<delete file="${manifest.file}"/>

0 commit comments

Comments
 (0)