The good news is that abstracting things in F# and sharing common build logic in a library via NuGet really works well, and feels a lot more natural than MSBuild. Consider this
The FAKE-based build (well, together with some MSBuild boilerplate that I generate) accomplishes quite a few chores:
- Bootstraps
NuGet.exe without any binaries in the source repo - Resolves packages specified in solution
packages.config , including pulling inFAKE and build logic such asIntelliFactory.Build - Determines current Mercurial hash or tag
- Constructs AutoAssemblyInfo.fs with company metadata and mercurial tag
- Constructs MSBuild boilerplate to help projects find NuGet-installed dependencies without specifying the version, for easy dependency version updates
- Builds specified projects in multiple framework configurations
And you can, of course, do more inside the FAKE file.
The bad news is that I expected quite a bit more from FAKE, and I end up fighting it more than using it - note that these can be either legit problems with FAKE or else my limited understanding of it.
Running- UPDATE: when using pre-release alpha version of FAKE, the scripts default to the 4.0 runtime and use FSharp.Core 4.3.0.0 - problem solvedFAKE.exe drops your code into the 2.0 runtime, even if the host process was in 4.0 - not acceptable for me, had to replaceFAKE.exe invocation withFSI.exe invocationFAKE had no easy support for dependency tracking, such as not overwriting a file unless necessary (useful to prevent say the MSBuild it invokes from doing work twice) - had to roll a few or my own helpers- Surprisingly
FAKE MSBuild helpers are calling MSBuild process instead of using the in-process MSBuild API. By using MSBuild API myself, I am able to speed things up a bit. - On a similar note, I toyed with invoking either
FAKE orFsi.exe in a slave AppDomain (should be faster than a separate process, right?) from the host MSBuild process that my build starts with. The approach failed miserably.Fsi.exe is readingSystem.Environment.GetCommandLineArgs() instead of reading theEntryPoint args, so that it does not see the args I pass to the slave AppDomain, but instead sees the args that MSBuild receives. AndFAKE , again, drops me into the 2.0 runtime, probably starting another system process too.
In the end my impression is that there is tremendous value in automating build logic in F# instead of MSBuild. As to
No comments:
Post a Comment