• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
14SOURCE="${BASH_SOURCE[0]}"
15cd $(dirname ${SOURCE})
16echo "begin to generate proto based files"
17SOURCE=$(dirname ${SOURCE})
18proto_dir="."
19services_dir="$proto_dir/services"
20ftrace_data_dir="$proto_dir/types/plugins/ftrace_data"
21memory_data_dir="$proto_dir/types/plugins/memory_data"
22hilog_data_dir="$proto_dir/types/plugins/hilog_data"
23native_hook_dir="$proto_dir/types/plugins/native_hook"
24hidump_data_dir="$proto_dir/types/plugins/hidump_data"
25arrayWen=("${services_dir}/common_types.proto"
26    "$ftrace_data_dir/trace_plugin_result.proto"
27    "$ftrace_data_dir/ftrace_event.proto"
28    "$ftrace_data_dir/irq.proto"
29    "$ftrace_data_dir/vmscan.proto"
30    "$ftrace_data_dir/workqueue.proto"
31    "$ftrace_data_dir/task.proto"
32    "$ftrace_data_dir/power.proto"
33    "$ftrace_data_dir/sched.proto"
34    "$ftrace_data_dir/filemap.proto"
35    "$ftrace_data_dir/i2c.proto"
36    "$ftrace_data_dir/kmem.proto"
37    "$ftrace_data_dir/block.proto"
38    "$ftrace_data_dir/ipi.proto"
39    "$ftrace_data_dir/ftrace.proto"
40    "$ftrace_data_dir/ext4.proto"
41    "$ftrace_data_dir/oom.proto"
42    "$ftrace_data_dir/compaction.proto"
43    "$ftrace_data_dir/clk.proto"
44    "$ftrace_data_dir/cgroup.proto"
45    "$ftrace_data_dir/binder.proto"
46    "$ftrace_data_dir/signal.proto"
47    "$ftrace_data_dir/sunrpc.proto"
48    "$ftrace_data_dir/net.proto"
49    "$ftrace_data_dir/cpuhp.proto"
50    "$ftrace_data_dir/writeback.proto"
51    "$ftrace_data_dir/v4l2.proto"
52    "$ftrace_data_dir/pagemap.proto"
53    "$ftrace_data_dir/dma_fence.proto"
54    "$ftrace_data_dir/printk.proto"
55    "$ftrace_data_dir/filelock.proto"
56    "$ftrace_data_dir/gpio.proto"
57    "$ftrace_data_dir/timer.proto"
58    "$ftrace_data_dir/raw_syscalls.proto"
59    "$ftrace_data_dir/rcu.proto"
60    "$memory_data_dir/memory_plugin_common.proto"
61    "$memory_data_dir/memory_plugin_config.proto"
62    "$memory_data_dir/memory_plugin_result.proto"
63    "$hilog_data_dir/hilog_plugin_result.proto"
64    "$native_hook_dir/native_hook_result.proto"
65    "$native_hook_dir/native_hook_config.proto"
66    "$hidump_data_dir/hidump_plugin_result.proto"
67    "$hidump_data_dir/hidump_plugin_config.proto")
68
69export LD_LIBRARY_PATH=../../out/linux
70for ((i = 0; i < ${#arrayWen[@]}; i ++))
71do
72   newpath=$(dirname ${arrayWen[$i]})
73   newpath=${newpath:2}
74   cppout=../../third_party/protogen/$newpath
75   mkdir -p $cppout
76   ../../out/linux/protoc --proto_path=$memory_data_dir:$native_hook_dir:$hidump_data_dir:$hilog_data_dir:$ftrace_data_dir:$services_dir --cpp_out=$cppout ${arrayWen[$i]}
77done
78echo "generate proto based files over"