blob: 6b3b4c3a1a043386006612bf88bee119c7528631 [file] [log] [blame]
Kelvin Zhangd64c8832022-04-02 19:56:24 +08001#!/bin/bash
2#
3# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
4#
5# SPDX-License-Identifier: MIT
6#
7
shijie.xionga73e1172022-09-15 14:11:21 +08008# Clear build.log
9cat <<EOF > $BUILD_LOG
10EOF
11
shijie.xiongfe9f21e2022-09-21 10:52:41 +080012TEMP_LOG="$OUTPUT_DIR/temp.log"
13
Kelvin Zhangdfd28382022-04-02 20:32:27 +080014source scripts/publish.sh
Kelvin Zhangd64c8832022-04-02 19:56:24 +080015
shijie.xiong69cbf042022-04-22 13:32:39 +080016function get_new_package_dir() {
17 filelist=$(ls -t output/packages)
18 fileArry=($filelist)
19 CURRENT_PRODUCTS_DIR_NAME=${fileArry[0]}
20 export CURRENT_PRODUCTS_DIR_NAME
21}
22
shijie.xiongfe9f21e2022-09-21 10:52:41 +080023# compile warning check
24function compile_warning_check(){
25 touch $TEMP_LOG
26 CAT_LINE=`sed -n -e '/UBOOT COMPILE START/=' $1`
27 sed -n "1,${CAT_LINE}p" $1 >> $TEMP_LOG
28}
29
shijie.xiongec398682022-09-07 15:57:54 +080030echo "======== Building all packages ========" | tee -a $BUILD_LOG
Kelvin Zhangd64c8832022-04-02 19:56:24 +080031
32source scripts/gen_package_combination.sh
33
34index=0
35while IFS= read -r LINE; do
shijie.xiongec398682022-09-07 15:57:54 +080036 source scripts/pkg_env.sh $index gen_all >> $BUILD_LOG 2>&1
Kelvin Zhangd64c8832022-04-02 19:56:24 +080037 [ "$?" -ne 0 ] && echo "Ignore unsupported combination!" && continue
shijie.xiongec398682022-09-07 15:57:54 +080038 echo -n "$index. Building ... "
39 make package >> $BUILD_LOG 2>&1
shijie.xiong69cbf042022-04-22 13:32:39 +080040 get_new_package_dir
shijie.xiongec398682022-09-07 15:57:54 +080041 [ "$?" -ne 0 ] && echo "failed!" && cat $BUILD_LOG && echo -e "\nAborted with errors!\n" && exit 3
shijie.xiongfe9f21e2022-09-21 10:52:41 +080042 compile_warning_check $BUILD_LOG
43 grep -qr "warning: " $TEMP_LOG
44 [ "$?" -eq 0 ] && cat $BUILD_LOG && echo -e "\nAborted with warnings!\n" && rm $TEMP_LOG && exit 1
shijie.xiongec398682022-09-07 15:57:54 +080045 echo "OK."
Kelvin Zhangd64c8832022-04-02 19:56:24 +080046 if [[ "$SUBMIT_TYPE" == "release" ]]; then
shijie.xiongec398682022-09-07 15:57:54 +080047 publish_packages >> $BUILD_LOG 2>&1
Kelvin Zhangaa84d882022-04-22 13:38:46 +080048 [ "$?" -ne 0 ] && echo "Failed to publish packages!" && exit 4
Kelvin Zhangd64c8832022-04-02 19:56:24 +080049 fi
50 index=$((index + 1))
51done <"$PACKAGE_COMBINATION"
52
shijie.xiongfe9f21e2022-09-21 10:52:41 +080053rm $TEMP_LOG
54
shijie.xiongec398682022-09-07 15:57:54 +080055[[ "$SUBMIT_TYPE" == "release" ]] && post_publish_packages >> $BUILD_LOG 2>&1
56
57echo -e "======== Done ========\n" | tee -a $BUILD_LOG