blob: 8d7d5e68310e8f5ac761b07414ec49577590225b [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
Kelvin Zhangdfd28382022-04-02 20:32:27 +08008source scripts/publish.sh
Kelvin Zhangd64c8832022-04-02 19:56:24 +08009
shijie.xiong69cbf042022-04-22 13:32:39 +080010function get_new_package_dir() {
11 filelist=$(ls -t output/packages)
12 fileArry=($filelist)
13 CURRENT_PRODUCTS_DIR_NAME=${fileArry[0]}
14 export CURRENT_PRODUCTS_DIR_NAME
15}
16
Kelvin Zhangd64c8832022-04-02 19:56:24 +080017if [[ "$SUBMIT_TYPE" == "daily" ]] || [[ "$SUBMIT_TYPE" == "release" ]]; then
shijie.xiongec398682022-09-07 15:57:54 +080018echo "======== Building document ========" | tee $BUILD_LOG
19 make docs >> $BUILD_LOG 2>&1
Kelvin Zhangd64c8832022-04-02 19:56:24 +080020 if [ -d $LOCAL_DOC_PATH ]; then
21 pushd $LOCAL_DOC_PATH >/dev/null
22 publish_docoment
23 if [ $? -ne 0 ]; then
shijie.xiongec398682022-09-07 15:57:54 +080024 echo "Failed to update document!"
Kelvin Zhangd64c8832022-04-02 19:56:24 +080025 else
shijie.xiongec398682022-09-07 15:57:54 +080026 echo "Document updated."
Kelvin Zhangd64c8832022-04-02 19:56:24 +080027 fi
28 popd >/dev/null
29 else
30 echo "$LOCAL_DOC_PATH not exist!"
31 fi
shijie.xiongec398682022-09-07 15:57:54 +080032echo -e "======== Done ========\n" | tee -a $BUILD_LOG
Kelvin Zhangd64c8832022-04-02 19:56:24 +080033fi
34
shijie.xiongec398682022-09-07 15:57:54 +080035echo "======== Building all packages ========" | tee -a $BUILD_LOG
Kelvin Zhangd64c8832022-04-02 19:56:24 +080036
37source scripts/gen_package_combination.sh
38
39index=0
40while IFS= read -r LINE; do
shijie.xiongec398682022-09-07 15:57:54 +080041 source scripts/pkg_env.sh $index gen_all >> $BUILD_LOG 2>&1
Kelvin Zhangd64c8832022-04-02 19:56:24 +080042 [ "$?" -ne 0 ] && echo "Ignore unsupported combination!" && continue
shijie.xiongec398682022-09-07 15:57:54 +080043 echo -n "$index. Building ... "
44 make package >> $BUILD_LOG 2>&1
shijie.xiong69cbf042022-04-22 13:32:39 +080045 get_new_package_dir
shijie.xiongec398682022-09-07 15:57:54 +080046 [ "$?" -ne 0 ] && echo "failed!" && cat $BUILD_LOG && echo -e "\nAborted with errors!\n" && exit 3
47 grep -qr "warning: " $BUILD_LOG
48 [ "$?" -eq 0 ] && cat $BUILD_LOG && echo -e "\nAborted with warnings!\n" && exit 1
49 echo "OK."
Kelvin Zhangd64c8832022-04-02 19:56:24 +080050 if [[ "$SUBMIT_TYPE" == "release" ]]; then
shijie.xiongec398682022-09-07 15:57:54 +080051 publish_packages >> $BUILD_LOG 2>&1
Kelvin Zhangaa84d882022-04-22 13:38:46 +080052 [ "$?" -ne 0 ] && echo "Failed to publish packages!" && exit 4
Kelvin Zhangd64c8832022-04-02 19:56:24 +080053 fi
54 index=$((index + 1))
55done <"$PACKAGE_COMBINATION"
56
shijie.xiongec398682022-09-07 15:57:54 +080057[[ "$SUBMIT_TYPE" == "release" ]] && post_publish_packages >> $BUILD_LOG 2>&1
58
59echo -e "======== Done ========\n" | tee -a $BUILD_LOG