Skip to content

haxed has tasks

February 8, 2010

haxed, the new name for haxelib, now allows library defined tasks.

This is something that I do already in a non-haxed way and find it
very useful e.g. in the HxpFile (the Tasks class is arbitrary)


task:
name: thing
params: x=0
y=”woot”
z=”nice”
main-class: Tasks
class-path: /home/blackdog/Projects/haxed/src

the definition of the Tasks class looks like this

import haxed.Tasks;

class Tasks extends haxed.TaskRunner {

public static function
main() {
var tasks = new Tasks();
trace(tasks.run());
}

public function
woot() {
trace(“woot “);
}

public function thing(x,p2,p3) {
trace(“first:”+x);
return p2 + p3;
}

}

and can be called from the command line like

haxed task HxpFile thing

Param:x (0) :
Param:y (“woot”) :
Param:z (“nice”) :
Building all

Os.hx:326: Compiling [haxe, -main, Tasks,
-cp, /home/blackdog/Projects/haxed/src, -neko, .haxed.n]
Os.hx:326: Executing [neko, .haxed.n, thing, 0, “woot”, “nice”]
Tasks.hx:66: Tasks.hx:18:
first:0
“woot””nice”

as you can see it builds the tasks file like a script then passes either
the default params from the .haxed file or user overrides from the
command line.

This provides a means of libraries to provide task extensions for
themselves on the command line.

I have still to do, build section additions for preTask: postTask: and
in my current haxe build system i have dependencies which I may try to
add if it doesn’t get too complicated.

bd

Advertisements

From → haxe

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: