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 10:03:45 UTC
[lucene] 08/18: LUCENE-6995,
LUCENE-6938: Add branch change trigger to common-build.xml to keep
sane build on GIT branch change
This is an automated email from the ASF dual-hosted git repository.
dweiss pushed a commit to branch branch_5_4
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit b0e769c3ec598dd7398cc8df123bc4c41069e2c3
Author: Uwe Schindler <us...@apache.org>
AuthorDate: Tue Jan 26 22:06:35 2016 +0100
LUCENE-6995, LUCENE-6938: Add branch change trigger to common-build.xml to keep sane build on GIT branch change
---
lucene/common-build.xml | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
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