-
Notifications
You must be signed in to change notification settings - Fork 8
feat!: refactor ZigModuleInfo to have a single arg rendering path #504
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
Conversation
aherrmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing!
I like those diff stats (+198/-351)!
I notice a depset.to_list though, that should be avoided, see corresponding comment.
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
Head branch was pushed to by a user without write access
aherrmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you again for upstreaming this!
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.