Skip to content

Commit

Permalink
chore(linux): Fix build scripts
Browse files Browse the repository at this point in the history
Creating the coverage option to ninja previously didn't work reliably.
This change re-orders the parameters passed to `meson setup` and seems
to work better. Additionally this change refactors the scripts and makes
use of `builder_run_action`.
  • Loading branch information
ermshiperete committed Oct 17, 2023
1 parent 141d44a commit a8c2598
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 52 deletions.
43 changes: 13 additions & 30 deletions linux/ibus-keyman/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,12 @@ else
MESON_COVERAGE=
fi

if builder_start_action clean; then
rm -rf "$THIS_SCRIPT_PATH/../build/"
builder_finish_action success clean
fi

if builder_start_action configure; then
cd "$THIS_SCRIPT_PATH"
configure_action() {
# shellcheck disable=SC2086
meson setup "$MESON_PATH" --werror --buildtype $MESON_TARGET ${MESON_COVERAGE} "${builder_extra_params[@]}"
builder_finish_action success configure
fi

if builder_start_action build; then
cd "$THIS_SCRIPT_PATH/$MESON_PATH"
ninja
builder_finish_action success build
fi
meson setup ${MESON_COVERAGE} --werror --buildtype $MESON_TARGET "${builder_extra_params[@]}" "$MESON_PATH"
}

if builder_start_action test; then
cd "$THIS_SCRIPT_PATH/$MESON_PATH"
test_action() {
if builder_has_option --no-integration; then
meson test --print-errorlogs $builder_verbose setup-src-test keymanutil-tests print-kmpdetails-test print-kmp-test bcp47-util-tests teardown-src-test
else
Expand All @@ -78,17 +64,14 @@ if builder_start_action test; then
# Note: requires lcov > 1.16 to properly work (see https://github.com/mesonbuild/meson/issues/6747)
ninja coverage-html
fi
builder_finish_action success test
fi
}

if builder_start_action install; then
cd "$THIS_SCRIPT_PATH/$MESON_PATH"
ninja install
builder_finish_action success install
fi
builder_run_action clean rm -rf "$THIS_SCRIPT_PATH/../build/"
builder_run_action configure configure_action

if builder_start_action uninstall; then
cd "$THIS_SCRIPT_PATH/$MESON_PATH"
ninja uninstall
builder_finish_action success uninstall
fi
[ -d "$MESON_PATH" ] && cd "$MESON_PATH"

builder_run_action build ninja
builder_run_action test test_action
builder_run_action install ninja install
builder_run_action uninstall ninja uninstall
36 changes: 14 additions & 22 deletions linux/keyman-system-service/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,25 @@ else
MESON_COVERAGE=
fi

builder_run_action clean rm -rf "$THIS_SCRIPT_PATH/build/"
configure_action() {
# shellcheck disable=SC2086
meson setup ${MESON_COVERAGE} --werror --buildtype $MESON_TARGET "${builder_extra_params[@]}" "$MESON_PATH"
}

# shellcheck disable=SC2086
builder_run_action configure meson setup "$MESON_PATH" --werror --buildtype $MESON_TARGET ${MESON_COVERAGE} "${builder_extra_params[@]}"

cd "$MESON_PATH" || true

if builder_start_action build; then
ninja
builder_finish_action success build
fi

if builder_start_action test; then
test_action() {
meson test --print-errorlogs $builder_verbose
if builder_has_option --coverage; then
# Note: requires lcov > 1.16 to properly work (see https://github.com/mesonbuild/meson/issues/6747)
ninja coverage-html
fi
builder_finish_action success test
fi
}

if builder_start_action install; then
ninja install
builder_finish_action success install
fi
builder_run_action clean rm -rf "$THIS_SCRIPT_PATH/build/"
builder_run_action configure configure_action

if builder_start_action uninstall; then
ninja uninstall
builder_finish_action success uninstall
fi
[ -d "$MESON_PATH" ] && cd "$MESON_PATH"

builder_run_action build ninja
builder_run_action test test_action
builder_run_action install ninja install
builder_run_action uninstall ninja uninstall

0 comments on commit a8c2598

Please sign in to comment.