blob: cac29b4a47f2fdf0baf3ff929f0e85a152d95821 [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
Kelvin Zhangdfd28382022-04-02 20:32:27 +080012source scripts/publish.sh
Kelvin Zhangd64c8832022-04-02 19:56:24 +080013
shijie.xiong69cbf042022-04-22 13:32:39 +080014function get_new_package_dir() {
15 filelist=$(ls -t output/packages)
16 fileArry=($filelist)
17 CURRENT_PRODUCTS_DIR_NAME=${fileArry[0]}
18 export CURRENT_PRODUCTS_DIR_NAME
19}
20
shijie.xiongec398682022-09-07 15:57:54 +080021echo "======== Building all packages ========" | tee -a $BUILD_LOG
Kelvin Zhangd64c8832022-04-02 19:56:24 +080022
23source scripts/gen_package_combination.sh
24
25index=0
26while IFS= read -r LINE; do
shijie.xiongec398682022-09-07 15:57:54 +080027 source scripts/pkg_env.sh $index gen_all >> $BUILD_LOG 2>&1
Kelvin Zhangd64c8832022-04-02 19:56:24 +080028 [ "$?" -ne 0 ] && echo "Ignore unsupported combination!" && continue
shijie.xiongec398682022-09-07 15:57:54 +080029 echo -n "$index. Building ... "
30 make package >> $BUILD_LOG 2>&1
shijie.xiong69cbf042022-04-22 13:32:39 +080031 get_new_package_dir
shijie.xiongec398682022-09-07 15:57:54 +080032 [ "$?" -ne 0 ] && echo "failed!" && cat $BUILD_LOG && echo -e "\nAborted with errors!\n" && exit 3
33 grep -qr "warning: " $BUILD_LOG
34 [ "$?" -eq 0 ] && cat $BUILD_LOG && echo -e "\nAborted with warnings!\n" && exit 1
35 echo "OK."
Kelvin Zhangd64c8832022-04-02 19:56:24 +080036 if [[ "$SUBMIT_TYPE" == "release" ]]; then
shijie.xiongec398682022-09-07 15:57:54 +080037 publish_packages >> $BUILD_LOG 2>&1
Kelvin Zhangaa84d882022-04-22 13:38:46 +080038 [ "$?" -ne 0 ] && echo "Failed to publish packages!" && exit 4
Kelvin Zhangd64c8832022-04-02 19:56:24 +080039 fi
40 index=$((index + 1))
41done <"$PACKAGE_COMBINATION"
42
shijie.xiongec398682022-09-07 15:57:54 +080043[[ "$SUBMIT_TYPE" == "release" ]] && post_publish_packages >> $BUILD_LOG 2>&1
44
45echo -e "======== Done ========\n" | tee -a $BUILD_LOG