1#!/bin/bash 2# Copyright (c) 2021 Huawei Device Co., Ltd. 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. 14 15set -e 16 17function do_make_ohos() { 18 local build_cmd="build/build_scripts/build_ohos.sh" 19 build_cmd+=" product_name=${product_name} target_os=${target_os} target_cpu=${target_cpu}" 20 build_cmd+=" gn_args=is_standard_system=true" 21 if [[ "${build_target}x" != "x" ]]; then 22 for target_name in ${build_target[@]}; do 23 echo $target_name 24 build_cmd+=" build_target=$target_name" 25 done 26 elif [[ "${product_name}" == "ohos-sdk" ]]; then 27 build_cmd+=" build_target=build_ohos_sdk" 28 else 29 build_cmd+=" build_target=images" 30 fi 31 32 if [[ "${gn_args}x" != "x" ]]; then 33 for _args in ${gn_args[@]}; do 34 build_cmd+=" gn_args=$_args" 35 done 36 fi 37 if [[ "${ninja_args}x" != "x" ]]; then 38 for _args in ${ninja_args[@]}; do 39 build_cmd+=" ninja_args=$_args" 40 done 41 fi 42 if [[ "${PYCACHE_ENABLE}" == true ]]; then 43 build_cmd+=" pycache_enable=true" 44 fi 45 if [[ "${build_only_gn}" == true ]]; then 46 build_cmd+=" build_only_gn=true" 47 fi 48 if [[ "${sparse_image}" == true ]]; then 49 build_cmd+=" gn_args=sparse_image=true" 50 fi 51 echo "build_ohos_cmd: $build_cmd" 52 $build_cmd 53} 54