capri, a script language

Home | Documentation | Releases | Sources | Contact

Projects, tasks & dependencies

A project is a namespace to group functions. A task is the same as a function (you can also use the "function" keyword instead) and can have parameters, dependencies and a statement.

Here is a simple example of the tasks you have in a common software project:

project MyProject {

  task clean {}

  task compile depends clean {}
		
  task link depends compile {}
  
}

When you execute one of these tasks, all dependencies of the task are executed first. This allows you to clearly specify what has to be done before another task can do its work.

To have a more convenient way of doing a specific set of tasks, you can define tasks that execute other tasks in a specific order, as you can see in the following example:

project MyProject {

  task all depends compile, link;

  task compile {}
		
  task link {}
  
  task clean {}
  
}

This script can simply be executed on the command-line with "capri all". As you can see, it is not necessary to have a statement on your task. All dependencies will still be called.