Builtin functions
Builtin path functions
pb.translate
Rewrites a path by replacing a directory prefix.
Syntax:
pb.translate {
input = path,
from = path,
to = path
}
input: the path to rewritefrom: the base path prefix that must containinputto: the directory to use instead offrom
Returns a path where the from prefix is removed from input and replaced by to.
pb.retype
Changes the file suffix of a path.
Syntax:
pb.retype {
input = path,
from = string,
to = string
}
input: a path to a filefrom: the current file suffixto: the desired file suffix
Returns a path with the file suffix rewritten from from to to.
Builtin build functions
pb.rule
Creates a build-rule object describing how a build step should be performed. A rule captures the relevant inputs, outputs, and execution behavior for a single build action.
pb.rule |{input, output, ...}| {
name = "compile";
command = ["gcc", "-c", "-o", output, input];
};
Note: In pb.rule, object matcher defaults (for example, |{input ? fallback, ...}|) are not supported.
More information is available in the builds chapter.
pb.build
Creates a build operation from one or more rule definitions. A build object represents an actual build step that can be executed with the given inputs and outputs.
pb.build {
rule = rule_definition;
input = [sources...];
output = output;
}
rule_definition is the output of pb.rule, and the rest of the variables are defined from the arguments to the rule definition.
More information is available in the builds chapter.