1fb726d48Sopenharmony_ci#!/bin/bash
2fb726d48Sopenharmony_ci# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
3fb726d48Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
4fb726d48Sopenharmony_ci# you may not use this file except in compliance with the License.
5fb726d48Sopenharmony_ci# You may obtain a copy of the License at
6fb726d48Sopenharmony_ci#
7fb726d48Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
8fb726d48Sopenharmony_ci#
9fb726d48Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
10fb726d48Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
11fb726d48Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fb726d48Sopenharmony_ci# See the License for the specific language governing permissions and
13fb726d48Sopenharmony_ci# limitations under the License.
14fb726d48Sopenharmony_ciset -e
15fb726d48Sopenharmony_ciSOURCE="${BASH_SOURCE[0]}"
16fb726d48Sopenharmony_cicd $(dirname ${SOURCE})
17fb726d48Sopenharmony_ciecho "begin to generate proto based files"
18fb726d48Sopenharmony_ciSOURCE=$(dirname ${SOURCE})
19fb726d48Sopenharmony_ciproto_dir="."
20fb726d48Sopenharmony_ciservices_dir="$proto_dir/services"
21fb726d48Sopenharmony_ci# kernel_version="5.10.79_aarch64"
22fb726d48Sopenharmony_cikernel_version="."
23fb726d48Sopenharmony_cimock_data_dir="$proto_dir/types/plugins/mock_data"
24fb726d48Sopenharmony_ciproto_array=("$mock_data_dir/mock_plugin_result.proto")
25fb726d48Sopenharmony_ci
26fb726d48Sopenharmony_ciexport LD_LIBRARY_PATH=../../out/linux
27fb726d48Sopenharmony_cifor ((i = 0; i < ${#proto_array[@]}; i ++))
28fb726d48Sopenharmony_cido
29fb726d48Sopenharmony_ci   newpath=$(dirname ${proto_array[$i]})
30fb726d48Sopenharmony_ci   newpath=${newpath:2}
31fb726d48Sopenharmony_ci   cppout=../../third_party/protogen/$newpath
32fb726d48Sopenharmony_ci   mkdir -p $cppout
33fb726d48Sopenharmony_ci   ../../../out/linux/protoc --proto_path=$mock_data_dir --cpp_out=$cppout ${proto_array[$i]}
34fb726d48Sopenharmony_cidone
35fb726d48Sopenharmony_ciecho "generate proto based files over"
36