@@ -118,6 +118,20 @@ function get_generated_method_table(s::String)
118
118
T
119
119
end
120
120
121
+ # Defining a local protoc to avoid issues with ProtoBuf.protoc,
122
+ # wherein it was using the form `protoc_jll.protoc() do .. end`
123
+ # which is now deprecated and is causing errors in code generation.
124
+ function grpc_protoc (args= ` ` )
125
+ plugin_dir = abspath (joinpath (dirname (pathof (ProtoBuf)), " .." , " plugin" ))
126
+ plugin = joinpath (plugin_dir, Sys. iswindows () ? " protoc-gen-julia_win.bat" : " protoc-gen-julia" )
127
+
128
+ protoc_path = ProtoBuf. protoc_jll. protoc ()
129
+ ENV ′ = copy (ENV )
130
+ ENV ′[" PATH" ] = string (plugin_dir, Sys. iswindows () ? " ;" : " :" , ENV ′[" PATH" ])
131
+ ENV ′[" JULIA" ] = joinpath (Sys. BINDIR, Base. julia_exename ())
132
+ run (setenv (` $protoc_path --plugin=protoc-gen-julia=$plugin $args ` , ENV ′))
133
+ end
134
+
121
135
"""
122
136
generate(proto::String; outdir::String=pwd())
123
137
@@ -149,7 +163,7 @@ function generate(proto::String; outdir::String=pwd(), includes::Vector{String}=
149
163
bindir = Sys. BINDIR
150
164
pathenv = string (ENV [" PATH" ], Sys. iswindows () ? " ;" : " :" , bindir)
151
165
withenv (" PATH" => pathenv) do
152
- ProtoBuf . protoc (` $includeflag --julia_out=$outdir $proto ` )
166
+ grpc_protoc (` $includeflag --julia_out=$outdir $proto ` )
153
167
end
154
168
155
169
# include the generated code and detect service method names
0 commit comments