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

chore: deps update to have zig 0.14 incremental working #148

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dxps
Copy link

@dxps dxps commented Jan 28, 2025

A small update on two (args and zmpl) dependencies to have zig build run --watch -fincremental working on a Jetzig based (minimal) sample, as per blog post 7, Optimization 2: Use Zig's incremental compilation section.

@dxps dxps changed the title Fix zig 0.14 incremental chore: deps update to have zig 0.14 incremental working Jan 28, 2025
@dxps
Copy link
Author

dxps commented Jan 28, 2025

Unfortunately, on the 2nd run of zig build run --watch -fincremental fails with FileBusy as shown below.
In this case, you have to clean zig cache (rm -rf .zig-cache) and run again.

❯ zig build run --watch -fincremental
warning: [zmpl] Templates path not found: `src/app/mailers` - skipping.
run
└─ run jetzig-sample
   └─ install
      └─ install jetzig-sample
         └─ zig build-exe jetzig-sample Debug native
            └─ run routes (routes.zig)
               └─ zig build-exe routes Debug native
                  └─ run manifest (zmpl.manifest.zig) stderr
[zmpl] Compiled 2 template(s)
run
└─ run jetzig-sample
   └─ install
      └─ install jetzig-sample
         └─ zig build-exe jetzig-sample Debug native
            └─ run routes (routes.zig) failure
error: failed to spawn and capture stdio from /home/dxps/dev/dxps_gh/zig_playground/jetzig_samples/jetzig-sample/.zig-cache/o/ecf07bb0a3768d44648e89b446e6c115/routes: FileBusy
Build Summary: 10/16 steps succeeded; 1 failed
run transitive failure
└─ run jetzig-sample transitive failure
   ├─ zig build-exe jetzig-sample Debug native transitive failure
   │  ├─ run routes (routes.zig) failure
   │  │  └─ zig build-exe routes Debug native success 2s
   │  │     └─ run manifest (zmpl.manifest.zig) success 5ms MaxRSS:3M
   │  │        └─ zig build-exe manifest Debug native success 805ms
   │  └─ run manifest (zmpl.manifest.zig) (+1 more reused dependencies)
   └─ install transitive failure
      └─ install jetzig-sample transitive failure
         └─ zig build-exe jetzig-sample Debug native (+8 more reused dependencies)
Watching 120 directories, 2 processes

However, it doesn't watch for file changes (as in the 2nd run that fails).

Now, if I use zig build --watch -fincremental (that builds and watch, as expected), how should I (re)start the Jetzig sample? I guess I could use another tool (like inotifywait) that watches the binary (./zig-out/bin...) file and run it.

@bobf
Copy link
Contributor

bobf commented Feb 1, 2025

@dxps Hi, thanks for your work on this.

Could you take a look at my branch here: https://github.com/jetzig-framework/jetzig/tree/no-llvm

I've been working on it for a while and it works with the demo app in the Jetzig repository (I implemented a basic process manager to kill the server and restart it - we can make this nicer later as Zig adds features to incremental compilation).

Problem is it does not work with (e.g.) the jetzig.dev website app so is not ready for merge yet, but I think/hope it is close. Any help on this is welcome so please feel free to submit fixes to my branch.

(You'll need to recompile/install the cli exe and run jetzig server to test it).

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