On Sun, Dec 19, 2010 at 11:15 AM, silky <[email protected]> wrote:
> Does anyone have any beautiful schemes for this?
>
> I've done a basic implementation in a current project, whereby the
> version is in the form of:
>
>  major.minor.build.revision
>
> With the build and revision components being created in NAnt as part
> of the Hudson build process. This is then written into[1] the
> AssemblyInfo.cs file.  But it occurred to me that it could be quite
> amazing indeed if the major/minor components could also be increased
> automatically, via integration with the bug tracker (which in my case,
> as you all know, is trac). It would be amazingly magnificent because
> you could mark any items that are a public bugfix, as incrementing
> minor, and any breaking changes as major. You could categorise them
> via trac and then have a process to auto-increment (i.e. perhaps there
> is a custom trac plugin that writes some meta-data to the hudson
> settings, or some similar strategy; publishing to hudson can read).

FWIW, this turned out to be reasonably easy. I decided on the
following strategy:

 1. In the build script, if I could get a count of the current closed
tickets of some variety, that would be enough to adjust the
minor/major number, so, I...
 2. Installed this plugin from trac:
http://trac-hacks.org/wiki/XmlRpcPlugin#Installation
 3. Wrote this (to test if it works):

    public interface Trac : IXmlRpcProxy
    {
        [XmlRpcMethod("ticket.query")]
                int[] ticketQuery(string qstr);
    }

        class Program
        {
                static void Main(string [] args)
                {
                   Trac proxy;
                   proxy = XmlRpcProxyGen.Create<Trac>();

                   proxy.Url = "your trac location/rpc";

                        int[] result = 
proxy.ticketQuery("status=closed&max=0&type=defect");

                        if( result.Length > 0 ){
                                foreach(int s in result){
                                        Console.WriteLine(s);
                                }
                        } else {
                                Console.WriteLine("No results.");
                        }

                        Console.Read();
                }
        }

 Using this: http://xml-rpc.net/

 4. Implemented it as a callable function from NAnt.
 5. Benefited from the brilliance.

 I mean, it's pretty awesome. The only issue is that there doesn't
seem to be a rpc function to get strictly a count, but perhaps I've
missed the option, or someone will write it. If anyone is interested
I'll probably write this up somewhere so that you can get an idea of
the whole setup (i.e. the NAnt build script).

 Still interested to know if someone has some better schemes.

-- 
silky

http://dnoondt.wordpress.com/  (Noon Silk) | http://www.mirios.com.au:8081 >

"Every morning when I wake up, I experience an exquisite joy — the joy
of being this signature."

Reply via email to