From 2f86e4648423f423f95c730018da8bd58d53d4c8 Mon Sep 17 00:00:00 2001 From: Omari Stephens Date: Fri, 31 May 2024 07:30:32 +0000 Subject: [PATCH] Refactors how source files are aggregated for testing This also implicitly runs tests and static analysis against src/filedata/filedata.cc --- meson.build | 16 ++++++++++------ src/filedata/meson.build | 2 +- src/meson.build | 5 ++++- src/pan-view/meson.build | 3 ++- src/tests/meson.build | 2 +- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index e9d06431d..25d6e469f 100644 --- a/meson.build +++ b/meson.build @@ -56,6 +56,10 @@ add_global_arguments('-Wno-overlength-strings', language : 'c') add_global_arguments('-Wno-error=deprecated-declarations', language : 'cpp') # Project requirements +# code_sources is all human-written geeqie C/C++ code +code_sources = [] +# project_sources will include code_sources, as well as auto-generated code, +# third-party code, and some other code-like dependencies. project_sources = [] gnome = import('gnome') thread_dep = dependency('threads') @@ -729,7 +733,7 @@ if running_from_git if clang_tidy_exe.found() git_exe = find_program('git', required : true) - foreach source_file : main_sources + pan_view_sources + view_file_sources + foreach source_file : code_sources if fs.name(source_file).endswith('.cc') source_file_name = fs.name(source_file) config_file = join_paths(meson.project_source_root(), '.clang-tidy') @@ -749,7 +753,7 @@ endif # Single value enum checks enum_check_sh = find_program('enum-check.sh', dirs : scriptsdir, required : true) if enum_check_sh.found() - foreach source_file : main_sources + pan_view_sources + view_file_sources + foreach source_file : code_sources source_file_name = fs.name(source_file) test('Single Value enum_ ' + source_file_name, enum_check_sh, args : [source_file], timeout : 100, suite : 'analysis') endforeach @@ -762,7 +766,7 @@ endif # Debug statement checks debug_check_sh = find_program('debug-check.sh', dirs : scriptsdir, required : true) if debug_check_sh.found() - foreach source_file : main_sources + pan_view_sources + view_file_sources + foreach source_file : code_sources source_file_name = fs.name(source_file) if (source_file_name != 'debug.h') test('Debug Statements_ ' + source_file_name, debug_check_sh, args : [source_file], timeout : 100, suite : 'analysis') @@ -777,7 +781,7 @@ endif # Temporary comments checks tmp_comments_check_sh = find_program('temporary-comments-check.sh', dirs : scriptsdir, required : true) if tmp_comments_check_sh.found() - foreach source_file : main_sources + pan_view_sources + view_file_sources + foreach source_file : code_sources source_file_name = fs.name(source_file) if (source_file_name != 'debug.h') test('Temporary Comments_ ' + source_file_name, tmp_comments_check_sh, args : [source_file], timeout : 100, suite : 'analysis') @@ -794,7 +798,7 @@ gtk4_migration_check_sh = find_program('gtk4-migration-regression-check.sh', dir if gtk4_migration_check_sh.found() compat_cc = join_paths(meson.project_source_root(), 'src', 'compat.cc') compat_h = join_paths(meson.project_source_root(), 'src', 'compat.h') - foreach source_file : main_sources + pan_view_sources + view_file_sources + foreach source_file : code_sources source_file_name = fs.name(source_file) if (source_file_name != 'debug.h') test('GTK4 migration_ ' + source_file_name, gtk4_migration_check_sh, args : [source_file, compat_cc, compat_h], timeout : 100, suite : 'analysis') @@ -809,7 +813,7 @@ endif # Untranslated text checks untranslated_text_sh = find_program('untranslated-text.sh', dirs : scriptsdir, required : true) if untranslated_text_sh.found() - foreach source_file : main_sources + pan_view_sources + view_file_sources + foreach source_file : code_sources if fs.name(source_file).endswith('.cc') source_file_name = fs.name(source_file) test('Untranslated Text_ ' + source_file_name, untranslated_text_sh, args : [source_file], timeout : 200, suite : 'analysis') diff --git a/src/filedata/meson.build b/src/filedata/meson.build index 03a8ab87b..54e7b04da 100644 --- a/src/filedata/meson.build +++ b/src/filedata/meson.build @@ -21,4 +21,4 @@ filedata_sources = files('filedata.cc') -project_sources += filedata_sources +code_sources += filedata_sources diff --git a/src/meson.build b/src/meson.build index 5ecaeb11f..011d7eaf3 100644 --- a/src/meson.build +++ b/src/meson.build @@ -300,7 +300,7 @@ if conf_data.get('HAVE_WEBP', 0) == 1 ) endif -project_sources += main_sources +code_sources += main_sources subdir('authors') subdir('filedata') @@ -314,6 +314,9 @@ if conf_data.get('ENABLE_UNIT_TESTS', 0) == 1 subdir('tests') endif +# We assume that code_sources is only set above. +project_sources += code_sources + gq_marshal = gnome.genmarshal('gq-marshal', prefix : 'gq_marshal', sources : 'gq-marshal.list') project_sources += gq_marshal[1] diff --git a/src/pan-view/meson.build b/src/pan-view/meson.build index 49c5b3e91..f376a98d1 100644 --- a/src/pan-view/meson.build +++ b/src/pan-view/meson.build @@ -30,4 +30,5 @@ pan_view_sources = files('pan-calendar.cc', 'pan-view.h', 'pan-view-search.cc', 'pan-view-search.h') -project_sources += pan_view_sources + +code_sources += pan_view_sources diff --git a/src/tests/meson.build b/src/tests/meson.build index b7a995136..e6145b8d8 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -21,4 +21,4 @@ unit_test_sources = files('pixbuf-util.cc') -project_sources += unit_test_sources +code_sources += unit_test_sources