fn compile_sync_with_stats<P: AsRef<Path>>(
fs: &FileSystem,
root: P,
profile: Option<&str>,
profile_suffix: Option<&str>,
variables: &BTreeMap<String, String>,
) -> Result<(Project, CompileStats), ProjectError>Expand description
Internal entry point that returns compile statistics alongside the project.
Runs the full incremental pipeline:
- Discover — walk
models/to find databases, schemas, objects, and mod files. Build theDiscoverycontaining all descriptors and the database name map. - Plan — fingerprint every object against the cached artifact store. Partition objects into cache hits and cache misses (parallel via rayon).
- Compile misses — parse, validate, and normalize each miss from source. Persist new artifacts back to the cache (parallel via rayon).
- Assemble — combine database/schema metadata with validated objects
into a
compiled::Project. Apply cross-database and cluster name rewrites if a profile suffix is active. - Build graph — run cross-object validation, dependency extraction,
and topological analysis to produce the final
graph::Project.