Building is Important

This may seem like an obvious statement, but I constantly find myself tripping up on cases of “it works on my machine” where that is the only place it works.  So I am working on making things easier to build for everyone, even from a clean clone of the repo building from the command line.

There are 10 different solution files in Couchbase Lite:

.NET 4.5 for Xamarin Studio
.NET 3.5 for Xamarin Studio
iOS for Xamarin Studio
Android for Xamarin Studio
Unity for Xamarin Studio
.NET 4.5 for Visual Studio
.NET 3.5 for Visual Studio
iOS for Visual Studio
Android for Visual Studio
Unity for Visual Studio

I rarely do work in Visual studio because I can build for all platforms on my Macbook.  While I can technically build for all platforms on a Windows machine, iOS is an undesirable hassle.  In fact the Visual Studio projects are pretty out of date for Android, iOS, and Unity (something I will be fixing soon).  Sometimes making changes requires coordinating two machines to make changes on all 10 of these solutions.  It’s very time consuming.  However, we are rapidly approaching the point where .NET will be under continuous integration and so I’ve been tightening up the build process by manually editing a lot of csproj files.

I’m happy to report that now they build from an empty repo clone without opening them in the IDE.  This involves downloading Nuget packages and other orchestration that I didn’t even realize the IDE was taking care of for me.  Our poor build engineer had to put up with these kinds of problems but now hopefully we are on common ground.  I’m anxiously awaiting the CI integration because realistically I can’t build all platforms every time I make a change or nothing would ever get done.  However with the power of CI, I won’t have to and in fact it will be done all in parallel!  So now there are some new configurations in the solution files:

Debug -> Builds the projects for the Nuget packages we currently maintain in Debug mode
Debug_All -> Builds all the projects in the solution file in Debug mode
Debug_Testing -> Builds the unit tests and runners (if applicable) in Debug mode
Debug_Sample -> Builds the sample application for the solution (if any)
Release -> Builds the projects for the Nuget packages in Release mode
Release_All -> Builds all the projects in Release mode
Release_Testing -> Builds the unit tests and runners in Release mode
Release_Sample -> Builds the sample application in Release mode
Packaging -> Builds Release mode, with an additional staging step to prepare for Nuget packaging.  The files needed for the Nuget packages will be written to <root>/staging/<Nuget Name>/<Nuget Target>/

The staging behavior can also be triggered by passing /p:Archive=true when building from the command line.  This sort of standardisation allows the packaging phase to be split into a parallel job along with each platform.  Each platform can build as a different job, and when all the jobs are finished the packaging job can scan them and pick up the staging directory, merge it, and then package using the contained files.  It’s going to be excellent.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s