Don't leave root during bench-check.#24248
Conversation
There was a problem hiding this comment.
As far as I can tell, this bug originates from #12923, before which the cargo command was run from the benches/ directory.
The proper fix is to not specify the target directory at all. target is already the default, and specifying it as an argument here overwrites any custom target directory when run locally (e.g. I have my target directory on a different drive).
Thanks! Fixed. I also fixed incorrect paths in CompileFail comments. |
| // Macro Compile Fail Tests | ||
| // Run tests (they do not get executed with the workspace tests) | ||
| // - See crates/bevy_macros_compile_fail_tests/README.md | ||
| // - See crates/bevy_macros/compile_fail/README.md |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
So the CompileFail ci tests use a custom override (because they are independent crates) back to ./target. This should be completely fine 99% of the time and I don't think it's worth figuring out how to change but we could try to make sure any override applies to them as well as well. |
yeah #12923 lines up with what I dug up. fuller chain:
With this proposed fix the target will go to targets/benches, so it will fix the bug but it will compile for nothing again instead using the cached artifacts in ./target no ? Maybe there is a better fix that allows us to not override custom targets but still keep the original intent of not compiling artifacts again. |
I was very confused for a minute but you meant benches/target right? I just tried it and it didn't create a benches/target folder as well as getting compiled instantly. I would guess that specifying --manifect-path doesn't override --target-dir to match. |
really i thought workspace created their own sub folder in the target directory |
|
Yea but we're not using --package within a workspace we're literally overriding what project (workspace? is it a workspace with only one package?) we're using by changing the manifest path. |
|
I also changed the compile-fail tests to use the manifest-path as well. The result should mean that any root level override to the target should apply to all CI tests as they all invoke cargo at the root and don't manually override the target-dir. |
Oh my bad i think it was historically a separate workspace, now it's a member, the proposed changes look good for me. It fixes the bug, and allow custom override, the CLI should be faster as a consequence to. |
|
To clarify I don't think it matters if it's a member or if it's a separate workspace. I think cargo by default uses the target folder of the active directory (unless overridden). AFAIK the target folder is NOT part of a project/workspace. So if we run cargo from a certain directory and tell it to use the manifest of a completely different crate it should use the same target directory while using the manifest and src directories of the actual library. |
Have you tried this? Cargo defaults to using a target dir relative to the manifest. That's why you can call cargo from subdirectories without problem. Though
Could you also fix the |
…ompileFail CI." This reverts commit fcd2a37.
Good catch! To be clear I did test it and it was working... buuut... My previous explanation for why it was working was dead wrong. I made assumptions based on the API and my testing. That's my bad. Thanks for pointing it out and leading me to actually look it up. Turns out the entire things been overcomplicated. Any packages in a workspace automatically share build artefacts. The reason it was working was because cargo was smart enough to realize that. I've simplified the CI tests to just execute cargo with no --target-dir using the package name and confirmed that artefacts are being shared*. *Except the integration tests which are explicitly excluded from the workspace and which never shared artefacts in the first place. |
|
Thanks for helping me out SpecificProtagonist and OniriqueCherry! |
Error
During
$ cargo run -p ci -- compileSolution
Testing