(
self,
outputs: NinjaPathOrPaths,
rule: str,
inputs: Optional[NinjaPathOrPaths] = None,
implicit: Optional[NinjaPathOrPaths] = None,
order_only: Optional[NinjaPathOrPaths] = None,
variables: Optional[
Union[
List[Tuple[str, Optional[NinjaPathOrPaths]]],
Dict[str, Optional[NinjaPathOrPaths]],
]
] = None,
implicit_outputs: Optional[NinjaPathOrPaths] = None,
pool: Optional[str] = None,
dyndep: Optional[NinjaPath] = None,
)
| 95 | self.variable("deps", deps, indent=1) |
| 96 | |
| 97 | def build( |
| 98 | self, |
| 99 | outputs: NinjaPathOrPaths, |
| 100 | rule: str, |
| 101 | inputs: Optional[NinjaPathOrPaths] = None, |
| 102 | implicit: Optional[NinjaPathOrPaths] = None, |
| 103 | order_only: Optional[NinjaPathOrPaths] = None, |
| 104 | variables: Optional[ |
| 105 | Union[ |
| 106 | List[Tuple[str, Optional[NinjaPathOrPaths]]], |
| 107 | Dict[str, Optional[NinjaPathOrPaths]], |
| 108 | ] |
| 109 | ] = None, |
| 110 | implicit_outputs: Optional[NinjaPathOrPaths] = None, |
| 111 | pool: Optional[str] = None, |
| 112 | dyndep: Optional[NinjaPath] = None, |
| 113 | ) -> List[str]: |
| 114 | str_outputs = serialize_paths(outputs) |
| 115 | out_outputs = [escape_path(x) for x in str_outputs] |
| 116 | all_inputs = [escape_path(x) for x in serialize_paths(inputs)] |
| 117 | |
| 118 | if implicit: |
| 119 | implicit = [escape_path(x) for x in serialize_paths(implicit)] |
| 120 | all_inputs.append("|") |
| 121 | all_inputs.extend(map(str, implicit)) |
| 122 | if order_only: |
| 123 | order_only = [escape_path(x) for x in serialize_paths(order_only)] |
| 124 | all_inputs.append("||") |
| 125 | all_inputs.extend(map(str, order_only)) |
| 126 | if implicit_outputs: |
| 127 | implicit_outputs = [ |
| 128 | escape_path(x) for x in serialize_paths(implicit_outputs) |
| 129 | ] |
| 130 | out_outputs.append("|") |
| 131 | out_outputs.extend(map(str, implicit_outputs)) |
| 132 | |
| 133 | self._line( |
| 134 | "build %s: %s" % (" ".join(out_outputs), " ".join([rule] + all_inputs)) |
| 135 | ) |
| 136 | if pool is not None: |
| 137 | self._line(" pool = %s" % pool) |
| 138 | if dyndep is not None: |
| 139 | self._line(" dyndep = %s" % serialize_path(dyndep)) |
| 140 | |
| 141 | if variables: |
| 142 | if isinstance(variables, dict): |
| 143 | iterator = iter(variables.items()) |
| 144 | else: |
| 145 | iterator = iter(variables) |
| 146 | |
| 147 | for key, val in iterator: |
| 148 | self.variable(key, val, indent=1) |
| 149 | |
| 150 | return str_outputs |
| 151 | |
| 152 | def include(self, path: str) -> None: |
| 153 | self._line("include %s" % path) |
no test coverage detected