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

Provide a configuration option to use incremental compilation for build-on-save #2001

Open
mlugg opened this issue Aug 17, 2024 · 3 comments · May be fixed by #2096
Open

Provide a configuration option to use incremental compilation for build-on-save #2001

mlugg opened this issue Aug 17, 2024 · 3 comments · May be fixed by #2096
Labels
enhancement New feature or request

Comments

@mlugg
Copy link
Contributor

mlugg commented Aug 17, 2024

After ziglang/zig#21063 is merged, the Zig compiler is able to perform certain incremental updates correctly. There's still a ways to go before it's generally usable, but -fno-emit-bin builds will be the first thing to work correctly, and some do under that PR. For instance, simple incremental updates to the compiler itself typically do the right thing now.

In the future, incremental compilation will be able to help the Zig compiler expose detailed semantic information to ZLS or a similar project (ziglang/zig#615). However, ZLS can still make good use of incremental compilation before upstream progress is made there.

If ZLS' build runner introduces support for std.Build.Watch like the standard build runner does, which should be a relatively straightforward enhancement, it can begin using incremental compilation for build-on-save. (Incremental compilation currently only works if the compiler process stays running via the compiler server protocol: serialization and deserialization of compiler state to disk is a WIP feature.)

This functionality should be behind a config option which can be disabled by default. It's definitely possible to crash the compiler right now, or even to get false positive compile errors; incremental compilation is not stable, even when not emitting a binary. When we are emitting a binary, it'll basically crash immediately, so this will currently only work if the user is providing via build_on_save_step the name of a step which will pass -fno-emit-bin to the compiler. Nevertheless, it might be valuable to expose this as an option for people to try out.

@mlugg mlugg added the enhancement New feature or request label Aug 17, 2024
@andrewrk
Copy link

andrewrk commented Aug 18, 2024

What component are you talking about enhancing? The build system already has -fincremental and --watch which can be combined together.

@andrewrk
Copy link

Oh, man I was really confused for a moment there. I thought I was commenting on the zig issue tracker. Sorry!

@Techatrix
Copy link
Member

@andrewrk Welcome to ZLS, happy to have you back! 🎉
We have missed you here since your last visit in 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants