30cdd6298a
release.yml builds every game release with HORIZON_VERSION, the tag without its v
(docs/versioning.md), as launcher.yml already does for the launcher: no version-bump commits.
- horizon_core::release::{RELEASE, VERSION}: the built-in version, or Cargo.toml's for a build from
source. (horizon_core::version stays Minecraft's, generated by gen_version_consts.py.)
- horizon-server and horizon-prepare --version, the server's /api/v1/status, horizon-ctl's MCP
serverInfo and the "Horizon/<version>" user agents use it; they all said 0.1.0.
- The client's crash reports and telemetry say v0.2.3 from the built-in version wherever the game
is installed; releases from before 0.2 (no version built in) still read the launcher's folder name.
- The launcher's benchmark telemetry used Cargo.toml's version instead of the release's.
- release.yml checks that horizon-prepare and horizon-server --version say the release's version.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
1.1 KiB
Rust
33 lines
1.1 KiB
Rust
//! Which Horizon release this build is (docs/versioning.md). Not Minecraft's version: that is
|
|
//! [`crate::version`], generated from the game's own files.
|
|
|
|
/// The release's version (`0.2.3`, no `v`): release.yml builds every release with `HORIZON_VERSION`
|
|
/// set from its tag, so there are no version-bump commits. None for a build from source.
|
|
pub const RELEASE: Option<&str> = match option_env!("HORIZON_VERSION") {
|
|
Some(version) if !version.is_empty() => Some(version),
|
|
_ => None,
|
|
};
|
|
|
|
/// [`RELEASE`], or this crate's Cargo.toml version for a build from source: what `--version`, user
|
|
/// agents and reports say.
|
|
pub const VERSION: &str = match RELEASE {
|
|
Some(version) => version,
|
|
None => env!("CARGO_PKG_VERSION"),
|
|
};
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
#[test]
|
|
fn the_version_is_the_release_or_the_crate() {
|
|
assert_eq!(
|
|
super::RELEASE,
|
|
option_env!("HORIZON_VERSION").filter(|v| !v.is_empty())
|
|
);
|
|
assert_eq!(
|
|
super::VERSION,
|
|
super::RELEASE.unwrap_or(env!("CARGO_PKG_VERSION"))
|
|
);
|
|
assert!(!super::VERSION.starts_with('v'));
|
|
}
|
|
}
|