@ -628,19 +628,24 @@ int dummy;
self . generate_coverage_legacy_rules ( outfile )
def generate_coverage_legacy_rules ( self , outfile ) :
( gcovr_exe , lcov_exe , genhtml_exe ) = environment . find_coverage_tools ( )
( gcovr_exe , gcovr_3_1 , lcov_exe , genhtml_exe ) = environment . find_coverage_tools ( )
added_rule = False
if gcovr_exe :
# gcovr >= 3.1 interprets rootdir differently
if gcovr_3_1 :
rootdir = self . environment . get_build_dir ( )
else :
rootdir = self . environment . get_source_dir ( ) ,
added_rule = True
elem = NinjaBuildElement ( self . all_outputs , ' meson-coverage-xml ' , ' CUSTOM_COMMAND ' , ' ' )
elem . add_item ( ' COMMAND ' , [ gcovr_exe , ' -x ' , ' -r ' , self . environment . get_source_dir ( ) ,
elem . add_item ( ' COMMAND ' , [ gcovr_exe , ' -x ' , ' -r ' , roo tdir ,
' -o ' , os . path . join ( self . environment . get_log_dir ( ) , ' coverage.xml ' ) ] )
elem . add_item ( ' DESC ' , ' Generating XML coverage report. ' )
elem . write ( outfile )
# Alias that runs the target defined above
self . create_target_alias ( ' meson-coverage-xml ' , outfile )
elem = NinjaBuildElement ( self . all_outputs , ' meson-coverage-text ' , ' CUSTOM_COMMAND ' , ' ' )
elem . add_item ( ' COMMAND ' , [ gcovr_exe , ' -r ' , self . envi ronment . ge t_source_ dir( ) ,
elem . add_item ( ' COMMAND ' , [ gcovr_exe , ' -r ' , roo tdir ,
' -o ' , os . path . join ( self . environment . get_log_dir ( ) , ' coverage.txt ' ) ] )
elem . add_item ( ' DESC ' , ' Generating text coverage report. ' )
elem . write ( outfile )