-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
38 lines (34 loc) · 1.29 KB
/
build.rs
File metadata and controls
38 lines (34 loc) · 1.29 KB
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
33
34
35
36
37
38
#[cfg(windows)]
extern crate winres;
fn main() {
// Load .env file at build time
dotenv::dotenv().ok();
// Read GEMINI_API_KEY and make it available to env! macro
if let Ok(api_key) = std::env::var("GEMINI_API_KEY") {
let trimmed_key = api_key.trim();
if trimmed_key.is_empty() {
println!("cargo:warning=GEMINI_API_KEY is empty in .env file!");
println!("cargo:rustc-env=GEMINI_API_KEY=");
} else if trimmed_key.contains("your-actual-api-key-here")
|| trimmed_key.contains("placeholder")
{
println!("cargo:warning=GEMINI_API_KEY appears to be a placeholder value!");
println!("cargo:rustc-env=GEMINI_API_KEY={}", trimmed_key);
} else {
println!(
"cargo:warning=GEMINI_API_KEY loaded successfully (length: {})",
trimmed_key.len()
);
println!("cargo:rustc-env=GEMINI_API_KEY={}", trimmed_key);
}
} else {
println!("cargo:warning=GEMINI_API_KEY not found in .env file. Set it before building.");
println!("cargo:rustc-env=GEMINI_API_KEY=");
}
#[cfg(windows)]
{
let mut res = winres::WindowsResource::new();
res.set_icon("heart_inlineBG.ico");
res.compile().unwrap();
}
}