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

CMake: Streamline rebuilds #25440

Merged
merged 4 commits into from
Nov 24, 2024
Merged

Conversation

implicitfield
Copy link
Contributor

@implicitfield implicitfield commented Nov 20, 2024

Currently, performing a rebuild (without doing any actual changes) looks like this:

$ cd Build/x86_64clang && ninja
[0/2] Re-checking globbed directories...
[2/2] Linking CXX executable Kernel/Prekernel/kernel_x86-64

We can definitely do better than that, and with this PR we get:

$ cd Build/x86_64clang && ninja
ninja: no work to do.

Note that the fourth commit in this PR also fixes running Shell tests on Lagom, which haven't ran since they were moved in d46be35, as the glob that was used for finding the tests was never updated.

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Nov 20, 2024
This is in preparation for installing LibC headers into the sysroot as
symlinks rather than as plain copies.
This removes the need to have the install_libc_headers target, since
LibC's headers will now get installed before anything gets built. By
extension, this also prevents said target from re-running on every
build.
This rule hasn't actually generated a `Prekernel` file since d068af8,
so this wasn't doing anything other than causing this target to be
re-ran all the time.
This also makes the Shell tests run on Lagom again, as they have been
silently skipped ever since d46be35 (which moved the tests but didn't
update the glob.)
@nico
Copy link
Contributor

nico commented Nov 20, 2024

@ADKaster Want to take a look?

@nico
Copy link
Contributor

nico commented Nov 22, 2024

I love the effect of this PR!

Commits 2 and 3 are obviously correct.

Commit 1 might be correct, but it's the kind of thing that might subtly break. It relies on build tools following symlinks when deciding if the build is dirty. Ninja does do that as far as I know, but there was also a patch to teach it to stop doing it (which didn't land – see ninja-build/ninja#1186 and in particular ninja-build/ninja#1188 (comment)). So maybe that commit should be in a separate PR since it feels more risky?

But I suppose we can also merge this and then undo the first commit if something does indeed break. I'll let this sit for another day or two in case @ADKaster (or someone else wants to commit). (I'd merge commits 2 and 3 immediately.)

@implicitfield
Copy link
Contributor Author

Good point re the symlinks. I guess we could use hardlinks instead, which might play a bit more predictably with build tools, but the main disadvantage with that is that hardlinks can't really cross filesystem boundaries, so having the Build folder in something like tmpfs wouldn't work anymore.

@nico nico merged commit c98071d into SerenityOS:master Nov 24, 2024
13 checks passed
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Nov 24, 2024
@ADKaster
Copy link
Member

Meant to comment on this after I had a glance a few days ago. No big comments to me, other than symlinks feeling a bit fragile. but less globs (or no globs at all) is a happy place to be

@implicitfield implicitfield deleted the cmake-cleanup branch November 24, 2024 15:32
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.

3 participants