my tech blog

To iterate is human, to recurse divine

FAKE - F# Make

I have inherited a legacy system written in C++ and Visual Basic 6.0 at work. This system is heavily based on COM and COM+ and have around 40 components and several dependencies on 3:rd part libs. This project is a nightmare to build and deploy at the moment. So how could I make my work easier and more fun when working with this project?

To automate the build process felt definitely as the best way to start to tackle this problem.

I had recently used FAKE, a DSL tool written in F# for creating make script, for another project and it was really neat to work with. The first natural step for me was then of course to apply FAKE on this legacy system also.

As a proof of concept I started out with the VB components. To do this I had to add support for compiling a Visual Basic 6 project. Fortunately FAKE have some helper functions to make it easy to execute an arbitrary process from the build script, in this case VB6.exe. The following snippet is what I started out with:

I believe that the code should be pretty much self describing.

The function will accept a string containing the path to the build folder and a string List containing the path to each project that shall be compiled. This is a simple first step were the list has the projects ordered (hard coded as it is now) based on their dependencies between each other.

As a proof of concept this script is working fine, however there are some more utilities that would be good to have when building the solution:

  • a function that figure out the dependencies order between the projects involved in the solution
  • TFS integration
  • a function for changing the version number in each vbp-file

These tasks will be fun to implement, specially when I get to do some coding in F#.

The process of building this script and go through each part of the legacy system has been a great experience and has given me a lot more knowledge about the system and its building blocks. And it’s a pleasure to use FAKE.

Comments