@imp/rules/c/cmake/graph_replay

Module: @imp/rules/c/cmake/graph_replay.

basename(path)

Documentation is not yet available for this implementation export.

Source: rules/c/cmake/graph_replay.luau:393.

cmake_project_spec(options)

Normalize the options of cmake_project() into the spec that the tasks of this module take. See cmake_project in ./expansion for the options.

Source: rules/c/cmake/graph_replay.luau:171.

compiler_workspace_sources(edge, rules, sandbox_root, source_paths)

The workspace sources that a compiler edge reads directly, sorted. Only paths that the configure srcs captured count, so generated files and edge outputs are never workspace sources.

Source: rules/c/cmake/graph_replay.luau:430.

configure_cmake_project(spec)

Declare the configure task of a project. Its outputs are directory (the configured build directory, an artifact), ninja_graph (the value of configured_graph), and source_paths (the workspace paths that srcs captured).

Source: rules/c/cmake/graph_replay.luau:296.

configured_graph(read_generated, build_dir_path)

Parse the files that a configure wrote. read_generated(path) returns the text of a file relative to the build directory, or fails when the file does not exist.

Returns graph, ctest_paths. graph is { rules, edges, top_vars, target_types, sandbox_root, ctest_text }. ctest_paths lists each CTestTestfile.cmake relative to the workspace: the top-level file and each file that a subdirs() entry reaches.

CTestTestfile.cmake writes the executable of each test as an absolute path in the configure sandbox. ctest_text has that sandbox build directory (cmake_ninja_workdir) removed, so the paths become relative tokens that ctest resolves from --test-dir. A rewrite at run time would put the path of the current sandbox into a cached action, and a cache hit would then replay a path that is not valid.

Source: rules/c/cmake/graph_replay.luau:250.

correlate_ctest_entries(ninja_graph)

The CTest test names of ninja_graph, by the basename of the test executable: { [basename] = { name, ... } }.

Source: rules/c/cmake/graph_replay.luau:400.

ctest_name_filter_args(test_names)

Documentation is not yet available for this implementation export.

Source: rules/c/cmake/graph_replay.luau:1015.

is_cmake_compiler_edge(edge, rules)

True for a C or C++ compiler edge. CMake writes deps = gcc for GCC-like compilers and deps = msvc for cl.exe. Linker rules can also have deps = gcc, so the dependency mode alone is not sufficient.

Source: rules/c/cmake/graph_replay.luau:420.

parse_ninja_deps(text)

Parse the output of ninja -t deps: an output line ends in : #deps ..., and the indented lines after it are its dependencies. Returns { [output] = { path, ... } }.

Source: rules/c/cmake/graph_replay.luau:483.

plan_replay(spec, ninja_graph, target_names, target_deps, source_paths, compiler_manifest)

Plan the replay of target_names: the edges in dependency waves and the inputs of each compiler edge. It does not declare tasks.

target_deps is { [target name] = { outputs, task, file_indices } } (see build_target_deps in ./expansion). Their outputs stop the walk, so this replay takes the artifacts of the other target as inputs and does not derive its edges again.

Returns { waves, compiler_sources, compiler_headers, compiler_input_plan, source_paths, header_paths }. waves is a list of edge lists. compiler_sources and compiler_headers map each edge to paths. The other fields are sorted path lists and the plan of each compiler edge key. Fails for a C++ module edge (dyndep).

Source: rules/c/cmake/graph_replay.luau:664.

`replay_cmake_target(

spec,
configured,
ninja_graph,
target_names,
expose_outputs,
target_deps,
source_paths,
compiler_manifest

)`

Declare the task that replays each Ninja edge that target_names need, in dependency waves.

ninja_graph is the resolved value of configured.outputs.ninja_graph: the caller (the create callback of ./expansion) has it already. expose_outputs lists build-directory paths that the targets make; each one is also an output file<i>, in list order, so that the caller can give one product without the full build directory. target_deps, source_paths, and compiler_manifest go to plan_replay.

The outputs are directory (the build directory after replay, with any POST_BUILD copy destinations) and file1, file2, ...

Source: rules/c/cmake/graph_replay.luau:827.

`run_ctest_task(

spec,
configured,
ninja_graph,
target_names,
test_names,
target_deps,
source_paths,
compiler_manifest

)`

Declare a replay of target_names (see replay_cmake_target) and a task that runs ctest in the replayed build directory, for test_names only when given. The configure task already made the CTestTestfile.cmake paths relative (see configured_graph). The output units is the unit list of @imp/rules/workflows/test.

Source: rules/c/cmake/graph_replay.luau:1033.

scan_cmake_compiler_inputs(spec, configured)

Declare the task that runs the compiler rules of CMake in syntax-only mode one time, and returns the workspace headers that Ninja recorded for each compiler edge (outputs.manifest, see scan_manifest). The task comes before the expansion, so its value can shape the replay tasks.

Source: rules/c/cmake/graph_replay.luau:594.

scan_manifest(ninja_graph, source_paths, build_dir_path, deps_text)

The header plan of each compiler edge, from the output of ninja -t deps: { [edge key] = { headers } }. Reject a missing record or a GCC record that omits its direct source. MSVC records contain only the headers from /showIncludes.

Source: rules/c/cmake/graph_replay.luau:517.