-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(build-dir): Reorganize build-dir layout #15947
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
9121077
0c143b1
0b81b44
8603e30
c849440
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -403,7 +403,7 @@ impl<'a, 'gctx> BuildRunner<'a, 'gctx> { | |
.insert(kind, layout.dest().to_path_buf()); | ||
self.compilation | ||
.deps_output | ||
.insert(kind, layout.deps().to_path_buf()); | ||
.insert(kind, layout.legacy_deps().to_path_buf()); | ||
|
||
} | ||
Ok(()) | ||
} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So while this reduces the "max content per directory" (since Should we change from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Could we expand a bit more on the benefit of the proposed change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There can be performance issues on Windows when a directory has a lot of content. We do this prefix-directory stuff for the index and for the build-dir workspace hash. This would be extending it to the build units within the package dir. As Ross brought up, we don't have guidance on how big is big, what the growth will look like, etc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we share this layout with the shared cache, then it will likely be more important. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I spent some time getting up to speed on Windows path issues. (goodness, its a deep rabbit hole) As far as I can tell the main issue is Windows has much more restrictive path length than linux. (see #9770) That said I also found an article that claims a flat structure is better on ext4 for linux. Given the long paths issue on windows, perhaps it would be better to shorten names to help mitigate this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell, these are separate conversations, so I moved path lengths over to https://github.com/rust-lang/cargo/pull/15947/files#r2402207606 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. As for the original suggestion
I lean towards not splitting these up. It keeps things simple and its questionable if there is even a performance issue in the first place. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this is unspecified, we at least ahve the freedom to change it over time. I think we should at minimum do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that is a good idea 👍 The code for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made this change in the latest push. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,7 +232,11 @@ impl Layout { | |
&self.dest | ||
} | ||
/// Fetch the deps path. | ||
pub fn deps(&self) -> &Path { | ||
pub fn deps(&self, _pkg_dir: &str) -> PathBuf { | ||
|
||
self.deps.clone() | ||
} | ||
/// Fetch the deps path. (old layout) | ||
pub fn legacy_deps(&self) -> &Path { | ||
&self.deps | ||
} | ||
/// Fetch the examples path. | ||
|
@@ -256,13 +260,25 @@ impl Layout { | |
&self.incremental | ||
} | ||
/// Fetch the fingerprint path. | ||
pub fn fingerprint(&self) -> &Path { | ||
pub fn fingerprint(&self, pkg_dir: &str) -> PathBuf { | ||
self.fingerprint.join(pkg_dir) | ||
|
||
} | ||
/// Fetch the fingerprint path. (old layout) | ||
pub fn legacy_fingerprint(&self) -> &Path { | ||
&self.fingerprint | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we keep the legacy splits, I feel like this commit should have the existing functions delegate to the legacy ones. Then the follow up commit will call the legacy functions in the else branch. This would make the relationship more explicit and avoid questions like 8603e30#r2411571494 |
||
/// Fetch the build script path. | ||
/// Fetch the build path. | ||
pub fn build(&self) -> &Path { | ||
&self.build | ||
} | ||
/// Fetch the build script path. | ||
pub fn build_script(&self, pkg_dir: &str) -> PathBuf { | ||
epage marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.build().join(pkg_dir) | ||
} | ||
/// Fetch the build script execution path. | ||
pub fn build_script_execution(&self, pkg_dir: &str) -> PathBuf { | ||
self.build().join(pkg_dir) | ||
} | ||
/// Fetch the artifact path. | ||
pub fn artifact(&self) -> &Path { | ||
&self.artifact | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need a test for
cargo clean -p foo
. Haven't looked at how thats implemented but might at least be a reason forname/hash
rather thanname-hash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test for this in 0c143b1.
And good thing to because I silently broke that when I changed from
name-hash
toname/hash