Skip to main content

solar_config/
version.rs

1//! Solar version information.
2
3/// The short version information.
4#[cfg(feature = "version")]
5pub const SHORT_VERSION: &str = env!("SHORT_VERSION");
6
7/// The long version information.
8#[cfg(feature = "version")]
9pub const VERSION: &str = concat!(
10    env!("LONG_VERSION0"),
11    "\n",
12    env!("LONG_VERSION1"),
13    "\n",
14    env!("LONG_VERSION2"),
15    "\n",
16    env!("LONG_VERSION3"),
17    "\n",
18    env!("LONG_VERSION4"),
19);
20
21/// The solc-compatible long version information.
22#[cfg(feature = "version")]
23pub const SOLC_VERSION: &str =
24    concat!(env!("SOLC_LONG_VERSION0"), "\n", env!("SOLC_LONG_VERSION1"));
25
26/// The semver version information.
27pub const SEMVER_VERSION: &str = env!("CARGO_PKG_VERSION");
28
29/// Returns the short version selected for the current environment.
30#[cfg(feature = "version")]
31pub fn short_version() -> &'static str {
32    SHORT_VERSION
33}
34
35/// Returns the long version selected for the current environment.
36#[cfg(feature = "version")]
37pub fn version() -> &'static str {
38    if solc_wrapper() { SOLC_VERSION } else { VERSION }
39}
40
41#[cfg(feature = "version")]
42fn solc_wrapper() -> bool {
43    std::env::var_os("SOLC_WRAPPER").is_some_and(|x| x == "1")
44}