blob: 8c3555bd41e791fe86bb6b47c820c4db7b377674 [file] [log] [blame]
Kelvin Zhang14bca5e2021-12-15 19:19:35 +08001#!/bin/bash
yang.li09520922022-01-12 15:51:51 +08002#
yang.liffa60e52022-01-11 14:38:56 +08003# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
yang.li09520922022-01-12 15:51:51 +08004#
yang.liffa60e52022-01-11 14:38:56 +08005# SPDX-License-Identifier: MIT
yang.li09520922022-01-12 15:51:51 +08006#
yang.liffa60e52022-01-11 14:38:56 +08007
Kelvin Zhangb56b9502022-09-01 15:18:43 +08008[ -z "$BUILD_LOG" ] && BUILD_LOG="output/build.log"
9# Clear build log
10cat <<EOF > $BUILD_LOG
11EOF
12
Kelvin Zhangdfd28382022-04-02 20:32:27 +080013source scripts/publish.sh
Kelvin Zhang14bca5e2021-12-15 19:19:35 +080014
Kelvin Zhangd64c8832022-04-02 19:56:24 +080015if [[ "$SUBMIT_TYPE" == "daily" ]] || [[ "$SUBMIT_TYPE" == "release" ]]; then
Kelvin Zhangb56b9502022-09-01 15:18:43 +080016echo "======== Building document ========" | tee $BUILD_LOG
17
18 make docs >> $BUILD_LOG 2>&1
kelvin.zhang77dd5442022-02-14 10:26:15 +080019 if [ -d $LOCAL_DOC_PATH ]; then
shijie.xiongbc5d3672022-04-01 17:52:16 +080020 pushd $LOCAL_DOC_PATH >/dev/null
Kelvin Zhangd64c8832022-04-02 19:56:24 +080021 publish_docoment
Kelvin Zhang23075212022-02-11 18:26:18 +080022 if [ $? -ne 0 ]; then
Kelvin Zhangb56b9502022-09-01 15:18:43 +080023 echo "Failed to update document!"
Kelvin Zhang23075212022-02-11 18:26:18 +080024 else
Kelvin Zhangb56b9502022-09-01 15:18:43 +080025 echo "Document updated."
Kelvin Zhang23075212022-02-11 18:26:18 +080026 fi
shijie.xiongbc5d3672022-04-01 17:52:16 +080027 popd >/dev/null
Kelvin Zhang1fea9142022-02-11 18:19:56 +080028 else
Kelvin Zhang23075212022-02-11 18:26:18 +080029 echo "$LOCAL_DOC_PATH not exist!"
Kelvin Zhang7f0d2e02022-02-14 10:16:35 +080030 fi
Kelvin Zhangb56b9502022-09-01 15:18:43 +080031echo -e "======== Done ========\n" | tee $BUILD_LOG
Kelvin Zhang09786122022-02-11 15:56:08 +080032fi
33
Kelvin Zhangb56b9502022-09-01 15:18:43 +080034echo "======== Building all projects ========" | tee $BUILD_LOG
Kelvin Zhang69dc9fb2022-02-18 16:44:04 +080035
Kelvin Zhangb56b9502022-09-01 15:18:43 +080036source scripts/gen_build_combination.sh
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080037
38nr=0
Kelvin Zhang14bca5e2021-12-15 19:19:35 +080039while IFS= read -r LINE; do
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080040 nr=$((nr+1))
Kelvin Zhangc18bac62022-03-14 10:31:57 +080041
42 check_project "$LINE"
43 [ "$?" -ne 0 ] && continue
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080044 source scripts/env.sh $LINE >> $BUILD_LOG 2>&1
45 [ "$?" -ne 0 ] && echo "Ignore unsupported combination! $LINE" && continue
kelvin.zhang05852a72022-01-19 10:30:24 +080046 make distclean
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080047 [ "$?" -ne 0 ] && echo "Failed to make distclean! $LINE" && exit 2
48 echo -n "$nr. Building $LINE ... "
49 make >> $BUILD_LOG 2>&1
Kelvin Zhangb56b9502022-09-01 15:18:43 +080050 [ "$?" -ne 0 ] && echo "failed!" && cat $BUILD_LOG && echo -e "\nAborted with errors!" && exit 3
51 grep -qr "warning: " $BUILD_LOG
52 [ "$?" -eq 0 ] && cat $BUILD_LOG && echo -e "\nAborted with warnings!" && exit 1
53 echo "OK."
Xiaohu.Huang7dac8722022-01-18 16:21:29 +080054 if [[ "$SUBMIT_TYPE" == "daily" ]]; then
Kelvin Zhangb56b9502022-09-01 15:18:43 +080055 if [[ "$ARCH" == "arm64" ]] && [[ "$PRODUCT" == "speaker" ]]; then
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080056 make_image >> $BUILD_LOG 2>&1
57 fi
58 publish_images >> $BUILD_LOG 2>&1
Kelvin Zhangaa84d882022-04-22 13:38:46 +080059 [ "$?" -ne 0 ] && echo "Failed to publish images!" && exit 4
bin.chen439b9342022-01-18 13:35:42 +080060 fi
shijie.xiongbc5d3672022-04-01 17:52:16 +080061done <"$BUILD_COMBINATION"
62
Kelvin Zhangb56b9502022-09-01 15:18:43 +080063[[ "$SUBMIT_TYPE" == "daily" ]] && post_publish_images >> $BUILD_LOG 2>&1
64
65echo -e "======== Done ========\n" | tee $BUILD_LOG