Skip to content

Commit

Permalink
[script] add pre-build checks that ensure the GSDK submodule has been…
Browse files Browse the repository at this point in the history
… pulled properly (#791)
  • Loading branch information
lmnotran authored Feb 9, 2024
1 parent 141e147 commit c883cef
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ main()
{
if [ $# == 0 ]; then
install_packages
install_arm_toolchain
install_packages_pip3
do_bootstrap_silabs
elif [ "$1" == 'packages' ]; then
Expand Down
36 changes: 35 additions & 1 deletion script/build
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 "$(git -C "${gsdk_dir}" rev-parse --git-dir)/hooks/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-}

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit c883cef

Please sign in to comment.