Meta: Use a common function for getting build directory

Between WPT.sh and ladybird.sh.

This is useful to me as I set my default build configuration to Debug,
and have been hacking around with the WPT script to align with this
configuration.
This commit is contained in:
Shannon Booth 2024-10-09 18:32:11 +13:00 committed by Tim Ledbetter
commit 7ea17d2fea
Notes: github-actions[bot] 2024-10-09 10:32:49 +00:00
3 changed files with 31 additions and 14 deletions

View file

@ -60,3 +60,26 @@ ensure_ladybird_source_dir() {
export LADYBIRD_SOURCE_DIR
fi
}
get_build_dir() {
ensure_ladybird_source_dir
# Note: Keep in sync with buildDir defaults in CMakePresets.json
case "$1" in
"default")
BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird"
;;
"Debug")
BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird-debug"
;;
"Sanitizer")
BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird-sanitizers"
;;
*)
echo "Unknown BUILD_PRESET: '$1'" >&2
exit 1
;;
esac
echo "${BUILD_DIR}"
}