@@ -53,10 +53,6 @@ def make_exec_label(label):
5353 executable = True ,
5454 )
5555
56- # buildifier: disable=function-docstring
57- def select_generator (ctx ):
58- return ctx .executable ._generator_v2
59-
6056def sort_deps (deps ):
6157 """Sorts a list of dependencies.
6258
@@ -151,8 +147,6 @@ def _sapi_interface_impl(ctx):
151147 fail ("generator_version=1 is no longer supported." )
152148
153149 cpp_toolchain = find_cpp_toolchain (ctx )
154- generator = select_generator (ctx )
155- use_clang_generator = ctx .attr .generator_version >= 2
156150
157151 # TODO(szwl): warn if input_files is not set and we didn't find anything
158152 input_files_paths = []
@@ -166,11 +160,10 @@ def _sapi_interface_impl(ctx):
166160 append_arg (args , "--sapi_embed_name" , ctx .attr .embed_name )
167161 append_arg (args , "--sapi_functions" , "," .join (ctx .attr .functions ))
168162 append_arg (args , "--sapi_ns" , ctx .attr .namespace )
163+ append_arg (args , "--sapi_api_version" , str (ctx .attr .api_version ))
164+ append_arg (args , "--sapi_sandbox_mode" , ctx .attr .sandbox_mode )
169165
170- if use_clang_generator :
171- append_arg (args , "--sapi_sandbox_mode" , ctx .attr .sandbox_mode )
172-
173- if use_clang_generator and ctx .outputs .sandboxee_src_out :
166+ if ctx .outputs .sandboxee_src_out :
174167 append_arg (args , "--sapi_sandboxee_src_out" , ctx .outputs .sandboxee_src_out .path )
175168 outs .append (ctx .outputs .sandboxee_src_out )
176169
@@ -204,30 +197,22 @@ def _sapi_interface_impl(ctx):
204197 # Try to find files automatically
205198 input_files_paths += _lib_direct_headers (ctx .attr .lib , cc_ctx )
206199
207- if use_clang_generator :
208- input_files += cpp_toolchain .all_files .to_list ()
209- extra_flags += _clang_generator_flags (ctx , cc_ctx , cpp_toolchain , input_files_paths )
210- else :
211- append_all (extra_flags , "-D" , cc_ctx .defines .to_list ())
212- append_all (extra_flags , "-isystem" , cc_ctx .system_includes .to_list ())
213- append_all (extra_flags , "-iquote" , cc_ctx .quote_includes .to_list ())
214- append_all (extra_flags , "-I" , cc_ctx .includes .to_list ())
200+ input_files += cpp_toolchain .all_files .to_list ()
201+ extra_flags += _clang_generator_flags (ctx , cc_ctx , cpp_toolchain , input_files_paths )
215202
216- if use_clang_generator :
217- args += extra_flags + input_files_paths
218- else :
219- append_arg (args , "--sapi_in" , "," .join (input_files_paths ))
220- args += ["--" ] + extra_flags
203+ args += extra_flags + input_files_paths
221204
222- progress_msg = ("Generating {} from {} header files." +
223- "" ).format (ctx .outputs .out .short_path , len (input_files_paths ))
205+ progress_msg = "Generating {} from {} header files." .format (
206+ ctx .outputs .out .short_path ,
207+ len (input_files_paths ),
208+ )
224209 ctx .actions .run (
225210 inputs = input_files ,
226211 outputs = outs ,
227212 arguments = args ,
228213 mnemonic = "SapiInterfaceGen" ,
229214 progress_message = progress_msg ,
230- executable = generator ,
215+ executable = ctx . executable . _generator_v2 ,
231216 )
232217
233218# Build rule that generates SAPI interface.
0 commit comments