Note: This API documentation is for FAKE version 4. The migration API documentation can be found here. The API documentation for the new fake 5 modules can be found here

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:'?10500 TargetTemplate -> string
Type parameters: '?10500

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:'?10502 TargetTemplate -> string
Type parameters: '?10502

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:('?10524 -> unit) -> string -> '?10524 -> unit
Type parameters: '?10524

Creates a TargetTemplate.

TargetTemplateWithDependecies(...)
Signature: dependencies:string list -> ('?10522 -> unit) -> string -> '?10522 -> unit
Type parameters: '?10522 Attributes:
[<Obsolete("Use TargetTemplateWithDependencies")>]
OBSOLETE

Use TargetTemplateWithDependencies

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

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
val name : 'a
val strategy : 'b
val createTestTarget : ('c -> 'd -> 'e -> 'f)
val name : 'c
val dependencies : 'd
val filePattern : 'e
WriteErrors()
Signature: unit -> unit

Writes a summary of errors reported during build.

WriteTaskTimeSummary(total)
Signature: total:'?10551 -> unit
Type parameters: '?10551

Writes a build time report.