Mark the File node of each file running a container build * {"declares_build":true} -- resolved or not: an incremental run reads these * files again, as the image build edges are recomputed whole * (pipeline_incremental.c). The mark lives and dies with its file's node. */
| 3951 | * files again, as the image build edges are recomputed whole |
| 3952 | * (pipeline_incremental.c). The mark lives and dies with its file's node. */ |
| 3953 | static void sh_mark_declarers(cbm_pipeline_ctx_t *ctx, CBMHashTable *declarers) { |
| 3954 | static const char MARK[] = "\"declares_build\":true"; |
| 3955 | const cbm_gbuf_node_t **nodes = NULL; |
| 3956 | int n = 0; |
| 3957 | if (cbm_ht_count(declarers) == 0 || |
| 3958 | cbm_gbuf_find_by_label(ctx->gbuf, "File", &nodes, &n) != 0) { |
| 3959 | return; |
| 3960 | } |
| 3961 | for (int i = 0; i < n; i++) { |
| 3962 | cbm_gbuf_node_t *f = (cbm_gbuf_node_t *)nodes[i]; |
| 3963 | const char *props = f->properties_json ? f->properties_json : "{}"; |
| 3964 | if (!f->file_path || !cbm_ht_get(declarers, f->file_path) || strstr(props, MARK)) { |
| 3965 | continue; |
| 3966 | } |
| 3967 | size_t pl = strlen(props); |
| 3968 | char buf[CBM_SZ_4K]; |
| 3969 | bool empty = pl < PAIR_LEN || strcmp(props, "{}") == 0; |
| 3970 | if (props[pl - SKIP_ONE] != '}' || pl + sizeof(MARK) + PAIR_LEN > sizeof(buf)) { |
| 3971 | continue; |
| 3972 | } |
| 3973 | snprintf(buf, sizeof(buf), "%.*s%s%s}", (int)(pl - SKIP_ONE), empty ? "{" : props, |
| 3974 | empty ? "" : ",", MARK); |
| 3975 | (void)cbm_gbuf_node_set_properties_json(f, buf); |
| 3976 | } |
| 3977 | } |
| 3978 | |
| 3979 | void cbm_pipeline_pass_shell(cbm_pipeline_ctx_t *ctx, const cbm_file_info_t *files, |
| 3980 | int file_count) { |
no test coverage detected