@@ -19,11 +19,16 @@ builder_describe \
1919 " test" \
2020 " install install artifacts" \
2121 " uninstall uninstall artifacts" \
22+ " report create coverage report" \
2223 " @/core:arch" \
23- " --no-integration don't run integration tests"
24+ " --no-integration don't run integration tests" \
25+ " --coverage capture test coverage"
2426
2527builder_parse " $@ "
2628
29+ builder_describe_internal_dependency \
30+ report:engine test:engine
31+
2732if builder_is_debug_build; then
2833 MESON_TARGET=debug
2934 export CPPFLAGS=-DG_MESSAGES_DEBUG
@@ -40,6 +45,12 @@ builder_describe_outputs \
4045 configure " ${MESON_PATH} /build.ninja" \
4146 build " ${MESON_PATH} /src/ibus-engine-keyman"
4247
48+ if builder_has_option --coverage; then
49+ MESON_COVERAGE=-Db_coverage=true
50+ else
51+ MESON_COVERAGE=
52+ fi
53+
4354if builder_start_action clean; then
4455 rm -rf " $THIS_SCRIPT_PATH /../build/"
4556 builder_finish_action success clean
4859if builder_start_action configure; then
4960 cd " $THIS_SCRIPT_PATH "
5061 # shellcheck disable=SC2086
51- meson setup " $MESON_PATH " --werror --buildtype $MESON_TARGET " ${builder_extra_params[@]} "
62+ meson setup " $MESON_PATH " --werror --buildtype $MESON_TARGET ${MESON_COVERAGE} " ${builder_extra_params[@]} "
5263 builder_finish_action success configure
5364fi
5465
@@ -79,3 +90,10 @@ if builder_start_action uninstall; then
7990 ninja uninstall
8091 builder_finish_action success uninstall
8192fi
93+
94+ if builder_start_action report; then
95+ cd " $THIS_SCRIPT_PATH /$MESON_PATH "
96+ # Note: requires lcov > 1.16 to properly work (see https://github.com/mesonbuild/meson/issues/6747)
97+ ninja coverage-html
98+ builder_finish_action success report
99+ fi
0 commit comments