Friday, March 29, 2013

FAKE with NuGet support

UPDATE: the proposal made it into pre-release FAKE, see the more recent article:

Intended F# build workflow: start from an empty folder, write build.fsx, and run fake - and get anything building with software from NuGet.

Draft Implementation  Discussion

As we are using FAKE for scripting builds a little more at IntelliFactory, I could not resist to make a little fork to reduce some of the burden. NuGet quickly is becoming the de-facto package manager for C#/F# assemblies, and we are even considering using a private NuGet feed inside the company for our own projects. It therefore makes sense that the default F# build tool would be intimately aware of and integrated with this package manager.

There are some NuGet tasks in FAKE, this is not what I want. By intimate awareness I mean, for example, the ability easily execute code from the NuGet repository inside your script. Easily - without manually tracking dependencies or figuring out correct reference paths.

In my fork I accomplish this by using NuGet in-process API (NuGet.Core) to do the analysis and generate an F# script file with all required references. Your script executes in two stages - first with the BOOT constant set and minimum references, and then normally. In the BOOT stage you get a chance to do some preparatory work such as fetching dependencies and generating the reference list. And in the second stage you can enjoy working with the dependencies you fetched directly.

An example tells it best - if you run fake with our changes in a folder with this script, you will get a working website automatically:

No comments:

Post a Comment