Skip to content

Commit

Permalink
Move source setup.sh to buildAndChecksum
Browse files Browse the repository at this point in the history
This removes some extra work in that file.
  • Loading branch information
Flamefire committed Dec 28, 2024
1 parent bc01a67 commit dbaf08a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
1 change: 0 additions & 1 deletion build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ while (($# > 0)); do
shift
done

source "$(dirname "${BASH_SOURCE[0]}")/setup.sh"
source "$(dirname "${BASH_SOURCE[0]}")/buildAndChecksum.sh"
30 changes: 6 additions & 24 deletions build_scripts/buildAndChecksum.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
set -eu

function _get_build_var {
set +u
if [[ $(type -t get_build_var) != "function" ]]; then
source build/envsetup.sh
fi
get_build_var "$@"
set -u
}

function _mka {
set +u
if [[ $(type -t mka) != "function" ]]; then
source build/envsetup.sh
fi
mka "$@"
res=$?
set -u
return $res
}
source "$(dirname "${BASH_SOURCE[0]}")/setup.sh"

: "${num_procs:=$(nproc)}"
GREEN='\033[0;32m'
Expand All @@ -27,7 +9,7 @@ RED='\033[0;31m'
YELLOW='\033[0;33m'
NC='\033[0m'

targetFileName="lineage-$(_get_build_var LINEAGE_VERSION).zip"
targetFileName="lineage-$(get_build_var LINEAGE_VERSION).zip"
targetFile="$ANDROID_PRODUCT_OUT/$targetFileName"

function is_hardlink {
Expand All @@ -50,18 +32,18 @@ fi

if [ "${CLEAN_BUILD:-0}" == "1" ]; then
echo -e "${YELLOW}Cleaning build dir"
_mka installclean
mka installclean
fi

echo -e "${YELLOW}Starting build${NC}"
echo -e "${YELLOW}Starting build...${NC}"

if _mka bacon; then
if mka bacon; then
outDir="$OUT_DIR_COMMON_BASE/$(basename "$PWD")"
if [ "${CHECK_LFS:-1}" == "1" ] && grep -rF --files-with-matches "https://git-lfs." "$outDir"; then
echo -e "${RED}Found git LFS files in $outDir!${NC}" && false
fi

otaFile="$ANDROID_PRODUCT_OUT/$(_get_build_var TARGET_PRODUCT)-ota-"*.zip
otaFile="$ANDROID_PRODUCT_OUT/$(get_build_var TARGET_PRODUCT)-ota-"*.zip
[ ! -e "$otaFile" ] || rm "$otaFile"
if is_hardlink "$targetFile"; then
tmpFile="$(mktemp -p /dev/shm)"
Expand Down

0 comments on commit dbaf08a

Please sign in to comment.