You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To run the build script, cargo needs to resolve dependencies first, so if the target/patch/{PACKAGE} directory pointed to in the [patch.crates-io] section isn't existing and populated, cargo will fail to do pretty much anything. You can run cargo patch once to get that directory, and any changes to the patches will (presumably) be applied on subsequent builds. But this requires everyone who first clones a repository for a project that uses this to install and run this command, as well as rerun the command any time they cargo clean. Which sucks, and almost defeats the purpose of using the build script.
There is no real way to fix this. The best way to work around it is to use cargo-make in conjunction with this program, adding a task to run rust code before building that invokes cargo_patch::patch().
I'd suggest updating the readme to warn against this issue and recommend the use of cargo-make, or just replace the build.rs method with the cargo-make method.
The text was updated successfully, but these errors were encountered:
Actually, the cargo-xtask pattern, using the run --manifest-path ./xtask/Cargo.toml -- method, may be a better option than cargo-make since it doesn't need any extra installed binaries to work. You could conceivably write your xtask to run different commands for you, after patching your program (maybe forwarding the output to your terminal so you can see it?), though I'm not quite sure what the optimal workflow would look like here.
One downside in comparison to cargo-make is that you need a whole extra subdirectory for the xtask, which also has its own target directory. Kinda clutter-y.
To run the build script, cargo needs to resolve dependencies first, so if the
target/patch/{PACKAGE}
directory pointed to in the[patch.crates-io]
section isn't existing and populated, cargo will fail to do pretty much anything. You can runcargo patch
once to get that directory, and any changes to the patches will (presumably) be applied on subsequent builds. But this requires everyone who first clones a repository for a project that uses this to install and run this command, as well as rerun the command any time theycargo clean
. Which sucks, and almost defeats the purpose of using the build script.There is no real way to fix this. The best way to work around it is to use
cargo-make
in conjunction with this program, adding a task to run rust code before building that invokescargo_patch::patch()
.I'd suggest updating the readme to warn against this issue and recommend the use of
cargo-make
, or just replace thebuild.rs
method with thecargo-make
method.The text was updated successfully, but these errors were encountered: