Every SPAWNS and DEPLOYS edge as "source -> target (TYPE api|via[ * ci[/job]])", sorted, one per line: top-level code as "@ "; a script * as "script: ", a Process as "proc: ", a Chart as "chart: ", * a Make rule as "rule: : ". */
| 1883 | * as "script:<path>", a Process as "proc:<name>", a Chart as "chart:<name>", |
| 1884 | * a Make rule as "rule:<file>:<target>". */ |
| 1885 | static char *gpf_runs(const GpfFile *files, int nfiles) { |
| 1886 | GpfProj lp; |
| 1887 | cbm_store_t *store = gpf_index_files(&lp, files, nfiles); |
| 1888 | char *out = NULL; |
| 1889 | if (store) { |
| 1890 | sqlite3_stmt *st = NULL; |
| 1891 | const char *sql = |
| 1892 | "SELECT coalesce(group_concat(x, char(10)), '') FROM (SELECT DISTINCT " |
| 1893 | "CASE WHEN s.label IN ('Module','File') THEN '@' || s.file_path ELSE s.name END " |
| 1894 | "|| ' -> ' || CASE WHEN t.label IN ('Module','File') THEN 'script:' || t.file_path " |
| 1895 | "WHEN t.label='Process' THEN 'proc:' || t.name WHEN t.label='Chart' THEN " |
| 1896 | "'chart:' || t.name WHEN t.label='Function' THEN 'rule:' || t.file_path || ':' || " |
| 1897 | "t.name ELSE t.label || ':' || t.file_path END " |
| 1898 | "|| ' (' || e.type || ' ' || coalesce(json_extract(e.properties,'$.api'), " |
| 1899 | "json_extract(e.properties,'$.via')) || coalesce(' ' || " |
| 1900 | "json_extract(e.properties,'$.ci') || coalesce('/' || " |
| 1901 | "json_extract(e.properties,'$.job'), ''), '') || ')' AS x " |
| 1902 | "FROM edges e JOIN nodes s ON s.id=e.source_id JOIN nodes t ON t.id=e.target_id " |
| 1903 | "WHERE e.project=?1 AND e.type IN ('SPAWNS','DEPLOYS') ORDER BY x)"; |
| 1904 | if (sqlite3_prepare_v2(cbm_store_get_db(store), sql, -1, &st, NULL) == SQLITE_OK) { |
| 1905 | sqlite3_bind_text(st, 1, lp.project, -1, SQLITE_STATIC); |
| 1906 | if (sqlite3_step(st) == SQLITE_ROW) { |
| 1907 | out = strdup((const char *)sqlite3_column_text(st, 0)); |
| 1908 | } |
| 1909 | } |
| 1910 | sqlite3_finalize(st); |
| 1911 | } |
| 1912 | gpf_cleanup(&lp, store); |
| 1913 | return out; |
| 1914 | } |
| 1915 | |
| 1916 | #define GPF_ASSERT_RUNS(files, n, want) \ |
| 1917 | do { \ |
nothing calls this directly
no test coverage detected