The way of Cargo fingerprint calculation

Recently, I am trying to build compile cache on CI. The layout of our project is a virtual worksapce with multiple members. It is wierd that running cargo build -p xxx after cargo build --workspace doesn't use compile cache. After checking the fingerprints under the target direcgtory, I found that the same member with different fingerprint file. I'm curious how cargo calculating the fingerprint of a package member? Thanks.

You can find documentation here:

Thanks for reply, I have read the doc already, but my problem hasn't been solved completely, because -p and --workspace won't change mtime and dep_info but fingerprint changed, am i missing anything?

The same crate will get multiple builds if you have multiple targets, for example a build script, or both a lib and bin, or multiple crate types?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.