106f6ba60Sopenharmony_ci# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. 206f6ba60Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 306f6ba60Sopenharmony_ci# you may not use this file except in compliance with the License. 406f6ba60Sopenharmony_ci# You may obtain a copy of the License at 506f6ba60Sopenharmony_ci# 606f6ba60Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 706f6ba60Sopenharmony_ci# 806f6ba60Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 906f6ba60Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1006f6ba60Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1106f6ba60Sopenharmony_ci# See the License for the specific language governing permissions and 1206f6ba60Sopenharmony_ci# limitations under the License. 1306f6ba60Sopenharmony_ci 1406f6ba60Sopenharmony_ciimport("//build/ohos.gni") 1506f6ba60Sopenharmony_ciimport("../protos.gni") 1606f6ba60Sopenharmony_ci 1706f6ba60Sopenharmony_ci####################################################### 1806f6ba60Sopenharmony_ciproto_out_dir = "$root_gen_dir/cpp/" + rebase_path(".", "//") 1906f6ba60Sopenharmony_ciproto_rel_out_dir = rebase_path(proto_out_dir, root_build_dir) 2006f6ba60Sopenharmony_ci 2106f6ba60Sopenharmony_cigrpc_cpp_plugin = "$subsys_x64_out/grpc_cpp_plugin" 2206f6ba60Sopenharmony_ciipc_cpp_plugin = "$proto_gen_ipc_dir/protoc_gen_ipc" 2306f6ba60Sopenharmony_ci 2406f6ba60Sopenharmony_ciconfig("public_configs") { 2506f6ba60Sopenharmony_ci include_dirs = [ "$proto_out_dir" ] 2606f6ba60Sopenharmony_ci} 2706f6ba60Sopenharmony_ci 2806f6ba60Sopenharmony_ci####################################################### 2906f6ba60Sopenharmony_ciall_type_proto = [ 3006f6ba60Sopenharmony_ci "./common_types.proto", 3106f6ba60Sopenharmony_ci "./profiler_service_types.proto", 3206f6ba60Sopenharmony_ci "./plugin_service_types.proto", 3306f6ba60Sopenharmony_ci] 3406f6ba60Sopenharmony_ci 3506f6ba60Sopenharmony_cicommon_type_proto = [ "./common_types.proto" ] 3606f6ba60Sopenharmony_ci 3706f6ba60Sopenharmony_ciall_type_codegen = [] 3806f6ba60Sopenharmony_ciforeach(proto, all_type_proto) { 3906f6ba60Sopenharmony_ci name = get_path_info(proto, "name") 4006f6ba60Sopenharmony_ci all_type_codegen += [ 4106f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.h", 4206f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.cc", 4306f6ba60Sopenharmony_ci ] 4406f6ba60Sopenharmony_ci} 4506f6ba60Sopenharmony_ci 4606f6ba60Sopenharmony_cilite_codegen = [] 4706f6ba60Sopenharmony_ciforeach(proto, common_type_proto) { 4806f6ba60Sopenharmony_ci name = get_path_info(proto, "name") 4906f6ba60Sopenharmony_ci lite_codegen += [ 5006f6ba60Sopenharmony_ci "$proto_out_dir/${name}_lite.pb.h", 5106f6ba60Sopenharmony_ci "$proto_out_dir/${name}_lite.pb.cc", 5206f6ba60Sopenharmony_ci ] 5306f6ba60Sopenharmony_ci} 5406f6ba60Sopenharmony_ci 5506f6ba60Sopenharmony_ciaction("all_type_gen") { 5606f6ba60Sopenharmony_ci script = "${OHOS_PROFILER_DIR}/build/protoc.sh" 5706f6ba60Sopenharmony_ci sources = all_type_proto 5806f6ba60Sopenharmony_ci outputs = all_type_codegen 5906f6ba60Sopenharmony_ci outputs += lite_codegen 6006f6ba60Sopenharmony_ci args = [ 6106f6ba60Sopenharmony_ci "$libc_dir_proto", 6206f6ba60Sopenharmony_ci "$root_output_dir_proto", 6306f6ba60Sopenharmony_ci "$proto_rel_out_dir", # standard proto file destination path 6406f6ba60Sopenharmony_ci "--cpp_out", 6506f6ba60Sopenharmony_ci "$proto_rel_out_dir", 6606f6ba60Sopenharmony_ci "--proto_path", 6706f6ba60Sopenharmony_ci rebase_path(".", root_build_dir), 6806f6ba60Sopenharmony_ci ] 6906f6ba60Sopenharmony_ci args += rebase_path(sources, root_build_dir) 7006f6ba60Sopenharmony_ci deps = [ "${OHOS_PROFILER_DIR}/device/services/ipc:protoencoder_plugin(${host_toolchain})" ] 7106f6ba60Sopenharmony_ci external_deps = [ 7206f6ba60Sopenharmony_ci "grpc:grpc_cpp_plugin(${host_toolchain})", 7306f6ba60Sopenharmony_ci "protobuf:protoc(${host_toolchain})", 7406f6ba60Sopenharmony_ci ] 7506f6ba60Sopenharmony_ci} 7606f6ba60Sopenharmony_ci 7706f6ba60Sopenharmony_ci######################################################## 7806f6ba60Sopenharmony_ciprofiler_service_type_proto = [ 7906f6ba60Sopenharmony_ci "./common_types.proto", 8006f6ba60Sopenharmony_ci "./profiler_service_types.proto", 8106f6ba60Sopenharmony_ci] 8206f6ba60Sopenharmony_ci 8306f6ba60Sopenharmony_ciprofiler_service_type_codegen = [] 8406f6ba60Sopenharmony_ciforeach(proto, profiler_service_type_proto) { 8506f6ba60Sopenharmony_ci name = get_path_info(proto, "name") 8606f6ba60Sopenharmony_ci profiler_service_type_codegen += [ 8706f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.h", 8806f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.cc", 8906f6ba60Sopenharmony_ci ] 9006f6ba60Sopenharmony_ci} 9106f6ba60Sopenharmony_ci 9206f6ba60Sopenharmony_ciohos_source_set("profiler_service_type_source") { 9306f6ba60Sopenharmony_ci deps = [ ":all_type_gen" ] 9406f6ba60Sopenharmony_ci external_deps = [ 9506f6ba60Sopenharmony_ci "protobuf:protobuf", 9606f6ba60Sopenharmony_ci "protobuf:protobuf_lite", 9706f6ba60Sopenharmony_ci ] 9806f6ba60Sopenharmony_ci include_dirs = [ "$proto_out_dir" ] 9906f6ba60Sopenharmony_ci public_configs = [ ":public_configs" ] 10006f6ba60Sopenharmony_ci sources = profiler_service_type_codegen 10106f6ba60Sopenharmony_ci subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 10206f6ba60Sopenharmony_ci part_name = "${OHOS_PROFILER_PART_NAME}" 10306f6ba60Sopenharmony_ci} 10406f6ba60Sopenharmony_ci 10506f6ba60Sopenharmony_ciohos_source_set("profiler_service_all_type_source") { 10606f6ba60Sopenharmony_ci deps = [ ":all_type_gen" ] 10706f6ba60Sopenharmony_ci external_deps = [ 10806f6ba60Sopenharmony_ci "protobuf:protobuf", 10906f6ba60Sopenharmony_ci "protobuf:protobuf_lite", 11006f6ba60Sopenharmony_ci ] 11106f6ba60Sopenharmony_ci include_dirs = [ "$proto_out_dir" ] 11206f6ba60Sopenharmony_ci public_configs = [ ":public_configs" ] 11306f6ba60Sopenharmony_ci sources = all_type_codegen 11406f6ba60Sopenharmony_ci subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 11506f6ba60Sopenharmony_ci part_name = "${OHOS_PROFILER_PART_NAME}" 11606f6ba60Sopenharmony_ci} 11706f6ba60Sopenharmony_ci 11806f6ba60Sopenharmony_ci######################################################## 11906f6ba60Sopenharmony_ciprofiler_service_interface_proto = [ "./profiler_service.proto" ] 12006f6ba60Sopenharmony_ci 12106f6ba60Sopenharmony_ciprofiler_service_interface_codegen = [] 12206f6ba60Sopenharmony_ciforeach(proto, profiler_service_interface_proto) { 12306f6ba60Sopenharmony_ci name = get_path_info(proto, "name") 12406f6ba60Sopenharmony_ci profiler_service_interface_codegen += [ 12506f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.h", 12606f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.cc", 12706f6ba60Sopenharmony_ci "$proto_out_dir/$name.grpc.pb.h", 12806f6ba60Sopenharmony_ci "$proto_out_dir/$name.grpc.pb.cc", 12906f6ba60Sopenharmony_ci ] 13006f6ba60Sopenharmony_ci} 13106f6ba60Sopenharmony_ci 13206f6ba60Sopenharmony_ciaction("profiler_service_interface_gen") { 13306f6ba60Sopenharmony_ci script = "${OHOS_PROFILER_DIR}/build/protoc.sh" 13406f6ba60Sopenharmony_ci sources = profiler_service_interface_proto 13506f6ba60Sopenharmony_ci outputs = profiler_service_interface_codegen 13606f6ba60Sopenharmony_ci args = [ 13706f6ba60Sopenharmony_ci "$libc_dir_proto", 13806f6ba60Sopenharmony_ci "$root_output_dir_proto", 13906f6ba60Sopenharmony_ci "$proto_rel_out_dir", # standard proto file destination path 14006f6ba60Sopenharmony_ci "--plugin=protoc-gen-grpc=$grpc_cpp_plugin", 14106f6ba60Sopenharmony_ci "--grpc_out", 14206f6ba60Sopenharmony_ci "$proto_rel_out_dir", 14306f6ba60Sopenharmony_ci "--cpp_out", 14406f6ba60Sopenharmony_ci "$proto_rel_out_dir", 14506f6ba60Sopenharmony_ci "--proto_path", 14606f6ba60Sopenharmony_ci rebase_path(".", root_build_dir), 14706f6ba60Sopenharmony_ci ] 14806f6ba60Sopenharmony_ci args += rebase_path(sources, root_build_dir) 14906f6ba60Sopenharmony_ci deps = [ ":all_type_gen" ] 15006f6ba60Sopenharmony_ci external_deps = [ 15106f6ba60Sopenharmony_ci "grpc:grpc_cpp_plugin(//build/toolchain/linux:clang_${host_cpu})", 15206f6ba60Sopenharmony_ci "protobuf:protoc(//build/toolchain/linux:clang_${host_cpu})", 15306f6ba60Sopenharmony_ci ] 15406f6ba60Sopenharmony_ci} 15506f6ba60Sopenharmony_ci 15606f6ba60Sopenharmony_ciohos_source_set("profiler_service_proto") { 15706f6ba60Sopenharmony_ci deps = [ 15806f6ba60Sopenharmony_ci ":all_type_gen", 15906f6ba60Sopenharmony_ci ":profiler_service_interface_gen", 16006f6ba60Sopenharmony_ci ] 16106f6ba60Sopenharmony_ci external_deps = [ 16206f6ba60Sopenharmony_ci "grpc:grpc", 16306f6ba60Sopenharmony_ci "grpc:grpcxx", 16406f6ba60Sopenharmony_ci "protobuf:protobuf", 16506f6ba60Sopenharmony_ci "protobuf:protobuf_lite", 16606f6ba60Sopenharmony_ci ] 16706f6ba60Sopenharmony_ci include_dirs = [ "$proto_out_dir" ] 16806f6ba60Sopenharmony_ci public_configs = [ ":public_configs" ] 16906f6ba60Sopenharmony_ci sources = profiler_service_interface_codegen 17006f6ba60Sopenharmony_ci subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 17106f6ba60Sopenharmony_ci part_name = "${OHOS_PROFILER_PART_NAME}" 17206f6ba60Sopenharmony_ci} 17306f6ba60Sopenharmony_ci 17406f6ba60Sopenharmony_ci######################################################## 17506f6ba60Sopenharmony_ciplugin_service_type_proto = [ 17606f6ba60Sopenharmony_ci "./common_types.proto", 17706f6ba60Sopenharmony_ci "./plugin_service_types.proto", 17806f6ba60Sopenharmony_ci] 17906f6ba60Sopenharmony_ci 18006f6ba60Sopenharmony_ciplugin_service_type_codegen = [] 18106f6ba60Sopenharmony_ciforeach(proto, plugin_service_type_proto) { 18206f6ba60Sopenharmony_ci name = get_path_info(proto, "name") 18306f6ba60Sopenharmony_ci plugin_service_type_codegen += [ 18406f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.h", 18506f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.cc", 18606f6ba60Sopenharmony_ci ] 18706f6ba60Sopenharmony_ci} 18806f6ba60Sopenharmony_ci 18906f6ba60Sopenharmony_ci######################################################## 19006f6ba60Sopenharmony_ciplugin_service_interface_proto = [ "./plugin_service.proto" ] 19106f6ba60Sopenharmony_ci 19206f6ba60Sopenharmony_ciplugin_service_interface_codegen = [] 19306f6ba60Sopenharmony_ciforeach(proto, plugin_service_interface_proto) { 19406f6ba60Sopenharmony_ci name = get_path_info(proto, "name") 19506f6ba60Sopenharmony_ci plugin_service_interface_codegen += [ 19606f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.h", 19706f6ba60Sopenharmony_ci "$proto_out_dir/$name.pb.cc", 19806f6ba60Sopenharmony_ci "$proto_out_dir/$name.ipc.h", 19906f6ba60Sopenharmony_ci "$proto_out_dir/$name.ipc.cc", 20006f6ba60Sopenharmony_ci ] 20106f6ba60Sopenharmony_ci} 20206f6ba60Sopenharmony_ci 20306f6ba60Sopenharmony_ciaction("plugin_service_interface_proto_gen") { 20406f6ba60Sopenharmony_ci script = "${OHOS_PROFILER_DIR}/build/protoc.sh" 20506f6ba60Sopenharmony_ci sources = plugin_service_interface_proto 20606f6ba60Sopenharmony_ci outputs = plugin_service_interface_codegen 20706f6ba60Sopenharmony_ci args = [ 20806f6ba60Sopenharmony_ci "$libc_dir_proto", 20906f6ba60Sopenharmony_ci "$root_output_dir_proto", 21006f6ba60Sopenharmony_ci "$proto_rel_out_dir", # standard proto file destination path 21106f6ba60Sopenharmony_ci "--plugin=protoc-gen-ipc=$ipc_cpp_plugin", 21206f6ba60Sopenharmony_ci "--ipc_out", 21306f6ba60Sopenharmony_ci "$proto_rel_out_dir", 21406f6ba60Sopenharmony_ci "--cpp_out", 21506f6ba60Sopenharmony_ci "$proto_rel_out_dir", 21606f6ba60Sopenharmony_ci "--proto_path", 21706f6ba60Sopenharmony_ci rebase_path(".", root_build_dir), 21806f6ba60Sopenharmony_ci ] 21906f6ba60Sopenharmony_ci args += rebase_path(sources, root_build_dir) 22006f6ba60Sopenharmony_ci deps = [ 22106f6ba60Sopenharmony_ci ":all_type_gen", 22206f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/services/ipc:protoc_gen_ipc(${host_toolchain})", 22306f6ba60Sopenharmony_ci ] 22406f6ba60Sopenharmony_ci external_deps = [ "protobuf:protoc(${host_toolchain})" ] 22506f6ba60Sopenharmony_ci} 22606f6ba60Sopenharmony_ci 22706f6ba60Sopenharmony_ciohos_source_set("plugin_service_proto") { 22806f6ba60Sopenharmony_ci deps = [ 22906f6ba60Sopenharmony_ci ":all_type_gen", 23006f6ba60Sopenharmony_ci ":plugin_service_interface_proto_gen", 23106f6ba60Sopenharmony_ci ] 23206f6ba60Sopenharmony_ci public_deps = [ "${OHOS_PROFILER_DIR}/device/services/ipc:ipc" ] 23306f6ba60Sopenharmony_ci external_deps = [ 23406f6ba60Sopenharmony_ci "protobuf:protobuf", 23506f6ba60Sopenharmony_ci "protobuf:protobuf_lite", 23606f6ba60Sopenharmony_ci ] 23706f6ba60Sopenharmony_ci include_dirs = [ 23806f6ba60Sopenharmony_ci "$proto_out_dir", 23906f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/services/ipc/include", 24006f6ba60Sopenharmony_ci ] 24106f6ba60Sopenharmony_ci public_configs = [ ":public_configs" ] 24206f6ba60Sopenharmony_ci sources = plugin_service_interface_codegen 24306f6ba60Sopenharmony_ci subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 24406f6ba60Sopenharmony_ci part_name = "${OHOS_PROFILER_PART_NAME}" 24506f6ba60Sopenharmony_ci} 24606f6ba60Sopenharmony_ci 24706f6ba60Sopenharmony_ci####################################################### 24806f6ba60Sopenharmony_ciohos_source_set("proto_services_cpp") { 24906f6ba60Sopenharmony_ci public_deps = [ 25006f6ba60Sopenharmony_ci ":plugin_service_proto", 25106f6ba60Sopenharmony_ci ":profiler_service_all_type_source", 25206f6ba60Sopenharmony_ci ":profiler_service_proto", 25306f6ba60Sopenharmony_ci ] 25406f6ba60Sopenharmony_ci subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 25506f6ba60Sopenharmony_ci part_name = "${OHOS_PROFILER_PART_NAME}" 25606f6ba60Sopenharmony_ci} 25706f6ba60Sopenharmony_ci 25806f6ba60Sopenharmony_ciohos_source_set("common_types_lite_proto") { 25906f6ba60Sopenharmony_ci deps = [ ":all_type_gen" ] 26006f6ba60Sopenharmony_ci external_deps = [ 26106f6ba60Sopenharmony_ci "protobuf:protobuf", 26206f6ba60Sopenharmony_ci "protobuf:protobuf_lite", 26306f6ba60Sopenharmony_ci ] 26406f6ba60Sopenharmony_ci include_dirs = [ "$proto_out_dir" ] 26506f6ba60Sopenharmony_ci public_configs = [ ":public_configs" ] 26606f6ba60Sopenharmony_ci sources = lite_codegen 26706f6ba60Sopenharmony_ci subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 26806f6ba60Sopenharmony_ci part_name = "${OHOS_PROFILER_PART_NAME}" 26906f6ba60Sopenharmony_ci} 270