Skip to content

Commit

Permalink
Add compile_error! binary to powerpack crate
Browse files Browse the repository at this point in the history
This directs people to install the `powerpack-cli` crate if they try to
install `powerpack` as a binary.
  • Loading branch information
rossmacarthur committed Feb 17, 2024
1 parent 3f541ca commit ae1bf51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Clippy
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
run: cargo clippy --workspace --all-targets
run: cargo clippy --workspace --all-targets --all-features

- name: Test
run: cargo test --workspace
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ default = ["env"]
detach = ["dep:powerpack-detach"]
env = ["dep:powerpack-env"]

# Private API: Prevents the compile_error! for the powerpack binary
_internal_test = []

[profile.release]
strip = true
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#[cfg(not(feature = "_internal_test"))]
compile_error! {"you meant to install powerpack-cli: type `cargo install powerpack-cli`"}
fn main() {
eprintln!("you meant to install powerpack-cli: type `cargo install powerpack-cli`");
std::process::exit(1);
}

0 comments on commit ae1bf51

Please sign in to comment.