#!/bin/bash
#
# Copyright (C) 2019-Present A-Team Digital Solutions
#

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DEVICE_MODEL="$DEVICE_MODEL_NUMBER"

clear
bash "$SCRIPT_DIR/clean.sh"
clear

# Used For Testing variable additions
#env | sort | grep -E 'DEVICE|ROM|ANDROID|JOB|CCACHE'

echo 
echo "================================"
echo "ROM Build Settings ..."
echo 
echo "Device: $DEVICE_DISPLAY_NAME"
echo "Device Codename: $DEVICE_DISPLAY_CODENAME"
echo "Device Model: $DEVICE_MODEL"
echo "Rom: $ROM_DISPLAY_NAME"
echo "Android: $ANDROID_VERSION"
echo "Build Jobs: $BUILD_JOBS"
echo "Ccache: $USE_CCACHE"
echo "Build Variant: ${BUILD_VARIANT^}"
echo "Gapps Variant: ${GAPPS_VARIANT^}"
echo "Installer Variant: ${INSTALLER_VARIANT^}"
echo "Pre-Build Clean Variant: ${CLEAN_VARIANT^}"
echo "================================"
echo 
echo 
sleep 5
echo "ROM Build Starting ..."
echo 
echo
# Source Build Env
source build/envsetup.sh
# Export Build Variables
export LC_ALL=C
export SELINUX_IGNORE_NEVERALLOWS=true
# Lunch
lunch ${ROM_BUILD_NAME}_${DEVICE_NAME}-${ROM_TARGET_RELEASE}-${BUILD_VARIANT}
# Build
"$ROM_BUILD_COMMAND" "$DEVICE_CODENAME"
#m bacon -j$JOBS


