From 84b349c0508536c06eef67c9a9281f02768af780 Mon Sep 17 00:00:00 2001 From: Mason Tran Date: Tue, 6 Feb 2024 20:39:03 -0500 Subject: [PATCH] [script] add pre-build checks that ensure the GSDK submodule has been pulled properly --- script/bootstrap | 4 +++- script/build | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index 260d512e..0e9b7474 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -76,7 +76,9 @@ install_packages_brew() coreutils \ openjdk@11 \ grep \ - wget + wget \ + git \ + git-lfs } install_packages_source() diff --git a/script/build b/script/build index 0f690f1f..2bb21772 100755 --- a/script/build +++ b/script/build @@ -37,6 +37,7 @@ else fi script_dir="$(realpath "$(dirname "${script_path}")")" repo_dir="$(dirname "${script_dir}")" +gsdk_dir="${repo_dir}/third_party/silabs/gecko_sdk" # shellcheck source=script/efr32-definitions source "${repo_dir}/script/efr32-definitions" @@ -46,6 +47,39 @@ source "${repo_dir}/script/util" set -euxo pipefail +# ============================================================================== +# Pre-build checks + +set +x +echo "=========================================================================================================" +echo "Check if the Git LFS package is installed" +echo "=========================================================================================================" +set -x +if ! git lfs > /dev/null; then + set +x + echo "ERROR: Git LFS is not installed" + echo + echo "Please run './script/bootstrap packages'" to install it + exit 3 +fi + +set +x +echo "=========================================================================================================" +echo "Ensure Git LFS has been initialized for the GSDK" +echo "=========================================================================================================" +set -x +if [ ! -f /Users/mason/repos/ot-efr32/.git/modules/third_party/silabs/gecko_sdk/pre-push ]; then + git -C "${gsdk_dir}" lfs install +fi + +set +x +echo "=========================================================================================================" +echo "Ensure GSDK submodule has been initialized and LFS objects have been pulled" +echo "=========================================================================================================" +set -x +git submodule update --init "${gsdk_dir}" +git -C "${gsdk_dir}" lfs pull + # ============================================================================== OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET-} @@ -299,7 +333,7 @@ main() before_flags+=("--skip-generation") fi - "${repo_dir}"/script/build_example_apps "${before_flags[@]}" "${board}" "${after_flags[@]}" "$@" + "${repo_dir}"/script/build_example_apps "${before_flags[@]-}" "${board}" "${after_flags[@]-}" "$@" fi