MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / swift_register_target

Function swift_register_target

src/pipeline/pass_pkgmap.c:866–883  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

864 * takes for `src/lib`). `literal_path` is borrowed; caller retains
865 * ownership. */
866static 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.

Callers 1

swift_scan_targetsFunction · 0.85

Calls 2

build_entry_pathFunction · 0.85
pkg_entries_pushFunction · 0.85

Tested by

no test coverage detected