Open rbtcollins opened 11 months ago
bazel clean
solved this issue for me
bazel clean
solved this issue for me
Same. The question is, why?
Setting RUST_LOG=info got me some debug (and clean doesn't solve it for me).
INFO: Running command line: bazel-bin/external/rules_rust~/tools/rust_analyzer/gen_rust_project
"/home/robertc/.cache/bazel/_bazel_robertc/8b0aece0fa823e87b78e3a123965ccb1/execroot/_main/bazel-out/linux_amd64-opt-exec-ST-b021421c07d4/bin/external/_main~crate_repositories~crates_vendor__crunchy-0.2.2/crunchy.rust_analyzer_crate_spec.json"
[2024-06-21T06:09:44Z WARN gen_rust_project_lib::aquery] Skipping missing crate_spec file: "/home/robertc/.cache/bazel/_bazel_robertc/8b0aece0fa823e87b78e3a123965ccb1/execroot/_main/bazel-out/linux_amd64-opt-exec-ST-b021421c07d4/bin/external/_main~crate_repositories~crates_vendor__dirs-sys-next-0.1.2/dirs_sys_next.rust_analyzer_crate_spec.json"
[2024-06-21T06:09:45Z WARN gen_rust_project_lib::rust_project] Cycle detected: ["ID-services/turbofish/gandalf-auth/src/lib.rs", "ID-services/turbofish/gandalf-buildinfo/src/lib.rs", "ID-services/turbofish/gandalf-core/src/lib.rs", "ID-services/turbofish/gandalf-metrics/src/lib.rs", "ID-services/turbofish/gandalf-test-utils/src/lib.rs", "ID-services/turbofish/gandalf-core/src/lib.rs"]
[2024-06-21T06:09:45Z WARN gen_rust_project_lib::rust_project] Cycle detected: ["ID-services/turbofish/gandalf-buildinfo/src/lib.rs", "ID-services/turbofish/gandalf-core/src/lib.rs", "ID-services/turbofish/gandalf-metrics/src/lib.rs", "ID-services/turbofish/gandalf-test-utils/src/lib.rs", "ID-services/turbofish/gandalf-core/src/lib.rs"]
This repo builds cleanly with both native rust tools and Bazel; the cycle is not a cycle once dep type is considered.
foo-core[dev] <- foo-test-utils <- foo-core foo-metrics[dev] <- foo-test-utils <- foo-core
so the build builds foo-core, then foo-test-utils, then foo-core[dev] which picks up the tests and runs them
Not ideal, first to admit that, but it explains the failure here.
In rust-analyzer, the cycle is logged as well:
2024-06-20T13:20:07.346042Z ERROR project_model::workspace: cyclic deps: gandalf_metrics(Idx::<CrateData>(131)) -> gandalf_test_utils(Idx::<CrateData>(133)), alternative path: gandalf_test_utils(Idx::<CrateData>(133)) -> gandalf_core(Idx::<CrateData>(124)) -> gandalf_metrics(Idx::<CrateData>(131))
It would be nice to at least show more of the error than this one-line opaque message.
In Vs Code, Toggle Rust Analyzer in the output tab. And you will see all the cyclic dependencies warning
I'd put more here but I haven't tried to figure this out yet (fortunately we keep the Cargo toolchain working, so Bazel is a CI optimisation, not a core developer requirement)