Skip to content

Apache Lucene open-source search software

add check-after-regeneration (big nocommit, to figure out how we want this to work/plugin from jenkins)

Robert Muir676d0993d595
diff --git a/build.xml b/build.xml
index 321926323e4..3407add4601 100644
--- a/build.xml
+++ b/build.xml
@@ -422,8 +422,10 @@
<target name="run-clover"/>
</antcall>
</target>
-
- <target name="regenerate" description="Run all code generators">
+
+ <target name="-regenerate">
+ <!-- nocommit: fix this everywhere else to be -regenerate too?
+ or make regenerate regenerateAndCheck? -->
<subant target="regenerate" inheritall="false" failonerror="false">
<fileset dir="lucene" includes="build.xml" />
<!-- todo:
@@ -431,4 +433,11 @@
</subant>
</target>
+ <target name="-check-after-regeneration">
+ <subant buildpath="." antfile="extra-targets.xml" target="-check-after-regeneration" inheritall="false" failonerror="true"/>
+ </target>
+
+ <target name="regenerate" depends="-regenerate,-check-after-regeneration"
+ description="Run all code generators and verifies everything is in sync"/>
+
</project>
diff --git a/extra-targets.xml b/extra-targets.xml
index bdae77a592c..d030deaa716 100644
--- a/extra-targets.xml
+++ b/extra-targets.xml
@@ -63,15 +63,22 @@
</target>
<target name="-check-svn-working-copy" depends="ivy-availability-check,ivy-fail,ivy-configure,resolve-groovy">
- <svn-checker/>
+ <svn-checker failonmodifications="false"/>
+ </target>
+
+ <!-- should only be called by jenkins, not precommit! -->
+ <target name="-check-after-regeneration" depends="ivy-availability-check,ivy-fail,ivy-configure,resolve-groovy">
+ <svn-checker failonmodifications="true"/>
</target>
<macrodef xmlns:ivy="antlib:org.apache.ivy.ant" name="svn-checker">
+ <attribute name="failonmodifications" default="true"/> <!-- false if file modifications are allowed -->
<sequential>
<ivy:cachepath organisation="org.tmatesoft.svnkit" module="svnkit" revision="1.7.8"
inline="true" conf="default" transitive="true" pathid="svnkit.classpath"/>
<local name="svn.checkprops.failed"/>
<local name="svn.unversioned.failed"/>
+ <local name="svn.changed.failed"/>
<script language="groovy" taskname="svn">
<classpath>
<path refid="groovy.classpath"/>
@@ -90,7 +97,7 @@
file -> file.getAbsolutePath().substring(baseLen + 1).replace(File.separatorChar, (char)'/');
}
- Set missingProps = new TreeSet(), unversioned = new TreeSet();
+ Set missingProps = new TreeSet(), unversioned = new TreeSet(), changed = new TreeSet();
self.log('Getting all versioned and unversioned files...');
statusClient.doStatus(basedir, SVNRevision.WORKING, SVNDepth.fromRecurse(true), false, true, false, false, {
@@ -101,6 +108,10 @@
} else if (status.getKind() == SVNNodeKind.FILE && nodeStatus != SVNStatusType.STATUS_DELETED) {
missingProps.add(convertRelative(status.getFile()));
}
+ if (nodeStatus == SVNStatusType.STATUS_MODIFIED || nodeStatus == SVNStatusType.STATUS_REPLACED ||
+ nodeStatus == SVNStatusType.STATUS_DELETED || nodeStatus == SVNStatusType.STATUS_ADDED) {
+ changed.add(convertRelative(status.getFile()));
+ }
} as ISVNStatusHandler, null);
self.log('Filtering files with existing svn:eol-style...');
@@ -122,11 +133,20 @@
};
project.setProperty('svn.checkprops.failed', convertSet2String(missingProps));
project.setProperty('svn.unversioned.failed', convertSet2String(unversioned));
+ project.setProperty('svn.changed.failed', convertSet2String(changed));
]]></script>
<fail if="svn.checkprops.failed"
message="The following files are missing svn:eol-style (or binary svn:mime-type):${line.separator}${svn.checkprops.failed}"/>
<fail if="svn.unversioned.failed"
message="Source checkout is dirty after running tests!!! Offending files:${line.separator}${svn.unversioned.failed}"/>
+ <fail message="Source checkout is modified !!! Offending files:${line.separator}${svn.changed.failed}">
+ <condition>
+ <and>
+ <istrue value="@{failonmodifications}"/>
+ <isset property="svn.changed.failed"/>
+ </and>
+ </condition>
+ </fail>
</sequential>
</macrodef>
</project>