LUCENE-4960: Fail the build in the presence of Ivy jar(s) with unsupported versions.

This commit is contained in:
Steve Rowe 2017-08-28 11:41:49 -04:00
parent d86bc63e70
commit f5c2e10222
1 changed files with 24 additions and 1 deletions

View File

@ -80,7 +80,7 @@
<!-- Needed in case a module needs the original build, also for compile-tools to be called from a module -->
<property name="common.build.dir" location="${common.dir}/build"/>
<property name="ivy.bootstrap.version" value="2.3.0" />
<property name="ivy.bootstrap.version" value="2.3.0" /> <!-- UPGRADE NOTE: update disallowed.ivy.jars regex in ivy-availability-check -->
<property name="ivy.default.configuration" value="*"/>
<!-- Running ant targets in parralel may require this set to false because ivy:retrieve tasks may race with resolve -->
@ -416,12 +416,35 @@
<property name="ivy_checksum_sha1" value="c5ebf1c253ad4959a29f4acfe696ee48cdd9f473"/>
<target name="ivy-availability-check" unless="ivy.available">
<path id="disallowed.ivy.jars">
<fileset dir="${ivy_install_path}">
<filename regex="ivy-2\.[012].*\.jar"/> <!-- TODO: Update this regex to disallow Ivy versions -->
</fileset>
</path>
<loadresource property="disallowed.ivy.jars.list">
<string value="${toString:disallowed.ivy.jars}"/>
<filterchain><tokenfilter><replacestring from="jar:" to="jar, "/></tokenfilter></filterchain>
</loadresource>
<condition property="disallowed.ivy.jar.found">
<resourcecount when="greater" count="0">
<path refid="disallowed.ivy.jars"/>
</resourcecount>
</condition>
<antcall target="-ivy-fail-disallowed-ivy-version"/>
<condition property="ivy.available">
<typefound uri="antlib:org.apache.ivy.ant" name="configure" />
</condition>
<antcall target="ivy-fail" />
</target>
<target name="-ivy-fail-disallowed-ivy-version" if="disallowed.ivy.jar.found">
<sequential>
<echo message="Please delete the following disallowed Ivy jar(s): ${disallowed.ivy.jars.list}"/>
<fail>Found disallowed Ivy jar(s): ${disallowed.ivy.jars.list}</fail>
</sequential>
</target>
<target name="ivy-fail" unless="ivy.available">
<echo>
This build requires Ivy and Ivy could not be found in your ant classpath.