You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/03/10 09:57:49 UTC

[lucene] 03/03: LUCENE-6144: Upgrade Ivy to 2.4.0; 'ant ivy-bootstrap' now removes old Ivy jars in ~/.ant/lib/.

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch branch_5_5
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit a5069445d166c8862c7656129f58bf577ac25fb1
Author: Steve Rowe <sa...@apache.org>
AuthorDate: Thu Nov 2 17:00:43 2017 -0400

    LUCENE-6144: Upgrade Ivy to 2.4.0; 'ant ivy-bootstrap' now removes old Ivy jars in ~/.ant/lib/.
---
 lucene/CHANGES.txt                 |  6 ++++-
 lucene/common-build.xml            | 48 ++++++++++++++++++++++++++++++++------
 lucene/ivy-versions.properties     |  2 +-
 lucene/licenses/ivy-2.3.0.jar.sha1 |  1 -
 lucene/licenses/ivy-2.4.0.jar.sha1 |  1 +
 5 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index bf63e8f..b605d7e 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -4,7 +4,11 @@ For more information on past and future Lucene versions, please see:
 http://s.apache.org/luceneversions
 
 ======================= Lucene 5.5.6 =======================
-(No Changes)
+
+Build
+
+* LUCENE-6144: Upgrade Ivy to 2.4.0; 'ant ivy-bootstrap' now removes old Ivy
+  jars in ~/.ant/lib/.  (Shawn Heisey, Steve Rowe)
 
 ======================= Lucene 5.5.5 =======================
 
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index a07a1e2..311ba18 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -79,13 +79,15 @@
   <!-- 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.4.0" /> <!-- UPGRADE NOTE: update disallowed_ivy_jars_regex below -->
+  <property name="disallowed_ivy_jars_regex" value="ivy-2\.[0123].*\.jar"/>
+
   <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 -->
   <property name="ivy.sync" value="true"/>
   <property name="ivy.resolution-cache.dir" location="${common.build.dir}/ivy-resolution-cache"/>
-  <property name="ivy.lock-strategy" value="artifact-lock"/>
+  <property name="ivy.lock-strategy" value="artifact-lock-nio"/>
 
   <property name="local.caches" location="${common.dir}/../.caches" />
   <property name="tests.cachedir"  location="${local.caches}/test-stats" />
@@ -458,15 +460,38 @@
   <property name="ivy_bootstrap_url1" value="http://repo1.maven.org/maven2"/>
   <!-- you might need to tweak this from china so it works -->
   <property name="ivy_bootstrap_url2" value="http://uk.maven.org/maven2"/>
-  <property name="ivy_checksum_sha1" value="c5ebf1c253ad4959a29f4acfe696ee48cdd9f473"/>
+  <property name="ivy_checksum_sha1" value="5abe4c24bbe992a9ac07ca563d5bd3e8d569e9ed"/>
 
   <target name="ivy-availability-check" unless="ivy.available">
+    <path id="disallowed.ivy.jars">
+      <fileset dir="${ivy_install_path}">
+        <filename regex="${disallowed_ivy_jars_regex}"/>
+      </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.
@@ -504,19 +529,20 @@
     <fail>Ivy is not available</fail>
   </target>
 
-  <target name="ivy-bootstrap" description="Download and install Ivy in the users ant lib dir" depends="ivy-bootstrap1,ivy-bootstrap2,ivy-checksum"/>
+  <target name="ivy-bootstrap" description="Download and install Ivy in the users ant lib dir" 
+          depends="-ivy-bootstrap1,-ivy-bootstrap2,-ivy-checksum,-ivy-remove-old-versions"/>
 
   <!-- try to download from repo1.maven.org -->
-  <target name="ivy-bootstrap1">
+  <target name="-ivy-bootstrap1">
     <ivy-download src="${ivy_bootstrap_url1}" dest="${ivy_install_path}"/>
     <available file="${ivy_install_path}/ivy-${ivy.bootstrap.version}.jar" property="ivy.bootstrap1.success" />
   </target> 
 
-  <target name="ivy-bootstrap2" unless="ivy.bootstrap1.success">
+  <target name="-ivy-bootstrap2" unless="ivy.bootstrap1.success">
     <ivy-download src="${ivy_bootstrap_url2}" dest="${ivy_install_path}"/>
   </target>
 
-  <target name="ivy-checksum">
+  <target name="-ivy-checksum">
     <checksum file="${ivy_install_path}/ivy-${ivy.bootstrap.version}.jar"
               property="${ivy_checksum_sha1}"
               algorithm="SHA"
@@ -527,6 +553,14 @@
       </condition>
     </fail>
   </target>
+  
+  <target name="-ivy-remove-old-versions">
+    <delete verbose="true" failonerror="true">
+      <fileset dir="${ivy_install_path}">
+        <filename regex="${disallowed_ivy_jars_regex}"/>
+      </fileset>
+    </delete>
+  </target>
    
   <macrodef name="ivy-download">
       <attribute name="src"/>
diff --git a/lucene/ivy-versions.properties b/lucene/ivy-versions.properties
index 17dba82..4aed697 100644
--- a/lucene/ivy-versions.properties
+++ b/lucene/ivy-versions.properties
@@ -160,7 +160,7 @@ org.apache.hadoop.version = 2.6.0
 /org.apache.httpcomponents/httpcore = 4.4.1
 /org.apache.httpcomponents/httpmime = 4.4.1
 
-/org.apache.ivy/ivy = 2.3.0
+/org.apache.ivy/ivy = 2.4.0
 
 org.apache.james.apache.mime4j.version = 0.7.2
 /org.apache.james/apache-mime4j-core = ${org.apache.james.apache.mime4j.version}
diff --git a/lucene/licenses/ivy-2.3.0.jar.sha1 b/lucene/licenses/ivy-2.3.0.jar.sha1
deleted file mode 100644
index f4b036f..0000000
--- a/lucene/licenses/ivy-2.3.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-c5ebf1c253ad4959a29f4acfe696ee48cdd9f473
diff --git a/lucene/licenses/ivy-2.4.0.jar.sha1 b/lucene/licenses/ivy-2.4.0.jar.sha1
new file mode 100644
index 0000000..3863b25
--- /dev/null
+++ b/lucene/licenses/ivy-2.4.0.jar.sha1
@@ -0,0 +1 @@
+5abe4c24bbe992a9ac07ca563d5bd3e8d569e9ed