1#!/bin/bash 2# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14set -e 15. build/build_base.sh 16 17function check_plugin_true() { 18 if [ "$1" == "false" ];then 19 echo "Current plugins haven't '$2'!Please check!" 20 exit 21 fi 22} 23 24function enable_plugin() { 25 check_params $1 26 set_enable_plugin_array "false" 27 read -ra plugins <<< "$1" 28 local flag='false' 29 for plugin in "${plugins[@]}"; do 30 for enable_plugin in "${enable_plugin_array[@]}"; do 31 if [[ "$enable_plugin" == *"$plugin"* ]]; then 32 eval "$enable_plugin=\"true\"" 33 echo "$enable_plugin=${!enable_plugin}" 34 flag="true" 35 fi 36 done 37 check_plugin_true $flag $plugin 38 flag="false" 39 done 40} 41 42function enable_extend_plugin() { 43 check_params "$1" 44 set_enable_extend_plugin_array "false" 45 read -ra plugins <<< "$1" 46 local flag_extend='false' 47 for plugin in "${plugins[@]}"; do 48 for enable_extend_plugin in "${enable_extend_plugin_array[@]}"; do 49 if [[ "$enable_extend_plugin" == *"$plugin"* ]]; then 50 eval "$enable_extend_plugin=\"true\"" 51 echo "$enable_extend_plugin=${!enable_extend_plugin}" 52 flag_extend="true" 53 fi 54 done 55 check_plugin_true $flag_extend $plugin 56 flag_extend="false" 57 done 58} 59 60