rules provides two classes, Rule and rules.RuleCloth, which provide an additional layer of abstraction between the BuildCloth-described build system and the underlying Ninja or Make implementation.
rules provides a common interface for both Ninja and Make, but some Ninja functionality (i.e. restat rules) are not implemented for Make. Additionally, Rule only describes build rules and does not provide a common abstraction for describing build targets or dependencies.
Rule() represents a build system rule, and provides an interface for constructing a rule.
Parameters: | cmd (list,str) – Optional. Specifies a command or sequence of commands that implement the build rule. |
---|---|
Returns: | The command list of the Rule() object. If you do not specify a command, and the Rule() does not have a command, command() will return None. |
Adds or appends cmd as a command list to the Rule() object.
Raises InvlaidRule if you do not specify a command list and the Rule() object doesn’t a command list.
Parameters: | dep (string) – Optional. The path to a Makefile that contains dependencies |
---|---|
Returns: | The current depfile. |
Raises : | InvalidRule if there is no depfile set for this rule. |
Parameters: | des (string) – Optional. The text of the description message that the build job will pass to the user. |
---|---|
Returns: | The current description. |
Raises : | InvalidRule if there is no description set for this rule. |
An alias for description().
Parameters: | name (string) – Optional. Specifies a name of the rule. |
---|---|
Returns: | The name of the Rule() object. |
Sets the name of the Rule() object to name.
Raises InvlaidRule if you do not specify a name and the Rule() object doesn’t have a name.
Sets this rule as a restat rule. This only affects ninja output.
Returns: | True. |
---|
Returns: | A dictionary that contains the full build rule. |
---|---|
Raises : | err.InvalidRule if you have not specified a name for the builder. |
RuleCloth() provides an interoperable layer between rule objects created as rules.Rule() objects and build systems generated using MakefileCloth() and NinjaFileCloth.
An internal method used by :~rules.RuleCloth.fetch() to process content from rules and return get_block() in Makefile format.
An internal method used by :~rules.RuleCloth.fetch() to process content from rules and return get_block() in Ninja format.
Parameters: | rule (Rule) – A Rule object. |
---|---|
Raises : | InvalidRule if the rule doesn’t have a name or if the rule already exists in rules. |
Adds a Rule object to the RuleCloth object. Will not overwrite an existing rule.
Parameters: | |
---|---|
Returns: | The output of get_block() for either Ninja or Makefiles, depending on name. |
Raises : | InvalidBuilder when output is neither make nor ninja. |
The default build system output format.
The structure that represents build rules.