concinnity_cook/lib.rs
1//! concinnity-cook: the build side, kept out of the runtime foundation so that
2//! foundation carries none of the build-only dependencies (fbxcel, sha2,
3//! kira). This crate turns world.jsonl + source files into the binary
4//! blobs the runtime reads; it depends on concinnity-core and core has no edge
5//! back into it.
6//!
7//! The stages read in order: `authoring` is the authored model and the type
8//! vocabulary it is written in, `build_only` expands the types that never reach
9//! a blob, `check` validates the expanded world, and the compile path turns
10//! what is left into payloads. That path is three groups plus the orchestration
11//! that sequences them: `import` reads the artist-supplied source files,
12//! `codec` decodes the container and image formats they carry, `compile` turns
13//! an asset's args and sources into its payload, and `pipeline` / `blob` /
14//! `cache` at the root drive the whole run.
15//!
16//! Bridge: the vocabulary and compute modules below are re-exported crate-wide
17//! so code moved here keeps resolving its `crate::{components,ecs,gfx,result}`
18//! paths. `crate::components` is the runtime half only; the authoring-only
19//! types this crate expands away are named from
20//! `crate::authoring::registry::build_only` where they are used, so a use site
21//! says which half it works on. The payload *decoders* and shared payload types
22//! live in `concinnity_core::bake`; this crate's modules call back into them.
23//! The source importers parse artist-supplied files, so a panic here is a crash
24//! on a malformed asset rather than a bug. Invariants that genuinely cannot fail
25//! use `expect` with the invariant named; tests unwrap freely.
26#![warn(clippy::unwrap_used)]
27#![cfg_attr(
28 test,
29 expect(
30 clippy::unwrap_used,
31 reason = "tests unwrap freely; the crate-wide warn covers non-test code"
32 )
33)]
34
35pub(crate) use concinnity_core::gfx;
36pub(crate) use concinnity_core::{components, result};
37
38// The vocabulary's ECS surface, with the build-time name interner shadowing its
39// `asset_id`: the interner keeps a per-thread table, so it lives in
40// `concinnity_host::thread` and re-exports the vocabulary's `AssetId` /
41// `AssetRef`.
42pub(crate) mod ecs {
43 pub(crate) use concinnity_core::ecs::*;
44 pub(crate) use concinnity_host::thread::asset_id;
45}
46// The source-asset lookup lives in `concinnity_host::store`, re-exported so
47// cook code keeps naming it under `crate::source`. It resolves against a
48// directory its caller supplies; every build threads that root down from its
49// entry point rather than reading one for itself.
50pub(crate) use concinnity_host::store::source;
51
52// Build-host API, re-exported deliberately: a host driving the pipeline (the
53// CLI, an example harness) works against cook alone, the way a runtime host
54// works against concinnity-engine. `paths` is the state tree cook builds into
55// (anchoring it, locating `data/`, and naming the `assets/` a host passes as a
56// build's search root); `platform` is the shader-platform vocabulary a host
57// names the backend it cooks for with.
58pub use concinnity_core::platform;
59pub use concinnity_host::store::paths;
60
61// The authoring type vocabulary, bound at the root so the compile path keeps
62// resolving `crate::registry` without naming the namespace it belongs to.
63pub(crate) use authoring::registry;
64
65pub(crate) mod asset;
66pub mod asset_api;
67pub(crate) mod asset_impls;
68/// The authored world model: world.jsonl parsing and I/O, the type vocabulary,
69/// the asset cross-reference metadata, the typed spec vocabulary, and the
70/// build-only args schemas. Everything the cook reads before it compiles
71/// anything.
72pub mod authoring;
73pub mod blob;
74/// The build-time expansion passes: one module per build-only asset type, plus
75/// preset loading and the build front-half orchestrator.
76pub mod build_only;
77pub mod cache;
78pub mod check;
79// Container and image format decoders, shared by the compilers that encode
80// their output.
81pub(crate) mod codec;
82/// The compile path: per-asset payload compilers plus the whole-world passes
83/// that run with them.
84pub mod compile;
85// Stat-based identity behind the cook's read memos, and the settle window that
86// keeps a same-tick equal-length rewrite from being served stale.
87mod file_stamp;
88/// Source-file readers: the scene expansion and the container readers it
89/// dispatches into.
90pub mod import;
91pub mod pipeline;
92pub mod resource_handles;
93#[cfg(test)]
94mod slangc_gate;
95
96// Public build API: the entry points the CLI, the editor FFI, and the infra
97// server call. The runtime-side decode API stays in concinnity-core.
98pub use build_only::prepare_world;
99pub use pipeline::{
100 BuildProgress, PipelineResult, build_compiled, build_compiled_with_progress, build_from_path,
101 build_pipeline_from_str, validate_asset, validate_world_jsonl, write_build_outputs,
102};