Skip to content

Commit

Permalink
Merge pull request #10 from UnsafeOats/rust_build_refactor
Browse files Browse the repository at this point in the history
Refactored build process
  • Loading branch information
shaneish authored Feb 18, 2023
2 parents 2c3ca00 + f0418ae commit 407aa2d
Show file tree
Hide file tree
Showing 9 changed files with 423 additions and 71 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/target
/tests/test_resources
~
build.ds
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.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bhop"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
authors = ["Shane Stephenson <[email protected]>"]
readme = "README.md"
Expand All @@ -26,6 +26,10 @@ serial_test = "1.0.0"
tempdir = "0.3.7"
proceed = "0.1.0"

[build-dependencies]
dirs = "4.0.0"
anyhow = "1.0"

[[bin]]
name = "bhop"
path = "src/main.rs"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This iteration also includes many improvements over the very simple shell functi
### HOW TO INSTALL
Simply clone this repo and run `make` from the root repo directory.

Current install script that works on the most systems with the most shells requires a system install of `python3` and `cargo`.
Current install script that works on the most systems with the most shells requires a system install `cargo` (obvi, since it's a tool written in Rust).

If you currently don't have `rust` or `cargo` set up on your system, just run the following command before installing `bunnyhop`
```bash
Expand All @@ -39,7 +39,7 @@ Once `cargo` is installed, simply run the following to install `bunnyhop`:
```bash
git clone https://github.com/gnoat/hop.github
cd hop
make all
cargo build --release
```
The default runner alias set is `hp`, use this to call `bunnyhop` from the command line (unless you set a custom alias).

Expand Down
29 changes: 29 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#[path = "runners/add_runners.rs"]
mod add_runners;
use add_runners::{
Runners,
Shell::{Bash, Nushell, Powershell, Zsh},
};

fn main() {
println!("Building Bunnyhop version {}", env!("CARGO_PKG_VERSION"));
for script in ["add_runners.rs", "runner.ps1", "runner.sh", "runner.nu"].iter() {
println!("cargo:rerun-if-changed=runners/{}", script);
}
for env_var in [
"BUNNYHOP_ZSH_CONFIG_DIR",
"BUNNYHOP_BASH_CONFIG_DIR",
"BUNNYHOP_NUSHELL_CONFIG_DIR",
"BUNNYHOP_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);
runners.add_runners();
}
Loading

0 comments on commit 407aa2d

Please sign in to comment.