#![allow(dead_code)]
use std::{env, path::PathBuf};
mod devela_imports {
#![allow(unused)]
macro_rules! include_from {
($module_name:ident) => {
include!(concat!(
std::env!("CARGO_MANIFEST_DIR"),
"/",
stringify!($module_name),
".rs"
));
};
($module_path_str:literal) => {
include!(concat!(std::env!("CARGO_MANIFEST_DIR"), "/", $module_path_str));
};
}
macro_rules! mod_from {
($vis:vis $module_name:ident) => {
$vis mod $module_name { include_from!($module_name); }
};
($vis:vis $module_name:ident, $module_path_str:literal) => {
$vis mod $module_name { include_from!($module_path_str); }
};
}
}
pub(crate) fn out_dir() -> PathBuf {
PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR not set"))
}
pub(crate) fn manifest_dir() -> PathBuf {
PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set"))
}
pub(crate) fn manifest_path() -> PathBuf {
PathBuf::from(env::var("CARGO_MANIFEST_PATH").expect("CARGO_MANIFEST_PATH not set"))
}
#[cfg(feature = "__dbg")]
#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "__dbg")))]
pub(crate) fn println(msg: &str) {
println!("cargo:warning={}", msg);
}
#[cfg(feature = "__dbg")]
#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "__dbg")))]
pub(crate) fn println_heading(msg: &str) {
println("");
println(msg);
println(&"-".repeat(msg.len()));
}
#[cfg(feature = "__dbg")]
#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "__dbg")))]
pub(crate) fn println_var(var: &str) {
if let Ok(v) = env::var(var) {
println(&format!["· {var}: {v}"]);
} else {
println(&format!["x {var}:"]);
}
}
#[cfg(feature = "__dbg")]
#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "__dbg")))]
pub(crate) fn println_var_encoded(var: &str, new_var_name: &str) {
if let Ok(ev) = env::var(var) {
let v = ev.replace('\x1f', " ");
println(&format!["· {new_var_name}(*): {v}"]);
} else {
println(&format!["x {new_var_name}:"]);
}
}
#[cfg(feature = "__dbg")]
#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "__dbg")))]
pub(crate) fn println_start_end(start: bool) {
let msg = if start {
"~ Start of build script ~"
} else {
println("");
"~ End of build script ~"
};
let line = "~".repeat(msg.len());
println(&line);
println(msg);
println(&line);
}
macro_rules! sf { ( $($line:tt)+ ) => { $($line)+ }; }
sf! {
#[doc = "0 tabs, 0 spaces."] pub(crate) const TAB0: &str = "";
#[doc = "1 tabs, 4 spaces."] pub(crate) const TAB1: &str = " ";
#[doc = "2 tabs, 8 spaces."] pub(crate) const TAB2: &str = " ";
#[doc = "3 tabs, 12 spaces."] pub(crate) const TAB3: &str = " ";
#[doc = "4 tabs, 16 spaces."] pub(crate) const TAB4: &str = " ";
#[doc = "5 tabs, 20 spaces."] pub(crate) const TAB5: &str = " ";
#[doc = "6 tabs, 24 spaces."] pub(crate) const TAB6: &str = " ";
#[doc = "7 tabs, 28 spaces."] pub(crate) const TAB7: &str = " ";
#[doc = "8 tabs, 32 spaces."] pub(crate) const TAB8: &str = " ";
#[doc = "9 tabs, 36 spaces."] pub(crate) const TAB9: &str = " ";
}