Register `target_name` → its resolved source directory: the literal * `path:` argument the target declared, if any, else the conventional * `Sources/ ` (fixed-convention, same approach parse_cargo_toml * takes for `src/lib`). `literal_path` is borrowed; caller retains * ownership. */
| 864 | * takes for `src/lib`). `literal_path` is borrowed; caller retains |
| 865 | * ownership. */ |
| 866 | static void swift_register_target(const char *rel_path, const char *target_name, |
| 867 | const char *literal_path, cbm_pkg_entries_t *entries) { |
| 868 | if (!target_name || !target_name[0]) { |
| 869 | return; |
| 870 | } |
| 871 | char suffix_buf[PKGMAP_PATH_BUF]; |
| 872 | const char *suffix; |
| 873 | if (literal_path && literal_path[0]) { |
| 874 | suffix = literal_path; |
| 875 | } else { |
| 876 | snprintf(suffix_buf, sizeof(suffix_buf), "Sources/%s", target_name); |
| 877 | suffix = suffix_buf; |
| 878 | } |
| 879 | char *entry = build_entry_path(rel_path, suffix); |
| 880 | if (entry) { |
| 881 | pkg_entries_push(entries, strdup(target_name), entry); |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | /* Scan for `.target(name: "Foo", ...)` declarations, skipping any |
| 886 | * `.target(` spelling that falls inside a comment or string literal. |
no test coverage detected