Skip to main content

blue_build_recipe/
lib.rs

1mod akmods_info;
2mod maybe_version;
3mod module;
4mod module_ext;
5mod recipe;
6mod stage;
7mod stages_ext;
8
9use std::path::{Path, PathBuf};
10
11use blue_build_utils::constants::{CONFIG_PATH, RECIPE_PATH};
12use log::warn;
13
14pub use akmods_info::*;
15pub use maybe_version::*;
16pub use module::*;
17pub use module_ext::*;
18pub use recipe::*;
19pub use stage::*;
20pub use stages_ext::*;
21
22pub trait FromFileList {
23    const LIST_KEY: &str;
24
25    fn get_from_file_paths(&self) -> Vec<PathBuf>;
26
27    fn get_module_from_file_paths(&self) -> Vec<PathBuf> {
28        Vec::new()
29    }
30}
31
32pub(crate) fn base_recipe_path() -> &'static Path {
33    let legacy_path = Path::new(CONFIG_PATH);
34    let recipe_path = Path::new(RECIPE_PATH);
35
36    if recipe_path.exists() && recipe_path.is_dir() {
37        recipe_path
38    } else {
39        warn!(
40            "Use of {CONFIG_PATH} for recipes is deprecated, please move your recipe files into {RECIPE_PATH}"
41        );
42        legacy_path
43    }
44}