module build.core.target

The basic building blocks for a build.

Code Map

//! The basic building blocks for a build.
module build.core.target;


//! Holds all inspected files/targets for a build. The caching supplied by
//! this class helps with both speed and ease of use.
class Instance
{
public:
	this() { }
	fn file(name: string) Target { }
	fn fileNoRule(name: string) Target { }
}

//! Most basic building block, represent a single file on the file system.
//! Can be used as a dependency and as a target to be built.
class Target
{
public:
	enum Status
	{
		FRESH,
		CHECKED,
		BLOCKED,
		BUILDING,
		BUILT,
	}


public:
	alias FRESH = Status.FRESH;
	alias CHECKED = Status.CHECKED;
	alias BLOCKED = Status.BLOCKED;
	alias BUILDING = Status.BUILDING;
	alias BUILT = Status.BUILT;


public:
	//! What is the status of this target.Used to skip updating the date.
	status: Status;
	//! Name, for file also actuall filename.
	name: string;
	//! Rule to build this targe.
	rule: Rule;
	//! Will be built, but if no rule and missing will be ignored.
	deps: Target[];
	//! Cached last modified time.
	mod: u64;


public:
	this() { }
	//! Updates the @mod field to the files last modified time.
	fn updateTime() { }
	fn built() { }
}

//! Rule to be executed. Can be shared for multiple targets.
class Rule
{
public:
	//! To run be executed.
	cmd: string;
	//! To be given to cmd.
	args: string[];
	//! Echoed to stdout.
	print: string;
	//! Files needed directly to run this rule.
	input: Target[];
	//! When the rule is running these targets will be locked.
	outputs: Target[];


public:
	this() { }
	fn built(retval: i32) { }
}
class Instance

Holds all inspected files/targets for a build. The caching supplied by this class helps with both speed and ease of use.

class Target

Most basic building block, represent a single file on the file system. Can be used as a dependency and as a target to be built.

status: Status

What is the status of this target.Used to skip updating the date.

name: string

Name, for file also actuall filename.

rule: Rule

Rule to build this targe.

deps: Target[]

Will be built, but if no rule and missing will be ignored.

mod: u64

Cached last modified time.

fn updateTime()

Updates the @mod field to the files last modified time.

class Rule

Rule to be executed. Can be shared for multiple targets.

cmd: string

To run be executed.

args: string[]

To be given to cmd.

print: string

Echoed to stdout.

input: Target[]

Files needed directly to run this rule.

outputs: Target[]

When the rule is running these targets will be locked.