ithinuel / yaah

Yet Another AOC Helper
https://crates.io/crates/yaah
MIT License
2 stars 2 forks source link

Build fails if benchmarks disabled #1

Closed phord closed 2 years ago

phord commented 2 years ago

When I generate code with benchmarks disabled, I get errors from some of the macros.

cargo generate --git https://github.com/ithinuel/yaah-template.git
🤷   Project Name: aoc2021
🔧   Destination: /home/phord/git/mine/aoc2021 ...
🔧   project-name: aoc2021 ...
🔧   Generating template ...
🤷   What is your AOC session secret?: hunter2-lol
🤷   Which year is it? [default: 2022]: 2021
✔ 🤷   Want to enable benchmarks? · false
[ 1/10]   Done: .cargo/config.toml
[ 2/10]   Done: .cargo
[ 3/10]   Done: .gitignore
[ 4/10]   Done: Cargo.toml
[ 5/10]   Done: LICENSE-APACHE
[ 6/10]   Done: LICENSE-MIT
[ 7/10]   Done: README.md
[ 8/10]   Done: src/lib.rs
[ 9/10]   Done: src/main.rs
[10/10]   Done: src
🔧   Moving generated files into: `/home/phord/git/mine/aoc2021`...
💡   Initializing a fresh Git repository
✨   Done! New project created /home/phord/git/mine/aoc2021
git/mine(main)» cd aoc2021
git/mine/aoc2021(main)» cargo run
  Updating crates.io index
  Compiling autocfg v1.1.0
    :
  Compiling reqwest v0.11.13
  Compiling yaah v0.2.1
  Compiling aoc2021 v0.1.0 (/home/phord/git/mine/aoc2021)
error[E0433]: failed to resolve: use of undeclared crate or module `criterion`
--> src/main.rs:1:1
  |
1 | yaah::aoc_main! { aoc2021 }
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `criterion`
  |
  = note: this error originates in the macro `yaah::aoc_main` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0425]: cannot find value `BENCHES` in crate `aoc2021`
--> src/main.rs:1:1
  |
1 | yaah::aoc_main! { aoc2022 }
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `aoc2021`
  |
  = note: this error originates in the macro `yaah::aoc_main` (in Nightly builds, run with -Z macro-backtrace for more info)

Some errors have detailed explanations: E0425, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `aoc2021` due to 2 previous errors
ithinuel commented 2 years ago

Oh indeed I didn't think about that. Thank you for reporting this!

ithinuel commented 2 years ago

This should now be fixed in 0.2.2.

I removed the calls to the bench from main since we already have that through cargo bench anyways.

phord commented 2 years ago

Confirmed. Thanks.