Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relative target-dirs cause spurious rebuilds #1694

Closed
metajack opened this issue Jun 8, 2015 · 2 comments
Closed

relative target-dirs cause spurious rebuilds #1694

metajack opened this issue Jun 8, 2015 · 2 comments

Comments

@metajack
Copy link

metajack commented Jun 8, 2015

If you have two packages in a repo and wish to use shared target dirs to avoid rebuilds, you might use relative target-dir specs (one in each package) to do this by setting them to ../target or something.

This causes cargo to rebuild everything, probably because it sees the two target dirs as `/path/to/package_a/../target" and "/path/to/package_b/../target".

Right now you can workaround this by using absolute paths through the CARGO_TARGET_DIR environment var.

@alexcrichton
Copy link
Member

After some investigation I've found this to be a dupe of #497

@alexcrichton
Copy link
Member

Hm actually, I'm going to swap these around, so I'm going to reopen this (but a fix will be posted very soon).

@alexcrichton alexcrichton reopened this Jun 8, 2015
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Jun 8, 2015
The method of creating package ids in Cargo means that all sub-crates of a main
repo have the same package id, which encodes the path it came from. This means
that if the "root crate" switches, the package id for all dependencies will
change, causing an alteration in package id hashes, causing recompiles.

This commit alters a few points of hashing to ensure that whenever a package is
being hashed for freshness the *source root* of the crate is used instead of the
root of the main crate. This cause the hashes to be consistent across compiles,
regardless of the root package.

Closes rust-lang#1694
bors added a commit that referenced this issue Jun 8, 2015
The method of creating package ids in Cargo means that all sub-crates of a main
repo have the same package id, which encodes the path it came from. This means
that if the "root crate" switches, the package id for all dependencies will
change, causing an alteration in package id hashes, causing recompiles.

This commit alters a few points of hashing to ensure that whenever a package is
being hashed for freshness the *source root* of the crate is used instead of the
root of the main crate. This cause the hashes to be consistent across compiles,
regardless of the root package.

Closes #1694
@bors bors closed this as completed in #1697 Jun 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants