~starkingdoms/starkingdoms

ref: 0a56ebc381389eb63ab5cb3c3522d9ea2475e9d8 starkingdoms/crates/unified/src/build_meta.rs -rw-r--r-- 1.1 KiB
0a56ebc3 — core aaa ??? ?? ? ?? ???????????????????????????????????????????? i would like to explosion 13 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Use of a mod or pub mod is not actually necessary.
pub mod built_info {
    #![allow(clippy::allow_attributes_without_reason, reason = "generated code")]
    #![allow(clippy::pedantic, reason = "generated code")]
    // The file has been placed there by the build script.
    include!(concat!(env!("OUT_DIR"), "/built.rs"));
}

pub fn version_and_features_line() -> String {
    // Version, commit, and features line
    // ex: starkingdoms v0.1.0 37f85fab-dirty +native +server +client +particle_editor
    let commit = format!("{}{}", built_info::GIT_COMMIT_HASH_SHORT.unwrap_or("<unknown>"), if let Some(d) = built_info::GIT_DIRTY && d { "-dirty" } else { "" }); // TODO
    let mut line = format!("starkingdoms v{} {commit}", env!("CARGO_PKG_VERSION"));

    if cfg!(feature = "platform_native") {
        line += " +native";
    }
    if cfg!(feature = "platform_wasm") {
        line += " +wasm";
    }
    if cfg!(feature = "target_server") {
        line += " +server";
    }
    if cfg!(feature = "target_client") {
        line += " +client";
    }
    if cfg!(feature = "target_particle_editor") {
        line += " +particle_editor";
    }

    line
}