Should I use cscript, nmake, powershell, BAT, project files, or some combination of these? How could I implement a build solution that didn't just duplicate the same build instructions (source files, references, etc) in 2 different formats: one for windows and one for *nix?
I decided to keep things simple on Windows - just use a VS2005 solution with a bunch of project files. Then for *nix, I decided to make libxslt's xsltproc a build requirement, and generate the list of sources and references for the mono olive make machinery using a few simple XSL stylesheets.
For example, all the .sources files are now generated via build/sources.xsl. Which looks something like this:
<xsl:template match="/">I also have .references files for each assembly, also generated via an XSL file from the .csproj.
<xsl:apply-templates select="Project/ItemGroup/Compile"/>
</xsl:template>
<xsl:template match="Compile">
<xsl:value-of select="@Include" /><xsl:text> </xsl:text>
</xsl:template>
Now, I just maintain the VS2005 project files, and leave the *nix build stuff to the stylesheets. I added support for conditional sources using the Conditional attribute. Its working quite well thus far.
3 comments:
You might also look at prebuild. I think Rob Loach and cj worked on that for a while as a way of taking an XML and generating VS2005, NAnt, MonoDevelop, and a few other project stuff.
http://sourceforge.net/projects/dnpb/
I've put in a bit of changes for playing with NAnt, but just as an option you didn't list.
What's the status of xbuild? It was a Summer of Code project a while back to build a Mono Project implementation of MSBuild that Visual
Studio uses. If it supports your projects you could just add it as a dependency and have it directly build your Visual Studio 2005 project files. I'd certainly like to see more focus on packaging and pushing xbuild as a standard Mono tool because its essential to standardizing build processes across platforms.
Thanks for the link to prebuild - I'll check it out.
I did start out using xbuild, but it was segfaulting on me so I switched to the current XSL-based approach.
It seemed that I'd always have to keep configure && make around anyway, as I didn't want replace my make rpms, make deps, and make dist targets.
Post a Comment