@@ -79,12 +79,8 @@ pub const RunProtocStep = struct {
7979 include_directories : []std.Build.LazyPath ,
8080 destination_directory : std.Build.LazyPath ,
8181 generator : * std.Build.Step.Compile ,
82- protoc_owner : * std.Build ,
83- /// Optional external protoc binary. When set, skips the built-in download
84- /// mechanism and uses this artifact's emitted binary instead. Useful for
85- /// consumers (e.g. conformance tests) that already have protoc from another
86- /// dependency.
87- protoc_override : ? * std.Build.Step.Compile = null ,
82+ generator_bin : std.Build.LazyPath ,
83+ protoc_override_bin : ? std.Build.LazyPath = null ,
8884 preserve_unknown_fields : bool = false ,
8985 verbose : bool = false ,
9086
@@ -98,9 +94,9 @@ pub const RunProtocStep = struct {
9894 /// protoc step can be owned by a consumer builder while the generator
9995 /// stays owned by the zig-protobuf dependency builder.
10096 generator : ? * std.Build.Step.Compile = null ,
101- /// Optional pre-built protoc artifact . When provided, overrides the
97+ /// Optional pre-built protoc binary . When provided, overrides the
10298 /// built-in protoc download mechanism.
103- protoc : ? * std.Build.Step.Compile = null ,
99+ protoc : ? std.Build.LazyPath = null ,
104100 /// When true, every generated message preserves unknown fields during
105101 /// binary decode/encode round trips. Defaults to false.
106102 preserve_unknown_fields : bool = false ,
@@ -128,13 +124,13 @@ pub const RunProtocStep = struct {
128124 .include_directories = dupeLazyPaths (owner , options .include_directories ),
129125 .destination_directory = options .destination_directory .dupe (owner ),
130126 .generator = generator ,
131- .protoc_owner = generator .step . owner ,
132- .protoc_override = options .protoc ,
127+ .generator_bin = generator .getEmittedBin () ,
128+ .protoc_override_bin = options .protoc ,
133129 .preserve_unknown_fields = options .preserve_unknown_fields ,
134130 };
135131
136132 self .step .dependOn (& self .generator .step );
137- if ( options . protoc ) | p | self . step . dependOn ( & p . step );
133+
138134 return self ;
139135 }
140136
@@ -166,17 +162,17 @@ pub const RunProtocStep = struct {
166162 { // run protoc
167163 var argv : std .ArrayList ([]const u8 ) = .empty ;
168164
169- const maybe_protoc_path : ? []const u8 = if (self .protoc_override ) | p |
170- p . getEmittedBin () .getPath2 (b , step )
165+ const maybe_protoc_path : ? []const u8 = if (self .protoc_override_bin ) | bin |
166+ bin .getPath2 (b , step )
171167 else
172- try ensureProtocBinaryDownloaded (self .protoc_owner , step );
168+ try ensureProtocBinaryDownloaded (self .generator . step . owner , step );
173169
174170 if (maybe_protoc_path ) | protoc_path | {
175171 try argv .append (b .allocator , protoc_path );
176172
177173 try argv .append (b .allocator , try std .mem .concat (b .allocator , u8 , &.{
178174 "--plugin=protoc-gen-zig=" ,
179- self .generator . getEmittedBin () .getPath2 (b , step ),
175+ self .generator_bin .getPath2 (b , step ),
180176 }));
181177
182178 const zig_out = if (self .preserve_unknown_fields )
0 commit comments