Add a target per process message, and also keep ("process_message", {}) to allow for cross-pollination, or unlimited search
(targets, src_dir)
| 202 | |
| 203 | |
| 204 | def transform_process_message_target(targets, src_dir): |
| 205 | """Add a target per process message, and also keep ("process_message", {}) to allow for |
| 206 | cross-pollination, or unlimited search""" |
| 207 | |
| 208 | p2p_msg_target = "process_message" |
| 209 | if (p2p_msg_target, {}) in targets: |
| 210 | lines = subprocess.run( |
| 211 | ["git", "grep", "--function-context", "ALL_NET_MESSAGE_TYPES{", "src/protocol.h"], |
| 212 | check=True, |
| 213 | stdout=subprocess.PIPE, |
| 214 | text=True, |
| 215 | cwd=src_dir, |
| 216 | ).stdout.splitlines() |
| 217 | lines = [l.split("::", 1)[1].split(",")[0].lower() for l in lines if l.startswith("src/protocol.h- NetMsgType::")] |
| 218 | assert len(lines) |
| 219 | targets += [(p2p_msg_target, {"LIMIT_TO_MESSAGE_TYPE": m}) for m in lines] |
| 220 | return targets |
| 221 | |
| 222 | |
| 223 | def transform_rpc_target(targets, src_dir): |