diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-29 15:31:58 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-29 15:31:58 +0800 |
| commit | 5b1593afa467df256fcd7076967d305bebbb21ee (patch) | |
| tree | 5740576ecc364ed0064daff55c86efa2a3aed738 /mingling_core/src/lib.rs | |
| parent | 709b672731bcc1b68209cadc38e0de78d7c28c03 (diff) | |
refactor(core): move pathf module under builds and rename to buildHEADunreleasedmain
Migrate `mingling_core::pathf` into `mingling_core::builds::pathf` and
re-export from `mingling::build`. Update all references from
`mingling::builds` and `mingling::pathf` to `mingling::build`.
Diffstat (limited to 'mingling_core/src/lib.rs')
| -rw-r--r-- | mingling_core/src/lib.rs | 50 |
1 files changed, 3 insertions, 47 deletions
diff --git a/mingling_core/src/lib.rs b/mingling_core/src/lib.rs index ac6449f..3c2cf9b 100644 --- a/mingling_core/src/lib.rs +++ b/mingling_core/src/lib.rs @@ -61,6 +61,9 @@ pub mod builds; pub mod build { #[cfg(feature = "comp")] pub use crate::builds::comp::*; + + #[cfg(feature = "pathf")] + pub use crate::builds::pathf::*; } /// Provided for framework developers @@ -94,50 +97,3 @@ pub mod core_res { #[cfg(feature = "repl")] pub use crate::program::repl_exec::res::ResREPL; } - -#[cfg(feature = "pathf")] -pub mod pathf { - pub use mingling_pathf::config::*; - pub use mingling_pathf::module_pathf::*; - pub use mingling_pathf::pattern_analyzer::*; - pub use mingling_pathf::patterns::*; - - use std::path::Path; - - /// Wraps `analyze_and_build_type_mapping_for` with config derived from - /// the crate's feature flags (e.g., `dispatch_tree`). - pub fn analyze_and_build_type_mapping_for( - crate_dir: &Path, - output_dir: &Path, - ) -> Result<(), crate::error::MinglingPathfinderError> { - let config = mingling_pathf::config::PathfinderConfig { - use_dispatch_tree: cfg!(feature = "dispatch_tree"), - }; - mingling_pathf::analyze_and_build_type_mapping_for(crate_dir, output_dir, &config) - } - - /// Wraps `analyze_and_build_type_mapping` (build.rs convenience) with config. - pub fn analyze_and_build_type_mapping() -> Result<(), crate::error::MinglingPathfinderError> { - let config = mingling_pathf::config::PathfinderConfig { - use_dispatch_tree: cfg!(feature = "dispatch_tree"), - }; - let crate_dir = - std::env::current_dir().map_err(crate::error::MinglingPathfinderError::IoError)?; - let crate_name = std::env::var("CARGO_PKG_NAME").map_err(|_| { - crate::error::MinglingPathfinderError::IoError(std::io::Error::new( - std::io::ErrorKind::NotFound, - "CARGO_PKG_NAME not set", - )) - })?; - let out_dir = std::env::var("OUT_DIR").map_err(|_| { - crate::error::MinglingPathfinderError::IoError(std::io::Error::new( - std::io::ErrorKind::NotFound, - "OUT_DIR not set", - )) - })?; - let output_dir = Path::new(&out_dir).join(&crate_name); - mingling_pathf::analyze_and_build_type_mapping_for(&crate_dir, &output_dir, &config)?; - println!("cargo:rerun-if-changed=src/"); - Ok(()) - } -} |
