module battery.commonInterfaces

Main interfaces for code of battery.

Code Map

//! Main interfaces for code of battery.
module battery.commonInterfaces;

public import battery.defines;


//! A single project can either be a Lib or Exe.
class Project
{
public:
	name: string;
	batteryToml: string;
	libs: string[];
	libPaths: string[];
	frameworks: string[];
	frameworkPaths: string[];
	deps: string[];
	defs: string[];
	stringPaths: string[];
	xld: string[];
	xcc: string[];
	xlink: string[];
	xlinker: string[];
	srcDir: string;
	srcC: string[];
	srcS: string[];
	srcObj: string[];
	srcAsm: string[];
	testFiles: string[];
	//! Was this target given a -jo argument.
	jsonOutput: string;
	//! Should we ignore this project unless explicitly asked for
	isExternal: bool;
	//! For D projects.
	scanForD: bool;
	//! Hack to add LLVMVersionX versions.
	llvmHack: bool;
	warningsEnabled: bool;


public:
	this() { }
}

//! The project is built as a library used by executables.
class Lib : Project
{
public:
	isTheRT: bool;


public:
	this() { }
}

//! The project is built as a executable.
class Exe : Project
{
public:
	bin: string;
	srcVolt: string[];


public:
	this() { }
}

//! Interface to the main class that controles the entire process.
class Driver
{
public:
	//! Helper alias
	alias Fmt = watt.text.sink.SinkArg;


public:
	arch: Arch;
	platform: Platform;


public:
	this() { }
	//! Normalise a path, target must exsist.
	fn normalisePath(path: string) string;
	//! As the function name imples.
	fn removeWorkingDirectoryPrefix(path: string) string;
	//! Add a executable
	fn add(exe: Exe);
	//! Add a library
	fn add(lib: Lib);
	//! Add a enviromental variable.
	fn addEnv(boot: bool, name: string, value: string);
	//! Set a tool that has been found.
	fn setCmd(boot: bool, name: string, c: Command);
	//! Get a tool.
	fn getCmd(boot: bool, name: string) Command;
	//! Add a tool, will reset the tool if already given.
	fn addCmd(boot: bool, name: string, cmd: string);
	//! Add a argument for tool.
	fn addCmdArg(boot: bool, name: string, arg: string);
	//! Prints a action string.
	fn action(fmt: scope (Fmt));
	//! Prints a info string.
	fn info(fmt: scope (Fmt));
	//! Error encoutered, print error then abort operation.
	fn abort(fmt: scope (Fmt));
}
class Project

A single project can either be a Lib or Exe.

jsonOutput: string

Was this target given a -jo argument.

isExternal: bool

Should we ignore this project unless explicitly asked for

scanForD: bool

For D projects.

llvmHack: bool

Hack to add LLVMVersionX versions.

class Lib : Project

The project is built as a library used by executables.

class Exe : Project

The project is built as a executable.

class Driver

Interface to the main class that controles the entire process.

alias Fmt

Helper alias

fn normalisePath(path: string) string

Normalise a path, target must exsist.

fn removeWorkingDirectoryPrefix(path: string) string

As the function name imples.

fn add(exe: Exe)

Add a executable

fn add(lib: Lib)

Add a library

fn addEnv(boot: bool, name: string, value: string)

Add a enviromental variable.

fn setCmd(boot: bool, name: string, c: Command)

Set a tool that has been found.

fn getCmd(boot: bool, name: string) Command

Get a tool.

fn addCmd(boot: bool, name: string, cmd: string)

Add a tool, will reset the tool if already given.

fn addCmdArg(boot: bool, name: string, arg: string)

Add a argument for tool.

fn action(fmt: scope (Fmt))

Prints a action string.

By default it is formated like this:

  BATTERY  <fmt>

Parameters

fmt

The format string, same formatting as watt.text.format.

fn info(fmt: scope (Fmt))

Prints a info string.

Parameters

fmt

The format string, same formatting as watt.text.format.

fn abort(fmt: scope (Fmt))

Error encoutered, print error then abort operation.

May terminate program with exit, or throw an exception to resume.

Parameters

fmt

The format string, same formatting as watt.text.format.