WARNING

Previous versions of FAKE 5 used (fun () -> ...) instead of (fun _ -> ...).
We decided to change the syntax here to introduce some parameters or other features at a later point.
Using the current parameter object is not supported yet.

Target.create"MyTarget"(funp->// Access arguments given by command-lineTrace.tracefn"Arguments: %A"p.Context.Arguments)// Feature is opt-in in order to provide good error messages out of the box// see https://github.com/fsharp/FAKE/issues/1896Target.runOrDefaultWithArguments"Deploy"

Everything after the target will be interpreted as argument for the target:

fake run build.fsx target MyTarget --arg --> --arg will be contained in p.Context.Arguments

fake build -t MyTarget --arg --> --arg will be contained in p.Context.Arguments, because --arg is not a valid argument for the Fake.Core.Target (see command line spec above)

You can access the arguments from every target executed along the way.

Since multithreading is beneficial (especially for large projects) FAKE allows to specify the
number of threads used for traversing the dependency tree.
This option of course only affects independent targets whereas dependent targets will
still be exectued in order.

The number of threads used can be set using the environment variable parallel-jobs or using the --parallel parameter.
This can be achieved in various ways where the easiest one is to use the parameter:

fake run *YourBuildScript* --parallel 8

Note that the dependency tree will be traversed as usual whenever setting parallel-jobs to a value <= 1 or omiting it entirely.

Running targets in parallel is of course only possible when the target-functions themselves are thread-safe.

Parallel execution may also cause races on stdout and build-logs may therefore be quite obfuscated.

Error detection may suffer since it's not possible to determine a first error when targets are running in parallel

Due to these limitations it is recommended to use the standard sequential build whenever checking for errors (CI, etc.)
However when a fast build is desired (and the project is e.g. known to build successfully) the parallel option might be helpful

When using this parallel option, Fake resolves the build dependency hierarchies from the described paths and builds independend paths as parallel if you have multiple CPUs available.
For example this dependency tree: