pub const LOCKFILE_VERSION: u32 = 1;
pub const CACHE_VERSION: u32 = 1;
pub mod defines;
pub mod error;
pub(crate) mod generate_cache;
pub mod io;
pub(crate) mod lock_cache;
pub mod lockfile;
pub mod lockfile_scanner;
pub(crate) mod package_cache;
pub mod paths;
pub mod profile;
pub mod project_scanner;
pub mod solution_generator;
pub mod typecheck;
pub(crate) mod walk;
pub mod xml;
pub use defines::{generate_version_defines, parse_scripting_defines};
pub use error::{GeneratorError, LockfileError, Result};
pub use lockfile::{DllRef, Lockfile, LockfileIO, RefCategory};
pub use lockfile_scanner::LockfileScanner;
pub use paths::{
DEFAULT_GENERATOR_ROOT, lockfile_path, parent_directory, resolve_project_root, resolve_real_path,
};
pub use project_scanner::{AsmDefRecord, ProjectCategory, ProjectScanner, ScanResult, VersionDefine};
pub use solution_generator::{
BuildConfig, BuildPlatform, GenerateOptions, GenerateResult, SolutionGenerator,
};
pub use typecheck::{TypecheckOptions, TypecheckResult};
#[doc(hidden)]
pub mod __test_only {
pub use crate::lock_cache::{build_entries, is_valid};
pub use crate::typecheck::__test_only_build_rsp as build_rsp;
}
pub fn generate(
project_root: &str,
platform: &str,
config: &str,
output_dir: Option<&str>,
extra_refs: Option<&str>,
) -> Result<()> {
let build_platform = BuildPlatform::parse(platform).ok_or_else(|| {
GeneratorError::Other(format!(
"Unknown platform '{platform}'. Use 'ios', 'android', or 'osx'."
))
})?;
let build_config = BuildConfig::parse(config).ok_or_else(|| {
GeneratorError::Other(format!(
"Unknown config '{config}'. Use 'prod', 'dev', or 'editor'."
))
})?;
let resolved = resolve_project_root(project_root);
let extra_refs_vec: Vec<DllRef> = extra_refs.map(DllRef::parse_list).unwrap_or_default();
let options = GenerateOptions::new(resolved.clone(), build_platform)
.with_build_config(build_config)
.with_output_dir(output_dir)
.with_extra_refs(extra_refs_vec);
let lockfile = LockfileIO::load_or_scan(&resolved, DEFAULT_GENERATOR_ROOT)?;
SolutionGenerator::new().generate_from_lockfile(&options, &lockfile)?;
Ok(())
}