FAKE - F# Make


TargetHelper

Contains infrastructure code and helper functions for FAKE's target feature.

Nested types and modules

TypeDescription
BuildError

Represents build errors

Target

A Target can be run during the build

ModuleDescription
ExitCode

Functions and values

Function or valueDescription
( <== ) x ys
Signature: x:string -> ys:string list -> unit

Backwards dependencies operator - x is dependent on ys.

ActivateBuildFailureTarget name
Signature: name:string -> unit

Activates the BuildFailureTarget.

ActivateFinalTarget name
Signature: name:string -> unit

Activates the FinalTarget.

addExecutedTarget target time
Signature: target:string -> time:TimeSpan -> unit
BuildFailureTarget name body
Signature: name:string -> body:(unit -> unit) -> unit

Registers a BuildFailureTarget (not activated).

BuildFailureTargets
Signature: Dictionary<string,bool>

BuildFailureTargets - stores build failure targets and if they are activated.

CurrentTarget
Signature: string
CurrentTargetOrder
Signature: string list list
dependencyString target
Signature: target:'?9510 TargetTemplate -> string
Type parameters: '?9510

Returns the DependencyString for the given target.

determineBuildOrder target parallelJobs
Signature: target:string -> parallelJobs:int -> unit TargetTemplate [] list

Determines a parallel build order for the given set of targets

doesTargetMeanListTargets target
Signature: target:string -> bool
DoNothing ()
Signature: unit -> unit

Do nothing - fun () -> () - Can be used to define empty targets.

ExecutedTargets
Signature: HashSet<string>

The executed targets.

FinalTarget name body
Signature: name:string -> body:(unit -> unit) -> unit

Registers a final target (not activated).

FinalTargets
Signature: Dictionary<string,bool>

Final Targets - stores final targets and if they are activated.

getAllTargetsNames ()
Signature: unit -> string list

Returns a list with all target names.

GetErrors ()
Signature: unit -> BuildError list

Get Errors - Returns the errors that occured during execution

getTarget name
Signature: name:string -> unit TargetTemplate

Gets a target with the given name from the target dictionary.

listTargets ()
Signature: unit -> unit

Prints all available targets.

PrintDependencyGraph verbose target
Signature: verbose:bool -> target:string -> unit

Writes a dependency graph.

PrintDotDependencyGraph ()
Signature: unit -> unit

Writes a dependency graph of all targets in the DOT format.

PrintRunningOrder ()
Signature: unit -> unit
PrintTargets ()
Signature: unit -> unit

Prints all targets.

run targetName
Signature: targetName:string -> unit

Runs a target and its dependencies.

runSingleTarget target
Signature: target:unit TargetTemplate -> unit

Runs a single target without its dependencies

runTargets targets
Signature: targets:unit TargetTemplate array -> unit
runTargetsParallel count targets
Signature: count:int -> targets:Target [] -> unit

Runs the given array of targets in parallel using count tasks

softDependencyString target
Signature: target:'?9512 TargetTemplate -> string
Type parameters: '?9512

Returns the soft DependencyString for the given target.

Target name body
Signature: name:string -> body:(unit -> unit) -> unit

Creates a Target.

TargetTemplate body
Signature: body:('?9534 -> unit) -> string -> '?9534 -> unit
Type parameters: '?9534

Creates a TargetTemplate.

TargetTemplateWithDependecies (...)
Signature: dependencies:string list -> ('?9532 -> unit) -> string -> '?9532 -> unit
Type parameters: '?9532
TargetTemplateWithDependencies (...)
Signature: dependencies:string list -> body:('?9530 -> unit) -> name:string -> parameters:'?9530 -> unit
Type parameters: '?9530

Creates a TargetTemplate with dependencies.

Sample

The following sample creates 4 targets using TargetTemplateWithDependencies and hooks them into the build pipeline.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
// Create target creation functions
let createCompileTarget name strategy =
TargetTemplateWithDependencies
    ["Clean"; "ResolveDependencies"] // dependencies to other targets
    (fun targetParameter ->
      tracefn "--- start compile product..."
      if targetParameter = "a" then
        tracefn "    ---- Strategy A"
      else
        tracefn "    ---- Strategy B"
      tracefn "--- finish compile product ..."
    ) name strategy

let createTestTarget name dependencies filePattern =
  TargetTemplateWithDependencies
    dependencies
    (fun filePattern ->
      tracefn "--- start compile tests ..."
      !! filePattern
      |> RunTests
      tracefn "--- finish compile tests ...")
    name filePattern

// create some targets
createCompileTarget "C1" "a"
createCompileTarget "C2" "b"

createTestTarget "T1" ["C1"] "**/C1/*.*"
createTestTarget "T2" ["C1"; "C2"] "**/C?/*.*"

// hook targets to normal build pipeline
"T1" ==> "T2" ==> "Test"
val createCompileTarget : name:'a -> strategy:'b -> obj

Full name: docs.createCompileTarget
val name : 'a
val strategy : 'a
val createTestTarget : ('a -> 'b -> 'c -> 'd)
val dependencies : 'a
val filePattern : 'a
WriteErrors ()
Signature: unit -> unit

Writes a summary of errors reported during build.

WriteTaskTimeSummary total
Signature: total:'?9561 -> unit
Type parameters: '?9561

Writes a build time report.

Fork me on GitHub