Skip to content

Commit

Permalink
Release 0.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
galister committed Aug 10, 2024
1 parent 378ea12 commit d9287f3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ debug = true

[package]
name = "wlx-overlay-s"
version = "0.4.3"
version = "0.4.4"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down Expand Up @@ -70,6 +70,9 @@ image_dds = { version = "0.6.0", default-features = false, features = [
] }
mint = "0.5.9"

[build-dependencies]
regex = { version = "*" }

[features]
default = ["openvr", "openxr", "osc", "x11", "wayland"]
openvr = ["dep:ovr_overlay", "dep:json"]
Expand Down
23 changes: 23 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use regex::Regex;
use std::process::Command;

fn main() {
let mut wlx_build = get_version().unwrap_or(format!("{} (Cargo)", env!("CARGO_PKG_VERSION")));

if std::env::var("GITHUB_ACTIONS").is_ok() {
wlx_build = format!("{} (AppImage)", &wlx_build)
}

println!("cargo:rustc-env=WLX_BUILD={}", &wlx_build);
}

fn get_version() -> Result<String, Box<dyn std::error::Error>> {
let re = Regex::new(r"v([0-9.]+)-([0-9]+)-g([a-f0-9]+)").unwrap(); // safe
let output = Command::new("git")
.args(["describe", "--tags", "--abbrev=7"])
.output()?;

let output_str = String::from_utf8(output.stdout)?;

Ok(re.replace_all(&output_str, "${1}.r${2}.${3}").into_owned())
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
log::info!(
"Welcome to {} version {}!",
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION")
env!("WLX_BUILD"),
);
log::info!("It is {}.", chrono::Local::now().format("%c"));

Expand Down

0 comments on commit d9287f3

Please sign in to comment.