-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
49 lines (45 loc) · 1.29 KB
/
build.rs
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
39
40
41
42
43
44
45
46
47
48
49
extern crate anyhow;
extern crate sqlite;
#[path = "runners/add_runners.rs"]
mod add_runners;
use add_runners::{
Runners,
Shell::{Bash, Nushell, Powershell, Zsh},
};
#[path = "src/metadata.rs"]
mod metadata;
use metadata::Environment;
fn main() {
let env = Environment::new();
let script_dir = env
.config_path
.parent()
.expect("Unable to find config dir")
.join("scripts");
println!("Building Bunnyhop version {}", env!("CARGO_PKG_VERSION"));
for script in [
"src/add_runners.rs",
"src/runners/runner.ps1",
"src/runners/runner.sh",
"src/runners/runner.nu",
]
.iter()
{
println!("cargo:rerun-if-changed=runners/{}", script);
}
for env_var in [
"BHOP_ZSH_CONFIG_DIR",
"BHOP_BASH_CONFIG_DIR",
"BHOP_NUSHELL_CONFIG_DIR",
"BHOP_POWERSHELL_CONFIG_DIR",
]
.iter()
{
println!("cargo:rerun-if-env-changed={}", env_var);
}
// Any new shells added in the future must be added in the following vector to be properly
// configured with their respective runner script when `Bunnyhop` is built.
let supported_shells = vec![Zsh, Bash, Nushell, Powershell];
let runners = Runners::new(supported_shells, script_dir);
runners.add_runners();
}