I just released a new version of my Open Source Build Automation Framework “FAKE – F# Make”. You can read more about FAKE on the project website or in the Getting started with "FAKE – F# Make"-article.
Although the new release contains many bugfixes, I only want to show the two major improvements here.
1. FAKE 0.10 uses FSI instead of FSC
From now on FAKE uses the “F# Interactive” (fsi.exe) instead of the F# Compiler (fsc.exe) to run the build scripts, which brings two major improvements.
No TempPath for compiled binaries needed
Due to the fact that FAKE scripts are no longer compiled at the beginning of the build process, we don’t need a temporary folder for the created binaries.
Loading modules at runtime
The #load command in F# scripts allows us to load modules at runtime. Now we are able to put reusable Targets or TargetTemplates (see below) into external build script files.
2. TargetTemplates
TargetTemplates provide an easy way to reuse common Targets. Let’s consider a (very) small sample:
Target "TraceHello" (fun () ->
trace "Hello World from FAKE"
)
This Target “TraceHello” traces a “Hello World” string into our build log. Now we want it to be slightly more generic and to trace a custom string. We can do this by using a TargetTemplate:
/// createTraceTarget: string -> string -> Target
let createTraceTarget = TargetTemplate (fun s ->
trace s
)
Now we have a template (or a function which generates targets) that gets a string for the target name and a string for the trace text and generates a usable target:
createTraceTarget "TraceHello" "Hello World from FAKE"
createTraceTarget "Trace2" "Trace another text"
Of course the TargetTemplate function is generic and can be used with any tuple as parameter:
/// createTraceTarget: string -> string*int -> Target
let createTraceTarget = TargetTemplate (fun (s,d) ->
trace s
trace <| sprintf "my int: %d" d
)
createTraceTarget "TraceHello" ("Hello World from FAKE",2)
createTraceTarget "Trace2" ("Trace another text",42)
[…] FAKE – F# Make – Version 0.10 released – FAKE is a ‘make’ like tool which allows you to automate your build process using code written in F#, allowing you the fuill benefit of the .NET Framework and the F# language. This release now uses interpreted F# rather than compiled, and improved Target Templates. […]
Pingback by Reflective Perspective - Chris Alcock » The Morning Brew #449 — Wednesday, 7. October 2009 um 9:34 Uhr