snapshot of https://github.com/ActivityWatch/aw-server-rust.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Build / ubuntu-latest (push) Failing after 5s
Build / Android (push) Failing after 2s
Build / Code coverage (push) Failing after 2s
Lint / format (push) Failing after 3s
Lint / clippy (push) Failing after 3s
Build / macOS-latest (push) Has been cancelled
Build / windows-latest (push) Has been cancelled
Some checks failed
Build / ubuntu-latest (push) Failing after 5s
Build / Android (push) Failing after 2s
Build / Code coverage (push) Failing after 2s
Lint / format (push) Failing after 3s
Lint / clippy (push) Failing after 3s
Build / macOS-latest (push) Has been cancelled
Build / windows-latest (push) Has been cancelled
This commit is contained in:
30
aw-server/build.rs
Normal file
30
aw-server/build.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use std::error::Error;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let webui_var = std::env::var("AW_WEBUI_DIR");
|
||||
let path = if let Ok(var_path) = &webui_var {
|
||||
std::path::Path::new(var_path)
|
||||
} else {
|
||||
let path = std::path::Path::new("../aw-webui/dist");
|
||||
// ensure folder exists, since macro requires it
|
||||
std::fs::create_dir_all(path)?;
|
||||
println!("cargo:rustc-env=AW_WEBUI_DIR={}", path.display());
|
||||
path
|
||||
};
|
||||
|
||||
let path_index = path.join("index.html");
|
||||
if !path_index.exists() {
|
||||
println!(
|
||||
"cargo:warning=`{}` is not built, compiling without webui",
|
||||
path.display()
|
||||
);
|
||||
}
|
||||
|
||||
// Rebuild if the webui directory changes
|
||||
println!("cargo:rerun-if-env-changed=AW_WEBUI_DIR");
|
||||
if let Ok(dir) = webui_var {
|
||||
println!("cargo:rerun-if-changed={dir}");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user