blob: b235cc1dd9011b348212cb50a0e7f009cdd3f3ea [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 Zhang7052f1c2022-09-20 11:11:41 +08008[ -z "$OUTPUT_DIR" ] && OUTPUT_DIR=$PWD/output
9[ ! -d $OUTPUT_DIR ] && mkdir -p $OUTPUT_DIR
10
11[ -z "$BUILD_LOG" ] && BUILD_LOG="$OUTPUT_DIR/build.log"
Kelvin Zhangb56b9502022-09-01 15:18:43 +080012
Kelvin Zhang7abf25b2022-09-15 11:18:34 +080013# Clear build.log
14cat <<EOF > $BUILD_LOG
15EOF
16
Kelvin Zhangdfd28382022-04-02 20:32:27 +080017source scripts/publish.sh
Kelvin Zhang14bca5e2021-12-15 19:19:35 +080018
Kelvin Zhangd64c8832022-04-02 19:56:24 +080019if [[ "$SUBMIT_TYPE" == "daily" ]] || [[ "$SUBMIT_TYPE" == "release" ]]; then
Kelvin Zhang7abf25b2022-09-15 11:18:34 +080020 echo "======== Building document ========" | tee -a $BUILD_LOG
Kelvin Zhang1cbf9ed2022-09-13 16:27:50 +080021 make docs >> $BUILD_LOG 2>&1
Kelvin Zhang7052f1c2022-09-20 11:11:41 +080022 LOCAL_DOC_PATH="$OUTPUT_DIR/docs/html"
Kelvin Zhang1cbf9ed2022-09-13 16:27:50 +080023 if [ -d $LOCAL_DOC_PATH ]; then
24 pushd $LOCAL_DOC_PATH >/dev/null
25 publish_docoment
26 if [ $? -ne 0 ]; then
27 echo "Failed to update document!"
28 else
29 echo "Document updated."
30 fi
31 popd >/dev/null
Kelvin Zhang23075212022-02-11 18:26:18 +080032 else
Kelvin Zhang1cbf9ed2022-09-13 16:27:50 +080033 echo "$LOCAL_DOC_PATH not exist!"
Kelvin Zhang23075212022-02-11 18:26:18 +080034 fi
Kelvin Zhang1cbf9ed2022-09-13 16:27:50 +080035 echo -e "======== Done ========\n" | tee -a $BUILD_LOG
Kelvin Zhang09786122022-02-11 15:56:08 +080036fi
37
Kelvin Zhangc37221a2022-09-07 15:18:12 +080038echo "======== Building all projects ========" | tee -a $BUILD_LOG
Kelvin Zhang69dc9fb2022-02-18 16:44:04 +080039
Kelvin Zhangb56b9502022-09-01 15:18:43 +080040source scripts/gen_build_combination.sh
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080041
42nr=0
Kelvin Zhang14bca5e2021-12-15 19:19:35 +080043while IFS= read -r LINE; do
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080044 nr=$((nr+1))
Kelvin Zhangc18bac62022-03-14 10:31:57 +080045
46 check_project "$LINE"
47 [ "$?" -ne 0 ] && continue
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080048 source scripts/env.sh $LINE >> $BUILD_LOG 2>&1
49 [ "$?" -ne 0 ] && echo "Ignore unsupported combination! $LINE" && continue
kelvin.zhang05852a72022-01-19 10:30:24 +080050 make distclean
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080051 [ "$?" -ne 0 ] && echo "Failed to make distclean! $LINE" && exit 2
52 echo -n "$nr. Building $LINE ... "
53 make >> $BUILD_LOG 2>&1
Kelvin Zhang6305ae32022-09-06 17:55:51 +080054 [ "$?" -ne 0 ] && echo "failed!" && cat $BUILD_LOG && echo -e "\nAborted with errors!\n" && exit 3
Kelvin Zhangb56b9502022-09-01 15:18:43 +080055 grep -qr "warning: " $BUILD_LOG
Kelvin Zhang6305ae32022-09-06 17:55:51 +080056 [ "$?" -eq 0 ] && cat $BUILD_LOG && echo -e "\nAborted with warnings!\n" && exit 1
Kelvin Zhangb56b9502022-09-01 15:18:43 +080057 echo "OK."
Xiaohu.Huang7dac8722022-01-18 16:21:29 +080058 if [[ "$SUBMIT_TYPE" == "daily" ]]; then
Kelvin Zhangb56b9502022-09-01 15:18:43 +080059 if [[ "$ARCH" == "arm64" ]] && [[ "$PRODUCT" == "speaker" ]]; then
Kelvin Zhangd91e47e2022-08-31 20:44:20 +080060 make_image >> $BUILD_LOG 2>&1
61 fi
62 publish_images >> $BUILD_LOG 2>&1
Kelvin Zhangaa84d882022-04-22 13:38:46 +080063 [ "$?" -ne 0 ] && echo "Failed to publish images!" && exit 4
bin.chen439b9342022-01-18 13:35:42 +080064 fi
shijie.xiongbc5d3672022-04-01 17:52:16 +080065done <"$BUILD_COMBINATION"
66
Kelvin Zhangb56b9502022-09-01 15:18:43 +080067[[ "$SUBMIT_TYPE" == "daily" ]] && post_publish_images >> $BUILD_LOG 2>&1
68
Kelvin Zhangc37221a2022-09-07 15:18:12 +080069echo -e "======== Done ========\n" | tee -a $BUILD_LOG