Skip to content

Pass explicit module selection into generated Zig builds#2666

Merged
plajjan merged 1 commit intomainfrom
zig-mod-selection
Mar 1, 2026
Merged

Pass explicit module selection into generated Zig builds#2666
plajjan merged 1 commit intomainfrom
zig-mod-selection

Conversation

@plajjan
Copy link
Contributor

@plajjan plajjan commented Feb 28, 2026

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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@plajjan plajjan force-pushed the zig-mod-selection branch from 78a1070 to 0411c85 Compare March 1, 2026 09:29
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.
@plajjan plajjan force-pushed the zig-mod-selection branch from 0411c85 to 954a133 Compare March 1, 2026 11:09
@plajjan plajjan merged commit 0adcadf into main Mar 1, 2026
47 of 50 checks passed
@plajjan plajjan deleted the zig-mod-selection branch March 1, 2026 13:30
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.

1 participant