feat: support forwarding options#9
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the build runner to preserve user-supplied dependency arguments while automatically filling in missing target and optimize defaults. It also adds validation for the optimize field in module definitions and introduces test fixtures for these scenarios. The review feedback suggests improving compile-time safety by validating the type of the optimize parameter in validateOptimize to prevent cryptic compiler errors. Additionally, it recommends using std.Build.ResolvedTarget instead of std.Target.Query when forwarding the parent's target to maintain consistency and avoid unnecessary target re-resolution.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (!has_target) { | ||
| names[i] = "target"; | ||
| types[i] = std.Target.Query; | ||
| attrs[i] = .{}; | ||
| i += 1; | ||
| } |
There was a problem hiding this comment.
To ensure consistency with the default dependency configuration (which passes std.Build.ResolvedTarget directly) and to avoid unnecessary target re-resolution in the child dependency, we should use std.Build.ResolvedTarget instead of std.Target.Query when forwarding the parent's target.
if (!has_target) {
names[i] = "target";
types[i] = std.Build.ResolvedTarget;
attrs[i] = .{};
i += 1;
}
There was a problem hiding this comment.
in this case ResolvedTarget contains Target.Query, which is the native target, it's probably more correct to rely on that instead.
| result.optimize = optimize_parent; | ||
| } | ||
|
|
||
| if (!@hasField(Args, "target")) result.target = target_parent.query; |
There was a problem hiding this comment.
see above for reason to reject ResolvedTarget
4a42fdf to
53a7d95
Compare
zbuild does not support partial arguments. For example, we would not be able to pass only `optimize` and expect the dependency to be built with the parent's `target`, which broke building `lodestar-z` since we were building with `portable=true` and `optimize=.ReleaseFast`. This PR adds that support
99d6525 to
5acb055
Compare
5acb055 to
6f6337b
Compare
zbuild does not support partial arguments. For example, we would not be able to pass only
optimizeand expect the dependency to be built with the parent'starget, which broke buildinglodestar-zsince we were building withportable=trueandoptimize=.ReleaseFast.This PR adds that support