Skip to content
Luca Sgroi edited this page Feb 14, 2017 · 9 revisions

All build tools have a common core: they allow you to model a dependency network. The tool will calculate how to reach the goal specified by executing a set of operations in the correct order. Task-oriented build tools describe the dependency network in terms of a set of tasks. Each task has two essential features: the thing it does and the things it depends on. The tasks should be fully automated and easily invoked individually or as combination.

By convention, tasks are defined in .build\tasks strictly with task name matching file name. A task should be explicitly imported prior invocation. Of course a task can be simply defined within the build script itself; in that case there is no need to import it.

Example: The default task depends on the Build and Test tasks, which should be imported; the Deploy task however is defined inline in the build script so there's no need to import it.

Import-Task Build, Test

Task . Build, Test, Deploy

Task Deploy {
    ...
}

Tasks could be defined as well in Pask extensions. Similarly to scripts, tasks are searched and imported sequentially from any Pask.* package installed in the solution, any Pask.* project in the solution and finally the .build\tasks directory. If the same task is defined in different files, it would be overridden by the latter imported.

Example: Import a task explicitly from a Pask extension.

Import-Task CopyModule -Package Pask.Modules