Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/project.x

X2c project manifests.

Functions

FunctionSummary
new_commandCreates the starter project for x2c new in the directory named by request’s one operand and returns 0.
project_manifestReturns the explicit or nearest readable project manifest, or NULL.
project_planParses a project manifest and returns its selected target’s build plan.

Functions

new_command

int new_command(CliRequest request)

Creates the starter project for x2c new in the directory named by request’s one operand and returns 0. The directory may be missing or empty, and its last component names the target. Any other directory, an unusable name, or a failed write prints a diagnostic and exits with status 2.

Source: src/project.x:762

project_manifest

String project_manifest(CliRequest c)

Returns the explicit or nearest readable project manifest, or NULL. Discovery uses the same request view as project parsing.

Source: src/project.x:696

project_plan

ProjectBuild project_plan(CliRequest request)

Parses a project manifest and returns its selected target’s build plan. request must be a build or run request with no explicit operands. The result contains each dependency once before its consumer and lowers manifest fields and command-line overrides to ordinary CliRequest values without executing build actions. Manifest discovery, parsing, validation, or target-selection failures print a diagnostic and exit with status 2.

Source: src/project.x:712

Public types

TypeKindSummary
ProjectBuildstructLinks native build requests in dependency-first order.

ProjectBuild

typedef struct ProjectBuild { CliRequest request; struct ProjectBuild *next; } *ProjectBuild

Links native build requests in dependency-first order. project_plan returns the head. Each node and copied CliRequest struct is owned by the current Scope and needs no individual cleanup; its String and List fields retain their canonical pool lifetimes and may share values with the command request.

Source: src/project.x:22

Design notes

A project manifest defines source membership, deterministic glob expansion, target relationships, and named profiles. Resolved targets lower to the same CliRequest a direct build uses.