The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

ppbuild - Perl Project Build System

DESCRIPTION

Replacement for make on large perl projects. Similar to rake in concept, but no need to install and learn Ruby. The goal is to have a similar sytax to make when defining tasks (or rules in make), while bringing in the power of being able to write your rules in perl.

Some tasks are just simpler to write as shell commands. Doing this in ppbuild is just as easy as in make. In fact, shell tasks are easier since there is no need to put a tab before each command. As well all the commands in the rule run in the same shell session.

SYNOPSIS

Makefile.ppb:

    use ppbuild; #This is required.

    Describe "MyTask", "Completes the first task";
    Task "MyTask", "Dependency Task 1", "Dep Task 2", ..., sub {
        ... Perl code to Complete the task ...
    }

    Describe "MyTask2", "Completes MyTask2";
    Task "MyTask2", qw/ MyTask /, <<EOT;
        echo "Task: MyTask2"
        ... Other shell commands ...
    EOT

    Task "MyTask3", qw/ MyTask MyTask2 / , "Shell commands";

    Describe "MyFile", "Creates file 'MyFile'";
    File "MyFile, qw/ MyTask /, "touch MyFile";

    Describe "MyGroup", "Runs all the tasks";
    Group "MyGroup", qw/ MyTask MyTask2 MyTask3 MyFile /;

To use it: $ ppbuild MyTask

    $ ppbuild MyGroup

    $ ppbuild --file Makefile.ppb --tasks
    Tasks:
     MyTask  - Completes the first task
     MyTask2 - Completes MyTask2
     ...

    $ ppbuild MyTask2 MyFile

    $ ppbuild ..tasks to run..

HOW IT WORKS

The ppbuild script uses a .ppb file to build a project. This is similar to make and Makefiles. .ppb files are pure perl files. To define a task use the Task, Group, or File functions. Give a task a desription using the Describe function.

The first argument to any Task creation function is the name of the task. The last argument is usually the code to run. All arguments in the middle should be names of tasks that need to run first. The code argument can be a string, or a perl sub. If the code is a sub it will be run when the task is run. If the code is a string it will be passed to the shell using system().

The ppbuild script automatically adds ppbuild to the library search path. If you wish to write build system specific support files you can place them in a ppbuild directory and not need to manually call perl -I ppbuild, or add use lib 'ppbuild' yourself in your .ppb file. As well if you will be sharing the codebase with others, and do not want to add ppbuild as a requirement you can copy ppbuild.pm into the ppbuild directory in the project.

FUNCTIONS

Describe()

Used to add or retrieve a task description.

    Describe( 'MyTask', 'Description' );
    Describe 'MyTask', "Description";
    my $description = Describe( 'MyTask' );

Exported by default.

Task()

Defines a task.

    Task 'MyTask1', qw/ Dependancy /, "Shell Code";
    Task 'MyTask2', sub { ..Perl Code... };
    Task 'MyTask3', <<EOT;
    ...Lots of shell commands...
    EOT

Exported by default.

File()

Specifies a file to be created. Will not run if file already exists. Syntax is identical to Task().

Exported by default.

Group()

Group together several tasks as one new task. Tasks will run in specified order. Syntax is identical to Task() except it *DOES NOT* take code as the last argument.

Exported by default.

RunTask()

Run the specified task.

First argument is the task to run. If the Second argument is true the task will be forced to run even if it has been run already.

Not exported by default.

TaskList()

Returns a list of task names. Return is an array, not an arrayref.

    my @tasks = TaskList();
    my ( $task1, $task2 ) = TaskList();

AUTHOR

Chad Granum <exodist7@gmail.com>

COPYRIGHT

Copyright 2008 Chad Granum

You should have received a copy of the GNU General Public License along with this. If not, see <http://www.gnu.org/licenses/>.