-
Notifications
You must be signed in to change notification settings - Fork 699
cli: lazily emit cargo:rerun-if-changed to avoid spurious rebuilds #7273
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: main
Are you sure you want to change the base?
Conversation
Hmm test suite passed for me on the initial run, but now that I have this merged into another branch I see the
|
Maybe another option to hardcoding |
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.
cc @thoughtpolice as I have no expertise on the nix part.
7d7a4c9
to
fd5daa0
Compare
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.
The changes in build.rs
look good. I can't review the nix change, so I'll leave it to someone else.
fd5daa0
to
396fd95
Compare
Maybe @thoughtpolice or @emilazy can help? |
@@ -201,7 +201,10 @@ | |||
pkgs.mkShell { | |||
name = "jujutsu"; | |||
packages = packages ++ nativeBuildInputs ++ buildInputs ++ nativeCheckInputs; | |||
inherit env shellHook; | |||
env = env // { | |||
NIX_JJ_GIT_HASH = self.rev or "dirty"; |
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.
This looks weird to me - but only because for the package there is
env =
env
// {
RUSTFLAGS = pkgs.lib.optionalString pkgs.stdenv.isLinux "-C link-arg=-fuse-ld=mold";
NIX_JJ_GIT_HASH = self.rev or "";
};
on line 112
Is there any reason you set the default to "dirty"
here rather than remaining consistent with the existing code?
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.
Nevermind - realized you're filtering to make sure it's not empty in your get_git_hash_from_nix
function 🤦🏼♀️ - sorry for the noise
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.
in this case the nix side of things looks good to me, that was my only complaint :)
though I haven't tested it to see
The build script has a hierarchy of where the current git hash is detected from: check $NIX_JJ_GIT_HASH, if that fails, ask jj, if that fails, ask git. If the build script is satisfied from a query higher up the priority chain, there's no reason to instruct cargo to rereun and rebuild (and relink) everything: for example if $NIX_JJ_GIT_HASH is set, there's no need to check heads from either jj or git. Although the build script takes effort to specify `jj log --ignore-working-copy`, it would previously still get invalidated if jj performed a snapshot (even if $NIX_JJ_GIT_HASH was set). This can be fairly annoying when iterating on the test suite where each commit would rebuild the CLI and by extension all of its tests.
This effectively avoids churning the CLI build script every time a jj commit (or snapshot) is updated which can speed things up during development (especially when iterating on the test suite and not having to wait for the CLI and its tests to rebuild and relink)
396fd95
to
6052d9e
Compare
Ended up adding an allowance for version strings ending with a |
67310d1
to
10693ae
Compare
Checklist
If applicable:
CHANGELOG.md
README.md
,docs/
,demos/
)cli/src/config-schema.json
)