sagiegurari / cargo-make

Rust task runner and build tool.
https://sagiegurari.github.io/cargo-make/
Apache License 2.0
2.56k stars 125 forks source link

`watch` fails on Windows #1099

Closed pepperoni505 closed 2 months ago

pepperoni505 commented 3 months ago

Describe The Bug

Adding watch to a task causes the task to fail. There is an issue on the cargo-watch repo that mentions a solution to this, which is to install with the --locked flag. Per the documentation, I have tried adding CARGO_MAKE_CRATE_INSTALLATION_LOCKED = "true" to my env section but that didn't seem to get it to add the locked flag

To Reproduce

Use the Makefile.toml sample provided below

Error Stack

error[E0308]: mismatched types
   --> C:\Users\jack\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-4.0.17\src\windows.rs:276:29
    |
276 |         overlapped.hEvent = request_p;
    |         -----------------   ^^^^^^^^^ expected `winapi::ctypes::c_void`, found `libc::c_void`
    |         |
    |         expected due to the type of this binding
    |
    = note: `libc::c_void` and `winapi::ctypes::c_void` have similar names, but are actually distinct types

Code Sample

[tasks.sample_task]
script_runner = "@duckscript"
script = '''
from = get_env PACKAGE_DIR
to = get_env OUTPUT_DIR
glob_cp ${from}/**/* ${to}
'''
watch = { watch = ["$PACKAGE_DIR"] }
private = true
sagiegurari commented 3 months ago

ok so to solve that using the locked workaround, need to change the runner.rs which installs cargo watch in the first place. dependencies :( a workaround is that you install cargo watch yourself and than cargo-make will use that installation automatically (should work)

pepperoni505 commented 3 months ago

That worked. Thank you!