unity_solution_generator/
lib.rs1pub const LOCKFILE_VERSION: u32 = 1;
9
10pub const CACHE_VERSION: u32 = 1;
15
16pub mod defines;
17pub mod error;
18pub(crate) mod generate_cache;
19pub mod io;
20pub(crate) mod lock_cache;
21pub mod lockfile;
22pub mod lockfile_scanner;
23pub(crate) mod package_cache;
24pub mod paths;
25pub mod profile;
26pub mod project_scanner;
27pub mod solution_generator;
28pub mod typecheck;
29pub(crate) mod walk;
30pub mod xml;
31
32pub use defines::{generate_version_defines, parse_scripting_defines};
33pub use error::{GeneratorError, LockfileError, Result};
34pub use lockfile::{DllRef, Lockfile, LockfileIO, RefCategory};
35pub use lockfile_scanner::LockfileScanner;
36pub use paths::{
37 DEFAULT_GENERATOR_ROOT, lockfile_path, parent_directory, resolve_project_root, resolve_real_path,
38};
39pub use project_scanner::{AsmDefRecord, ProjectCategory, ProjectScanner, ScanResult, VersionDefine};
40pub use solution_generator::{
41 BuildConfig, BuildPlatform, GenerateOptions, GenerateResult, SolutionGenerator,
42};
43pub use typecheck::{TypecheckOptions, TypecheckResult};
44#[doc(hidden)]
46pub mod __test_only {
47 pub use crate::lock_cache::{build_entries, is_valid};
48 pub use crate::typecheck::__test_only_build_rsp as build_rsp;
49}
50
51pub fn generate(
58 project_root: &str,
59 platform: &str,
60 config: &str,
61 output_dir: Option<&str>,
62 extra_refs: Option<&str>,
63) -> Result<()> {
64 let build_platform = BuildPlatform::parse(platform).ok_or_else(|| {
65 GeneratorError::Other(format!(
66 "Unknown platform '{platform}'. Use 'ios', 'android', or 'osx'."
67 ))
68 })?;
69 let build_config = BuildConfig::parse(config).ok_or_else(|| {
70 GeneratorError::Other(format!(
71 "Unknown config '{config}'. Use 'prod', 'dev', or 'editor'."
72 ))
73 })?;
74 let resolved = resolve_project_root(project_root);
75 let extra_refs_vec: Vec<DllRef> = extra_refs.map(DllRef::parse_list).unwrap_or_default();
76 let options = GenerateOptions::new(resolved.clone(), build_platform)
77 .with_build_config(build_config)
78 .with_output_dir(output_dir)
79 .with_extra_refs(extra_refs_vec);
80 let lockfile = LockfileIO::load_or_scan(&resolved, DEFAULT_GENERATOR_ROOT)?;
81 SolutionGenerator::new().generate_from_lockfile(&options, &lockfile)?;
82 Ok(())
83}