Skip to content

collect module imports of public modules#3187

Merged
Techatrix merged 1 commit intozigtools:masterfrom
iceghost:push-tvrrwlzvmloy
Apr 27, 2026
Merged

collect module imports of public modules#3187
Techatrix merged 1 commit intozigtools:masterfrom
iceghost:push-tvrrwlzvmloy

Conversation

@iceghost
Copy link
Copy Markdown
Contributor

Currently, zls only collects module imports of Step.Compile. For public modules, it only collect the root_modules, not their module imports.

This commit makes the build_runner also collects the module imports and also adds one regression test case when one does addOptions on a public module, which is my original motivation (and confusion why my @import("options") was not working).

The generated options.zig file is generated in the c/ instead of o/ namespace, so I also removed the namespace assertion. I assume the original assertion is only for reminding reader of what that component is, and not an actual useful property of the path, so I keep the intent as a comment.


Please let me know if this is the correct fix, or was there a reason b.modules are treated differently from Step.Compile.

Also, without the fix, the added test case with fail with:

getPath() was called on a GeneratedFile that wasn't built yet.
  source package path: /workspace/zls/tests/build_runner_cases
  Is there a missing Step dependency on step 'options'?

Currently, zls only collects module imports of Step.Compile. For
public modules, it only collect the root_modules, not their module
imports.

This commit makes the build_runner also collects the module imports
and also adds one regression test case when one does `addOptions` on a
public module, which is my original motivation (and confusion why
my @import("options") was not working).

The generated options.zig file is generated in the c/ instead of o/
namespace, so I also removed the namespace assertion. I assume the
original assertion is only for reminding reader of what that component
is, and not an actual useful property of the path, so I keep the intent
as a comment.
Copy link
Copy Markdown
Member

@Techatrix Techatrix left a comment

Choose a reason for hiding this comment

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

👍

@Techatrix Techatrix merged commit dc282df into zigtools:master Apr 27, 2026
7 checks passed
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