You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by nk...@apache.org on 2016/02/09 00:07:48 UTC

[7/7] lucene-solr git commit: LUCENE-6995, LUCENE-6938: Add branch change trigger to common-build.xml to keep sane build on GIT branch change

LUCENE-6995, LUCENE-6938: Add branch change trigger to common-build.xml to keep sane build on GIT branch change


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b0e769c3
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b0e769c3
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b0e769c3

Branch: refs/heads/branch_5_4
Commit: b0e769c3ec598dd7398cc8df123bc4c41069e2c3
Parents: 0d53dce
Author: Uwe Schindler <us...@apache.org>
Authored: Tue Jan 26 22:06:35 2016 +0100
Committer: nknize <nk...@apache.org>
Committed: Mon Feb 8 17:04:43 2016 -0600

----------------------------------------------------------------------
 lucene/common-build.xml | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b0e769c3/lucene/common-build.xml
----------------------------------------------------------------------
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 890a50b..065e57f 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -288,6 +288,7 @@
     <propertyref regex=".*\.loaded$$"/>
     <propertyref name="lucene.javadoc.url"/><!-- for Solr -->
     <propertyref name="tests.totals.tmpfile" />
+    <propertyref name="git-autoclean.disabled"/>
   </propertyset>
 
   <patternset id="lucene.local.src.package.patterns"
@@ -403,9 +404,41 @@
     <delete file="velocity.log"/>
   </target>
 
-  <target name="init" depends="resolve">
+  <target name="init" depends="git-autoclean,resolve">
     <!-- currently empty -->
   </target>
+  
+  <!-- Keep track of GIT branch and do "ant clean" on root folder when changed, to prevent bad builds... -->
+  
+  <property name="gitHeadFile" location="${common.dir}/../.git/HEAD"/>
+  <property name="gitHeadLocal" location="${common.dir}/build/git-HEAD"/>
+  <available file="${gitHeadFile}" property="isGitCheckout"/>
+
+  <target name="git-autoclean" depends="-check-git-state,-git-cleanroot,-copy-git-state"/>
+  
+  <target name="-check-git-state" if="isGitCheckout" unless="git-autoclean.disabled">
+    <condition property="gitHeadChanged">
+      <and>
+        <available file="${gitHeadLocal}"/>
+        <not><filesmatch file1="${gitHeadFile}" file2="${gitHeadLocal}"/></not>
+      </and>
+    </condition>
+  </target>
+
+  <target name="-git-cleanroot" depends="-check-git-state" if="gitHeadChanged" unless="git-autoclean.disabled">
+    <echo message="Git branch changed, cleaning up for sane build..."/>
+    <ant dir="${common.dir}/.." target="clean" inheritall="false">
+      <propertyset refid="uptodate.and.compiled.properties"/>
+    </ant>
+  </target>
+  
+  <target name="-copy-git-state" if="isGitCheckout" unless="git-autoclean.disabled">
+    <mkdir dir="${common.dir}/build"/>
+    <copy file="${gitHeadFile}" tofile="${gitHeadLocal}"/>
+    <property name="git-autoclean.disabled" value="true"/>
+  </target>
+
+  <!-- IVY stuff -->
 
   <target name="ivy-configure">
      <!-- [DW] ivy loses its configuration for some reason. cannot explain this. if