@@ -293,7 +293,16 @@ def generate_syntax_node_template_gyb_files(
293
293
# `source_dirs` to a unique temporary directory.
294
294
# If `temp_directories` is False, it maps each source dir to the corresponding
295
295
# gyb_generated directory.
296
- def gyb_dir_mapping (temp_directories : bool , source_dirs : List [str ]) -> Dict [str , str ]:
296
+ def gyb_dir_mapping (temp_directories : bool ) -> Dict [str , str ]:
297
+ source_dirs = [
298
+ GENERATESWIFTSYNTAXBUILDER_DIR ,
299
+ SWIFTSYNTAX_DIR ,
300
+ os .path .join (SWIFTSYNTAX_DIR , "Raw" ),
301
+ SWIFTSYNTAXBUILDER_DIR ,
302
+ SWIFTSYNTAXPARSER_DIR ,
303
+ SWIFTSYNTAX_DOCUMENTATION_DIR ,
304
+ SWIFTPARSER_DIR ,
305
+ ]
297
306
mapping = {}
298
307
for source_dir in source_dirs :
299
308
if temp_directories :
@@ -303,33 +312,6 @@ def gyb_dir_mapping(temp_directories: bool, source_dirs: List[str]) -> Dict[str,
303
312
return mapping
304
313
305
314
306
- # Gyb-files that should be generated before running generate-swift-syntax-builder.
307
- # Maps directories containing .gyb files to the directories the generated files should
308
- # live in.
309
- def first_stage_gyb_dir_mapping (
310
- temp_directories : bool
311
- ) -> Dict [str , str ]:
312
- return gyb_dir_mapping (temp_directories = temp_directories , source_dirs = [
313
- GENERATESWIFTSYNTAXBUILDER_DIR
314
- ])
315
-
316
-
317
- # Gyb-files that should be generated after running generate-swift-syntax-builder.
318
- # Maps directories containing .gyb files to the directories the generated files should
319
- # live in.
320
- def second_stage_gyb_dir_mapping (
321
- temp_directories : bool
322
- ) -> Dict [str , str ]:
323
- return gyb_dir_mapping (temp_directories = temp_directories , source_dirs = [
324
- SWIFTSYNTAX_DIR ,
325
- os .path .join (SWIFTSYNTAX_DIR , "Raw" ),
326
- SWIFTSYNTAXBUILDER_DIR ,
327
- SWIFTSYNTAXPARSER_DIR ,
328
- SWIFTSYNTAX_DOCUMENTATION_DIR ,
329
- SWIFTPARSER_DIR ,
330
- ])
331
-
332
-
333
315
def generate_gyb_files (
334
316
gyb_exec : str , gyb_dir_mapping : Dict [str , str ],
335
317
add_source_locations : bool , verbose : bool ,
@@ -476,14 +458,7 @@ def build(self, product_name: str) -> None:
476
458
477
459
478
460
def verify_gyb_generated_files (gyb_exec : str , verbose : bool ) -> None :
479
- first_stage_gyb_dirs = first_stage_gyb_dir_mapping (
480
- temp_directories = True
481
- )
482
- second_stage_gyb_dirs = second_stage_gyb_dir_mapping (
483
- temp_directories = True
484
- )
485
- gyb_dirs = first_stage_gyb_dirs
486
- gyb_dirs .update (second_stage_gyb_dirs )
461
+ gyb_dirs = gyb_dir_mapping (temp_directories = True )
487
462
488
463
generate_gyb_files (
489
464
gyb_exec ,
@@ -688,7 +663,7 @@ def generate_source_code_command(args: argparse.Namespace) -> None:
688
663
try :
689
664
generate_gyb_files (
690
665
args .gyb_exec ,
691
- gyb_dir_mapping = first_stage_gyb_dir_mapping (temp_directories = False ),
666
+ gyb_dir_mapping = gyb_dir_mapping (temp_directories = False ),
692
667
add_source_locations = args .add_source_locations ,
693
668
verbose = args .verbose ,
694
669
)
@@ -707,16 +682,6 @@ def generate_source_code_command(args: argparse.Namespace) -> None:
707
682
fail_for_called_process_error (
708
683
"Source generation using SwiftSyntaxBuilder failed" , e )
709
684
710
- try :
711
- generate_gyb_files (
712
- args .gyb_exec ,
713
- gyb_dir_mapping = second_stage_gyb_dir_mapping (temp_directories = False ),
714
- add_source_locations = args .add_source_locations ,
715
- verbose = args .verbose ,
716
- )
717
- except subprocess .CalledProcessError as e :
718
- fail_for_called_process_error ("Generating .gyb files failed" , e )
719
-
720
685
721
686
def verify_source_code_command (args : argparse .Namespace ) -> None :
722
687
try :
0 commit comments