Meta: Make LADYBIRD_SOURCE_DIR consistent between WPT.sh and ladybird.sh

ladybird.sh allows the source directory to be overriden to point to
another source directory. I am not sure if anyone is actually using this
behaviour in practise, but let's make the behaviour at least common
between the two scripts with a helper function.
This commit is contained in:
Shannon Booth 2024-10-09 18:23:42 +13:00 committed by Tim Ledbetter
commit 16f68ab1bd
Notes: github-actions[bot] 2024-10-09 10:32:57 +00:00
3 changed files with 17 additions and 12 deletions

View file

@ -49,3 +49,14 @@ get_number_of_processing_units() {
($number_of_processing_units)
}
get_top_dir() {
git rev-parse --show-toplevel
}
ensure_ladybird_source_dir() {
if [ -z "$LADYBIRD_SOURCE_DIR" ] || [ ! -d "$LADYBIRD_SOURCE_DIR" ]; then
LADYBIRD_SOURCE_DIR="$(get_top_dir)"
export LADYBIRD_SOURCE_DIR
fi
}