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

Do not rebuild when no files changed #194

Merged
merged 1 commit into from
Nov 26, 2021

Conversation

blyxxyz
Copy link
Collaborator

@blyxxyz blyxxyz commented Nov 16, 2021

We were asking cargo to rebuild if assets/xhs or assets/xhs.1.gz changed. Those are dead symlinks, so cargo always errors and assumes they changed.

That caused a lot of unnecessary rebuilds. I found the problem by running with CARGO_LOG=cargo::core::compiler::fingerprint=info.

Asking cargo to watch only the files we actually care about fixes it.

We were asking cargo to rebuild if assets/xhs or assets/xhs.1.gz
changed. Those are dead symlinks, so cargo always errors and
[assumes they changed]
(https://github.com/rust-lang/cargo/blob/e475fe4a1780dafb771b39cddf8097ec206b0028/src/cargo/core/compiler/fingerprint.rs#L1733).

That caused a lot of unnecessary rebuilds. I found the problem by
running with `CARGO_LOG=cargo::core::compiler::fingerprint=info`.

Asking cargo to watch only the files we actually care about fixes it.
@ducaale
Copy link
Owner

ducaale commented Nov 17, 2021

How often XH_FEATURES will be updated with this change?

PS: I will not have access to my computer for more than a week. Until then, I won't be able to properly review your PRs 😔.

@blyxxyz
Copy link
Collaborator Author

blyxxyz commented Nov 17, 2021

How often XH_FEATURES will be updated with this change?

It keeps working, I think cargo keeps track of each set of features separately.

PS: I will not have access to my computer for more than a week. Until then, I won't be able to properly review your PRs 😔.

Thank you for the heads-up!

Copy link
Owner

@ducaale ducaale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since XH_FEATURES is updated in build.rs which should only be rerun whenever a change in syntax files is detected, I was worried about the possibility of XH_FEATURES ending up with a stale value. But it turns out cargo will always execute build.rs whenever a different set of features is passed to it (verified it by printing inside build.rs and using cargo's -vv flag).

$ cargo run -- --version
   Compiling xh v0.14.0 (/home/ducaale/xh)
    Finished dev [unoptimized + debuginfo] target(s) in 25.03s
     Running `target/debug/xh --version`
xh 0.14.0
-native-tls
$ cargo run --features=native-tls -- --version
   Compiling xh v0.14.0 (/home/ducaale/xh)
    Finished dev [unoptimized + debuginfo] target(s) in 25.39s
     Running `target/debug/xh --version`
xh 0.14.0
+native-tls

Approved!

@ducaale ducaale merged commit f822100 into ducaale:develop Nov 26, 2021
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

Successfully merging this pull request may close these issues.

2 participants