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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4335@1506316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-07-23 21:59:18 +00:00
parent 04818c95ef
commit 676d0993d5
2 changed files with 33 additions and 4 deletions

View File

@ -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>

View File

@ -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>