Pass explicit module selection into generated Zig builds#2666
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78a1070473
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
78a1070 to
0411c85
Compare
A recent CI failure came from stale C artifacts in dependency out/types being picked up by build.zig filesystem discovery. In the failing shape, the root project overrode a transitive path dependency and the dependency builder still compiled stale modules that were not part of the selected compile tasks, triggering downstream C compilation errors. This change removes discovery-based selection from the generated builder and makes module/root selection explicit. The compiler passes selected module and root-stub paths into Zig and injects dependency module selections into generated b.dependency calls so dependency builders compile only the intended objects. Selection is now dependency-complete for incremental and watch builds: module lists are expanded with provider closure so unchanged imported providers are still included in link inputs. Dependency module selections are now scoped per consuming project and dependency name, avoiding cross-project collisions when different projects resolve the same dependency name to different roots. The builder template now requires explicit acton_modules and acton_root_stubs options, parses those lists, and compiles only what was selected. Old out/types walking logic and the now-redundant only_lib path were removed, and executable linking is gated on explicit root stubs. Makefile now makes dist/bin/acton depend on dist/builder so rebuilt compiler binaries always carry synchronized builder templates. A regression test was added to cover stale out/types artifacts in path dependencies with transitive overrides.
0411c85 to
954a133
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A recent CI failure came from stale C artifacts in dependency out/types being picked up by build.zig filesystem discovery. In the failing shape, the root project overrode a transitive path dependency and the dependency builder still compiled stale modules that were not part of the selected compile tasks, triggering downstream C compilation errors.
This change removes discovery-based selection from the generated builder and makes module/root selection explicit. The compiler now computes selected C module paths from needed tasks, passes them to the root zig invocation as -Dacton_modules and -Dacton_root_stubs, and injects matching acton_modules options into b.dependency(...) calls for package dependencies. Dependency invocations intentionally pass empty root stubs so only library objects are built for deps.
The builder template now requires explicit acton_modules and acton_root_stubs options, parses those lists, and compiles only what was selected. Old out/types walking logic and the now-redundant only_lib path were removed, and executable linking is gated on explicit root stubs.
Makefile now makes dist/bin/acton depend on dist/builder so rebuilt compiler binaries always carry synchronized builder templates. A regression test was added to cover stale out/types artifacts in path dependencies with transitive overrides, and it passes with this wiring.