@@ -121,14 +121,17 @@ end
121
121
# Defining a local protoc to avoid issues with ProtoBuf.protoc,
122
122
# wherein it was using the form `protoc_jll.protoc() do .. end`
123
123
# which is now deprecated and is causing errors in code generation.
124
- function grpc_protoc (args= ` ` )
124
+ function grpc_protoc (args= ` ` ; protoc_path = ProtoBuf . protoc_jll . protoc () )
125
125
plugin_dir = abspath (joinpath (dirname (pathof (ProtoBuf)), " .." , " plugin" ))
126
126
plugin = joinpath (plugin_dir, Sys. iswindows () ? " protoc-gen-julia_win.bat" : " protoc-gen-julia" )
127
127
128
- protoc_path = ProtoBuf. protoc_jll. protoc ()
129
128
ENV ′ = copy (ENV )
130
129
ENV ′[" PATH" ] = string (plugin_dir, Sys. iswindows () ? " ;" : " :" , ENV ′[" PATH" ])
131
130
ENV ′[" JULIA" ] = joinpath (Sys. BINDIR, Base. julia_exename ())
131
+ # protobuf plugin uses COVERAGE env var to pass coverage flag to julia
132
+ # we do not want to pass unintended values that sometimes CI environments set
133
+ # we also do not intend to trigger coverage in the plugin while running CI in this package
134
+ ENV ′[" COVERAGE" ] = " "
132
135
run (setenv (` $protoc_path --plugin=protoc-gen-julia=$plugin $args ` , ENV ′))
133
136
end
134
137
@@ -141,7 +144,7 @@ Generate a gRPC client from protobuf specification file.
141
144
- `outdir`: Directory to write generated code into, created if not present
142
145
already. Existing files if any will be overwtitten.
143
146
"""
144
- function generate (proto:: String ; outdir:: String = pwd (), includes:: Vector{String} = String[])
147
+ function generate (proto:: String ; outdir:: String = pwd (), includes:: Vector{String} = String[], protoc_path = ProtoBuf . protoc_jll . protoc () )
145
148
if ! isfile (proto)
146
149
throw (ArgumentError (" No such file - $proto " ))
147
150
end
@@ -163,7 +166,7 @@ function generate(proto::String; outdir::String=pwd(), includes::Vector{String}=
163
166
bindir = Sys. BINDIR
164
167
pathenv = string (ENV [" PATH" ], Sys. iswindows () ? " ;" : " :" , bindir)
165
168
withenv (" PATH" => pathenv) do
166
- grpc_protoc (` $includeflag --julia_out=$outdir $proto ` )
169
+ grpc_protoc (` $includeflag --julia_out=$outdir $proto ` ; protoc_path = protoc_path )
167
170
end
168
171
169
172
# include the generated code and detect service method names
0 commit comments