Files
coursebank/build.rs
T
alexm abae39bd54
Pipeline / check (pull_request) Failing after 12m11s
Pipeline / docs (pull_request) Skipped
Pipeline / nightly (pull_request) Skipped
Pipeline / release (pull_request) Skipped
chore: relicense under Apache-2.0
Replace the Prosperity Public License 3.0.0 with the Apache License 2.0:
LICENSE.md, a new NOTICE.md, the Cargo license field, every SPDX header,
and the README's license and contributing sections.
2026-11-18 18:57:08 -05:00

23 lines
883 B
Rust

// SPDX-License-Identifier: Apache-2.0
// Copyright Scienting
// Source: https://git.scient.ing/education/coursebank
//! Chooses the version string compiled into the binary.
//!
//! Normal and release builds use the version from `Cargo.toml`. Nightly builds
//! set `COURSEBANK_VERSION` (to a git-derived string; see
//! `scripts/nightly-version.sh`) so `coursebank --version` reflects how far the
//! build is past the last release rather than an unreleased number.
use std::env;
fn main() {
let version = match env::var("COURSEBANK_VERSION") {
Ok(v) if !v.trim().is_empty() => v,
_ => env::var("CARGO_PKG_VERSION").expect("cargo always sets CARGO_PKG_VERSION"),
};
println!("cargo:rustc-env=COURSEBANK_VERSION={version}");
println!("cargo:rerun-if-env-changed=COURSEBANK_VERSION");
println!("cargo:rerun-if-env-changed=CARGO_PKG_VERSION");
}