Skip to main content

Module compiler

Module compiler 

Source
Expand description

Typed compiler / tool identity and capability model.

Cabin’s build planner emits GCC/Clang-style commands. The ResolvedToolchain (see crate::toolchain) says which tools the user picked; this module says what those tools are and what they can do. The resolver in cabin-toolchain::detect runs harmless --version invocations against each resolved tool, hands the output to the pure parsers in this module, and assembles a typed ToolchainDetectionReport.

This module is data and pure logic only. Process spawning, filesystem traversal, and CLI dispatch live elsewhere.

Structs§

ArchiverCapabilities
Capability set for a static-library archiver.
ArchiverIdentity
Detected identity of a static-library archiver.
Capability
One typed capability decision: whether the tool supports it, and where the answer came from.
CompilerCapabilities
Capability set for a C/C++ compiler. Every field is decided during detection so the planner can compare its required set against the resolved set without re-running parsing logic.
CompilerIdentity
Detected identity of one C/C++ compiler.
CompilerVersion
Decomposed compiler / archiver version (major.minor.patch).
ToolDetection
One tool’s detection outcome plus the path it was invoked at. path is the resolved absolute path from crate::ResolvedToolchain; it is preserved here so error messages can mention the exact executable.
ToolchainDetectionReport
Whole-toolchain detection report. The CLI builds one per invocation that needs detection (build / metadata) and threads it into the planner and the metadata view.

Enums§

ArchiverKind
Recognized static-library archiver family.
CapabilitySource
Where one capability decision came from. Recorded so cabin metadata can show whether Cabin trusted the version alone, ran a probe, or fell back to a conservative default.
CompilerKind
Recognized C/C++ compiler family.
ToolDetectionError
Errors produced while validating a detection report against the current C++ backend’s required capability set.

Functions§

derive_ar_capabilities
Derive an ArchiverCapabilities set from the detected identity.
derive_cxx_capabilities
Derive a CompilerCapabilities set from the detected identity. Decisions are made from the recognized compiler kind, with conservative defaults for CompilerKind::Unknown. No probe commands are run from this function — the caller’s detection layer already gathered everything we need.
parse_ar_version_output
Pure parser for archiver --version output. The recognized families (ar and llvm-ar) print one line that includes the family name. Anything else is classified as ArchiverKind::Unknown; archivers that exit non-zero on --version are left to the subprocess layer to surface as Unknown.
parse_cxx_version_output
Pure parser for compiler --version output.
validate_ar_for_backend
Validate that the resolved archiver can handle the planner’s ar crs <lib> <objs> invocation.
validate_cc_for_backend
Validate that the resolved C compiler supports the C-side command shape the planner emits: GCC-style flags plus -MMD -MF depfile generation. Unlike validate_cxx_for_backend, this validator does not require -std=c++17 support — a pure-C driver that lacks C++ mode is acceptable when the target only carries C translation units.
validate_cxx_for_backend
The capability set the current C++ backend requires.