Skip to main content

provenant/
version.rs

1// SPDX-FileCopyrightText: Provenant contributors
2// SPDX-License-Identifier: Apache-2.0
3
4use std::sync::OnceLock;
5
6pub const BUILD_VERSION: &str = match option_env!("PROVENANT_BUILD_VERSION") {
7    Some(version) => version,
8    None => env!("CARGO_PKG_VERSION"),
9};
10
11const ATTRIBUTION_NOTICE: &str = "License detection uses data from ScanCode Toolkit (CC-BY-4.0). See NOTICE file or --show-attribution option.";
12
13pub fn build_long_version() -> &'static str {
14    static LONG_VERSION: OnceLock<String> = OnceLock::new();
15
16    LONG_VERSION
17        .get_or_init(|| format!("{BUILD_VERSION}\n{ATTRIBUTION_NOTICE}"))
18        .as_str()
19}