Skip to content

engine: wire --define=NAME=VALUE into {def.NAME} - #60

Merged
helly25 merged 1 commit into
mainfrom
feat/define-cli-wiring
Jun 21, 2026
Merged

engine: wire --define=NAME=VALUE into {def.NAME}#60
helly25 merged 1 commit into
mainfrom
feat/define-cli-wiring

Conversation

@helly25

@helly25 helly25 commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Completes #53 (the fields side landed in #58). Wires the --define=NAME=VALUE global to the {def.NAME} namespace:

  • ResolveDefines collects --define globals into a name→value map — last wins, and VALUE may itself contain = (split at the first one).
  • run.cc builds it once and passes it on the EvalContext and the --template RenderContext; the gated -exec carries it through (render_ctx.defines = ctx.defines).
  • So {def.NAME} resolves in --format/--template and (gated) -exec.

Example: xff --define=tag=v2 . --template='{def.tag} {name}'.

Test plan

  • run_test.DefinePopulatesDefNamespace: --define=label=old --define=label=new --template={def.label}:{name}new:a.txt (proves wiring + last-wins).
  • fields_test.DefNamespaceReadsDefines (from fields: add {def.NAME} namespace reading a defines map #58) covers the field lookup.
  • Green on both toolchains: bazel test //... (default) and --config=clang --config=asan.

ResolveDefines collects --define globals into a name->value map (last
wins; VALUE may contain '='). run.cc builds it once and passes it on the
EvalContext and the --template RenderContext; the gated -exec carries it
through too. So {def.NAME} resolves in --format/--template and -exec.

Completes #53 (the fields side landed in PR #58). run_test drives
--define end-to-end through --template, including last-wins.
@helly25
helly25 merged commit f2b3ba4 into main Jun 21, 2026
4 checks passed
@helly25
helly25 deleted the feat/define-cli-wiring branch June 21, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant