nix-community / crate2nix

rebuild only changed crates in CI with crate2nix and nix
https://nix-community.github.io/crate2nix/
Apache License 2.0
354 stars 83 forks source link

Support package renaming inside dev-dependencies #224

Closed Fuuzetsu closed 2 years ago

Fuuzetsu commented 2 years ago

It already works for dependencies and build-dependencies, just seems like an oversight.

I ran cargo test, seems to pass.

Fixes #223.

Ericson2314 commented 2 years ago

Thanks!

Would you mind adding a test?

Fuuzetsu commented 2 years ago

I'm not sure how. I changed sample_projects/renamed_build_deps/Cargo.toml to include something like

diff --git a/sample_projects/renamed_build_deps/Cargo.toml b/sample_projects/renamed_build_deps/Cargo.toml
index 8c26807..e49ffa7 100644
--- a/sample_projects/renamed_build_deps/Cargo.toml
+++ b/sample_projects/renamed_build_deps/Cargo.toml
@@ -10,3 +10,7 @@ edition = "2018"

 [build-dependencies]
 which_crate = {package = "which", version = "3.0", default-features = false}
+
+# Checks that renames in dev-dependencies work.
+[dev-dependencies]
+futures01 = { package = "futures", version = "0.1", default-features = false }

I ran cargo check to update the lock file and then I ran ./run_tests.sh. It just told me that everything looks OK except uncommitted changes. Cargo.nix doesn't seem updated there. Running ./regenerate_cargo_nix.sh explicitly doesn't seem to help either.

Any suggestion? Or if it's faster for you to add one, feel free...

Ericson2314 commented 2 years ago

It took some digging, but the file that confusingly wasn't changing is just dead code! https://github.com/kolloch/crate2nix/pull/245

Ericson2314 commented 2 years ago

I am making the tests needed, so don't worry about it :)