Skip to main content

Module compiler

Module compiler 

Source
Expand description

Locate the bynkc compiler the driver shells, and report driver↔compiler version skew.

Resolution order (ADR: introduce the bynk driver):

  1. an explicit override — the BYNK_BYNKC environment variable (the bynk.executablePath-style escape hatch);
  2. bynkc on PATH;
  3. a bynkc sibling of the running bynk binary (mirrors how vscode-bynk resolves bynkc-lsp next to itself).

An explicit override wins when set — an override that only applied after auto-discovery failed would be useless. The skew check exists because this resolution can pick a bynkc whose version differs from the driver’s: once they are separate binaries, a global bynk 0.46 can shell a stale bynkc 0.44, and doctor’s whole job is to surface exactly that.

Structs§

Compiler
A resolved (or unresolved) bynkc.
SkewAsker
Who is asking, for the message: the command’s name, and whether it takes --allow-skew.

Enums§

Origin
How bynkc was located.
Skew
Driver↔compiler version relationship. Patch differences are ignored (they are wire-compatible under the project’s unified versioning); a minor drift warns; a major drift is a contract mismatch and an error.
SkewVerdict
#1675: what a command that is about to run a second compiler does about its skew from the driver — the same classification doctor renders, acted on. A second bynkc runs on these paths: bynk test always shells one, and bynk check, bynk fmt, bynk dev and bynk deploy do under a BYNK_BYNKC override. Without this, a skewed bynkc could check, format or test the code with a different compiler, many increments apart, silently.

Constants§

ALLOW_SKEW_ENV
#1675: the override for the skew gate below. Every gated command honours it; bynk test also takes it as --allow-skew. Any non-empty value allows a skewed bynkc (the same “non-empty means set” contract as the CI BYNK_REQUIRE_* switches).

Functions§

apply_skew_verdict
Print verdict’s message (if any) and say whether to go ahead. A warning prints once per process: bynk dev compiles on every change, and the same skew would otherwise repeat for the whole watch session.
resolve
Resolve bynkc against a Toolbox, given the override (typically std::env::var("BYNK_BYNKC")), the directory of the running bynk binary (for the sibling fallback), and the driver’s own version (to classify skew).
skew_allowed_by_env
Whether the skew override is set in the environment.
skew_gate
#1675: the whole gate for a command about to run compiler: the verdict, with the override from flag or ALLOW_SKEW_ENV, printed, and whether to go ahead.
skew_verdict
Decide what asker does about compiler’s skew. Minor skew warns; major skew refuses unless allow, in which case it warns instead.