@@ -42,66 +42,70 @@ def run_preparation(self, collector) -> PreparationPluginReturn:
4242
4343 filename_include_regex = globs_to_regex (["*.profdata" ])
4444
45- matched_paths = [
46- str (path )
47- for path in search_files (
45+ matched_paths = list (
46+ search_files (
4847 folder_to_search = self .derived_data_folder ,
4948 folders_to_ignore = [],
5049 filename_include_regex = filename_include_regex ,
5150 )
52- ]
51+ )
52+
5353 if not matched_paths :
5454 logger .warning ("No swift data found." )
5555 return
5656
5757 logger .info (
5858 "Running swift coverage on the following list of files:" ,
59- extra = dict (extra_log_attributes = dict (matched_paths = matched_paths )),
59+ extra = dict (
60+ extra_log_attributes = dict (
61+ matched_paths = [p .as_posix () for p in matched_paths ]
62+ )
63+ ),
6064 )
6165
6266 for path in matched_paths :
6367 self .swiftcov (path , self .app_name )
6468
6569 return PreparationPluginReturn (success = True , messages = "" )
6670
67- def swiftcov (self , path , app_name : str ):
71+ def swiftcov (self , path : pathlib . Path , app_name : str ) -> None :
6872 directory = os .path .dirname (path )
6973 build_dir = pathlib .Path (re .sub ("(Build).*" , "Build" , directory ))
7074
7175 for type in ["app" , "framework" , "xctest" ]:
7276 filename_include_regex = re .compile (translate (f"*.{ type } " ))
73- matched_dir_paths = [
74- str (path )
75- for path in search_files (
76- folder_to_search = pathlib .Path (build_dir ),
77- folders_to_ignore = [],
78- filename_include_regex = filename_include_regex ,
79- search_for_directories = True ,
80- )
81- ]
77+ matched_dir_paths = search_files (
78+ folder_to_search = build_dir ,
79+ folders_to_ignore = [],
80+ filename_include_regex = filename_include_regex ,
81+ search_for_directories = True ,
82+ )
83+
8284 for dir_path in matched_dir_paths :
8385 # proj name without extension
84- proj = pathlib . Path ( dir_path ) .stem
86+ proj = dir_path .stem
8587 if app_name == "" or (app_name .lower () in proj .lower ()):
8688 logger .info (f"+ Building reports for { proj } { type } " )
87- proj_path = pathlib . Path ( pathlib . Path ( dir_path ) / proj )
89+ proj_path = dir_path / proj
8890 dest = (
8991 proj_path
9092 if proj_path .is_file ()
91- else pathlib . Path ( f" { dir_path } / Contents/MacOS/{ proj } ")
93+ else dir_path / " Contents/MacOS/{proj}"
9294 )
9395 output_file_name = f"{ proj } .{ type } .coverage.txt" .replace (" " , "" )
9496 self .run_llvm_cov (output_file_name , path , dest )
9597
96- def run_llvm_cov (self , output_file_name , path , dest ):
98+ def run_llvm_cov (
99+ self , output_file_name : str , path : pathlib .Path , dest : pathlib .Path
100+ ) -> None :
97101 with open (output_file_name , "w" ) as output_file :
98102 s = subprocess .run (
99103 [
100104 "xcrun" ,
101105 "llvm-cov" ,
102106 "show" ,
103107 "-instr-profile" ,
104- path ,
108+ str ( path ) ,
105109 str (dest ),
106110 ],
107111 stdout = output_file ,
0 commit comments