SpriteOvO/spdlog-rs

[Bug Report] Unnecessary recompiling spdlog-rs

Jgfrausing opened this issue · 4 comments

Describe the bug

Running cargo build back to back compiles spdlog-rs on both iterations.

To Reproduce

Steps to reproduce the behavior:

  1. cargo init spdlog-mwe && cd spdlog-mwe && cargo add spdlog-rs

  2. echo "first build" && cargo build && echo "second build" && cargo build

Expected behavior

The first build should download and compile all dependencies. The second build should finish without compiling anything.

Environments

  • OS: Microsoft Windows 11 Business
  • Version: 10.0.22621 N/A Build 22621

Additional context

Running >cargo build --verbose shows that target\debug\build\spdlog-rs-29fb83146f549d72\out\test_utils\common_for_doc_test.rs is dirty.

Dirty spdlog-rs v0.3.11: the file `target\debug\build\spdlog-rs-29fb83146f549d72\out\test_utils\common_for_doc_test.rs` has changed (13341485574.813412900s, 42805400ns after last build at 13341485574.770607500s)

Additionally, has the spdlog-rs{id}/output fil the following lines, which is causing the rebuild.

cargo:rerun-if-changed=<local-path>\target\debug\build\spdlog-rs-29fb83146f549d72\out\test_utils\common_for_doc_test.rs
cargo:rerun-if-changed=<local-path>\target\debug\build\spdlog-rs-29fb83146f549d72\out\test_utils\common_for_integration_test.rs
cargo:rerun-if-changed=<local-path>\target\debug\build\spdlog-rs-29fb83146f549d72\out\test_utils\common_for_unit_test.rs

Thanks for your report! I have opened a PR #41 to fix the bug.

Released in v0.3.12.

@SpriteOvO that is awesome. Thanks for the fast fix. I will check it out. ✨

It is indeed working:

first build
  Downloaded spdlog-rs v0.3.12
  Downloaded 1 crate (92.7 KB) in 1.45s
   Compiling proc-macro2 v1.0.69
   Compiling autocfg v1.1.0
   Compiling unicode-ident v1.0.12
   Compiling windows_x86_64_msvc v0.48.5
   Compiling semver v1.0.20
   Compiling syn v1.0.109
   Compiling scopeguard v1.2.0
   Compiling winapi v0.3.9
   Compiling memchr v2.6.4
   Compiling thiserror v1.0.49
   Compiling minimal-lexical v0.2.1
   Compiling if_chain v1.0.2
   Compiling arc-swap v1.6.0
   Compiling once_cell v1.18.0
   Compiling cfg-if v1.0.0
   Compiling atomic v0.5.3
   Compiling static_assertions v1.1.0
   Compiling num-traits v0.2.17
   Compiling lock_api v0.4.10
   Compiling nom v7.1.3
   Compiling windows-targets v0.48.5
   Compiling windows-sys v0.48.0
   Compiling spin v0.9.8
   Compiling rustc_version v0.4.0
   Compiling quote v1.0.33
   Compiling spdlog-rs v0.3.12
   Compiling syn v2.0.38
   Compiling chrono v0.4.31
   Compiling is-terminal v0.4.9
   Compiling thiserror-impl v1.0.49
   Compiling spdlog-macros v0.1.0
   Compiling spdlog-mwe v0.1.0 (C:\Users\JonatanGrothFrausing\code\rusty\spdlog-mwe)
    Finished dev [unoptimized + debuginfo] target(s) in 9.29s
second build
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s