gdesmott / system-deps

Run pkg-config from declarative dependencies in Cargo.toml
Apache License 2.0
89 stars 21 forks source link

Recommend `cargo::rerun-if-changed=Cargo.toml` in examples? #102

Closed mondeja closed 2 months ago

mondeja commented 3 months ago

I've tested the library and seen that the build script does not fail if I rerun it after changing my system deps in Cargo.toml. So I added a cargo::rerun-if-changed command to the build script and now works as expected:

fn main() {
    println!("cargo::rerun-if-changed=Cargo.toml");
    system_deps::Config::new().probe().unwrap();
}

There is a reason for not documenting this? I now that two colons (cargo::) needs MSRV 1.77, is that the reason?

gdesmott commented 3 months ago
    println!("cargo::rerun-if-changed=Cargo.toml");

I didn't think about it, we should probably add in probe() actually. We already have plenty of cargo:rerun-if-env-changed= for example.

I now that two colons (cargo::) needs MSRV 1.77, is that the reason?

I didn't know that cargo: was deprecated and replaced by cargo::. But yeah, we'd like to not increase the MSRV if we don't have to.

According to https://doc.rust-lang.org/cargo/reference/build-scripts.html we can just keep using cargo: for now. So can you please check if "cargo:rerun-if-changed=Cargo.toml" works as well and if it does submit a patch outputing if from probe()?