blob: ae3fb217e00c37c3d8dae455b7338ee8adb7f88a [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 Zhang09786122022-02-11 15:56:08 +08008# usage:./scripts/build_all.sh at rtos sdk root dir
Kelvin Zhang14bca5e2021-12-15 19:19:35 +08009
Xiaohu.Huangb6ad9762022-02-11 17:49:09 +080010BUILD_COMBINATION="$PWD/scripts/build_combination.txt"
Kelvin Zhang23075212022-02-11 18:26:18 +080011LOCAL_DOC_PATH="$PWD/output/docs/html"
12SERVER_DOC_PATH="ftp://platform:platform@10.68.11.163:2222/Documents/Ecosystem/RTOS/rtos-sdk/"
Kelvin Zhang14bca5e2021-12-15 19:19:35 +080013
Kelvin Zhang09786122022-02-11 15:56:08 +080014# Build and upload document
Kelvin Zhang1fea9142022-02-11 18:19:56 +080015update_docoment()
16{
17 find -type f | while read filename
18 do
19 curl --ftp-create-dirs -T $filename $DOC_SERVER_PATH
20 if [ $? -ne 0 ]; then
21 return 1;
22 fi
23 done
24}
25
Kelvin Zhang09786122022-02-11 15:56:08 +080026if [[ "$SUBMIT_TYPE" == "daily" ]]; then
27 make docs
Kelvin Zhang23075212022-02-11 18:26:18 +080028 if [ -d $LOCAL_DOC_PATH ]
29 cd $LOCAL_DOC_PATH
30 update_docoment
31 if [ $? -ne 0 ]; then
32 echo "Failed to update document"
33 else
34 echo "Document updated!"
35 fi
Kelvin Zhang1fea9142022-02-11 18:19:56 +080036 else
Kelvin Zhang23075212022-02-11 18:26:18 +080037 echo "$LOCAL_DOC_PATH not exist!"
Kelvin Zhang7f0d2e02022-02-14 10:16:35 +080038 fi
Kelvin Zhang1fea9142022-02-11 18:19:56 +080039 cd -
Kelvin Zhang09786122022-02-11 15:56:08 +080040fi
41
Kelvin Zhang0f465a02022-02-11 15:39:54 +080042# Build all projects
Kelvin Zhang14bca5e2021-12-15 19:19:35 +080043i=0
44while IFS= read -r LINE; do
45 [[ "$i" -ne 0 ]] && echo ""
46 i=$((i+1))
Kelvin Zhang14bca5e2021-12-15 19:19:35 +080047 source scripts/env.sh $LINE
Xiaohu.Huangb6ad9762022-02-11 17:49:09 +080048 [ "$?" -ne 0 ] && echo "Failed to source scripts/env.sh!" && exit 1
kelvin.zhang05852a72022-01-19 10:30:24 +080049 make distclean
Xiaohu.Huangb6ad9762022-02-11 17:49:09 +080050 [ "$?" -ne 0 ] && echo "Failed to make distclean!" && exit 2
bin.chene9875112022-01-18 15:00:50 +080051 make
Xiaohu.Huangb6ad9762022-02-11 17:49:09 +080052 [ "$?" -ne 0 ] && echo "Failed to make!" && exit 3
Xiaohu.Huang7dac8722022-01-18 16:21:29 +080053 if [[ "$SUBMIT_TYPE" == "daily" ]]; then
bin.chen439b9342022-01-18 13:35:42 +080054 source scripts/scp.sh
Xiaohu.Huangb6ad9762022-02-11 17:49:09 +080055 [ "$?" -ne 0 ] && echo "Failed to source scripts/scp.sh!" && exit 4
bin.chen439b9342022-01-18 13:35:42 +080056 fi
Kelvin Zhang14bca5e2021-12-15 19:19:35 +080057done < "$BUILD_COMBINATION"