Guy Harris wrote:
> Gerald, can SVN be set up to run source files (.c, .h, etc.) through
> the API filter at checkin time, rejecting them if they get errors?
Joerg asked about this recently. Subversion lets you run "hook scripts"
at various points in the commit process:
http://svnbook.red-bean.com/en/1.2/svn.reposadmin.create.html#svn.reposadmin.create.hooks
The Wireshark SVN repository has a post-commit hook that triggers the
buildbots, sends out a commit message, and triggers a sync between the
read-write repository and the read-only (anonsvn) repository.
It looks like API checking should happen during the pre-commit phase.
The script itself is just handed a repository path and a revision
number. It has to fetch the contents of the file itself. There's a
contributed utility called "Enforcer" that will do this, which we could
then presumably hand off to checkAPIs.pl:
http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/enforcer/
The problem is that checkAPIs is run with a number of different options
depending on the file we're checking. E.g. most dissectors are checked
with "-g abort -g termoutput" while the gtk code is checked with no
arguments at all. We'd have to figure out which arguments to use based
on the file path or its contents.
checkAPIs.pl will be run outside the SVN tree, so we'd have to keep it
up to date. This _shouldn't_ be a problem since it doesn't change that
often.