Skip to content

Commit

Permalink
fbt: optional shallow submodule checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
hedger committed Oct 16, 2023
1 parent e664159 commit 31267a4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 7 additions & 1 deletion fbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ FBT_NOENV="${FBT_NOENV:-""}";
FBT_NO_SYNC="${FBT_NO_SYNC:-""}";
FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}";
FBT_VERBOSE="${FBT_VERBOSE:-""}";
FBT_SHALLOW="${FBT_SHALLOW:-""}";

if [ -z "$FBT_NOENV" ]; then
FBT_VERBOSE="$FBT_VERBOSE" . "$SCRIPT_PATH/scripts/toolchain/fbtenv.sh";
Expand All @@ -29,7 +30,12 @@ if [ -z "$FBT_NO_SYNC" ]; then
echo "\".git\" directory not found, please clone repo via \"git clone\"";
exit 1;
fi
git submodule update --init --jobs "$N_GIT_THREADS";
_FBT_CLONE_FLAGS="--jobs $N_GIT_THREADS";
if [ -z "$FBT_SHALLOW" ]; then
_FBT_CLONE_FLAGS="$_FBT_CLONE_FLAGS --depth 1";
fi

git submodule update --init --recursive $_FBT_CLONE_FLAGS;
fi

$SCONS_EP $SCONS_DEFAULT_FLAGS "$@"
12 changes: 10 additions & 2 deletions fbt.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ call "%~dp0scripts\toolchain\fbtenv.cmd" env
set SCONS_EP=python -m SCons

if [%FBT_NO_SYNC%] == [] (
set _FBT_CLONE_FLAGS=--jobs %NUMBER_OF_PROCESSORS%
if not [%FBT_SHALLOW%] == [] (
set _FBT_CLONE_FLAGS=%_FBT_CLONE_FLAGS% --depth 1
)
if exist ".git" (
git submodule update --init --depth 1 --jobs %NUMBER_OF_PROCESSORS%
git submodule update --init --recursive %_FBT_CLONE_FLAGS%
if %ERRORLEVEL% neq 0 (
echo Failed to update submodules, set FBT_NO_SYNC to skip
exit /b 1
)
) else (
echo Not in a git repo, please clone with "git clone"
echo .git not found, please clone repo with "git clone"
exit /b 1
)
)
Expand Down

0 comments on commit 31267a4

Please sign in to comment.