feat!: refactor ZigModuleInfo to have a single arg rendering path#504
Merged
aherrmann merged 8 commits intoaherrmann:mainfrom Sep 9, 2025
Merged
feat!: refactor ZigModuleInfo to have a single arg rendering path#504aherrmann merged 8 commits intoaherrmann:mainfrom
aherrmann merged 8 commits intoaherrmann:mainfrom
Conversation
aherrmann
reviewed
Sep 3, 2025
Owner
aherrmann
left a comment
There was a problem hiding this comment.
Thanks for contributing!
I like those diff stats (+198/-351)!
I notice a depset.to_list though, that should be avoided, see corresponding comment.
aherrmann
reviewed
Sep 4, 2025
And model main, srcs and extra_srcs as part of a ZigModuleInfo node. This will greatly improve upstreaming of zml/rules_zig since many further developments are based on this. It has the cool side effect of unifying how --dep and -M cli args are computed transitively from 1 single ZigModuleInfo root.
While using depsets and postorder ordering, I realized that _mock_args implementation was different than ctx.actions.args especially in the case where depsets are using postorder. In this commit, I suggest removing the need for the mock and instead test zig_module_specifications with the real implementation of ctx.actions.args using custom rules and a diff_test. This guarantees that we are testing the exact same order of args as they will appear in the command line when ctx.actions.run is performed.
Otherwise the names are quite generic and can collide or be confused with other test suite names.
a6b1a83 to
93101c0
Compare
auto-merge was automatically disabled
September 9, 2025 10:52
Head branch was pushed to by a user without write access
aherrmann
approved these changes
Sep 9, 2025
Owner
aherrmann
left a comment
There was a problem hiding this comment.
Thank you again for upstreaming this!
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.
Part of #480
This PR refactors
ZigModuleInfoso that --dep and -M cli args are computed transitively from 1 single ZigModuleInfo root.While doing this, I found that the _mock_args implementation was not compliant with the actual
ctx.actions.argsimplementation, especially when usingdepset.I took the opportunity to rewrite those tests using custom rules and
diff_testso that we are sure that what we test is actually what is going to end up in the action run.BREAKING_CHANGE:
transitive_argsandtransitive_inputsfields removed fromZigModuleInfo.