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

This commit is contained in:
Uwe Schindler 2016-01-26 22:06:35 +01:00
parent bc815b5207
commit 424a647af4
1 changed files with 34 additions and 1 deletions

View File

@ -278,6 +278,7 @@
<propertyref regex=".*\.loaded$$"/> <propertyref regex=".*\.loaded$$"/>
<propertyref name="lucene.javadoc.url"/><!-- for Solr --> <propertyref name="lucene.javadoc.url"/><!-- for Solr -->
<propertyref name="tests.totals.tmpfile" /> <propertyref name="tests.totals.tmpfile" />
<propertyref name="git-autoclean.disabled"/>
</propertyset> </propertyset>
<patternset id="lucene.local.src.package.patterns" <patternset id="lucene.local.src.package.patterns"
@ -380,9 +381,41 @@
<delete file="velocity.log"/> <delete file="velocity.log"/>
</target> </target>
<target name="init" depends="resolve"> <target name="init" depends="git-autoclean,resolve">
<!-- currently empty --> <!-- currently empty -->
</target> </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"> <target name="ivy-configure">
<!-- [DW] ivy loses its configuration for some reason. cannot explain this. if <!-- [DW] ivy loses its configuration for some reason. cannot explain this. if