Apache Lucene open-source search software
LUCENE-6995, LUCENE-6938: Add branch change trigger to common-build.xml to keep sane build on GIT branch change
Uwe Schindler424a647af4d0
diff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex 92625896fa7..145f8d2e934 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -278,6 +278,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"@@ -380,9 +381,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