16ea96550Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
26ea96550Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
36ea96550Sopenharmony_ci# you may not use this file except in compliance with the License.
46ea96550Sopenharmony_ci# You may obtain a copy of the License at
56ea96550Sopenharmony_ci#
66ea96550Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
76ea96550Sopenharmony_ci#
86ea96550Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
96ea96550Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
106ea96550Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
116ea96550Sopenharmony_ci# See the License for the specific language governing permissions and
126ea96550Sopenharmony_ci# limitations under the License.
136ea96550Sopenharmony_ci
146ea96550Sopenharmony_ciimport("//base/security/security_guard/security_guard.gni")
156ea96550Sopenharmony_ciimport("//build/ohos.gni")
166ea96550Sopenharmony_ci
176ea96550Sopenharmony_ciohos_shared_library("sg_collect_service") {
186ea96550Sopenharmony_ci  subsystem_name = "security"
196ea96550Sopenharmony_ci  part_name = "security_guard"
206ea96550Sopenharmony_ci  version_script = "sg_collect_service.map"
216ea96550Sopenharmony_ci
226ea96550Sopenharmony_ci  configs = [
236ea96550Sopenharmony_ci    "${sg_root_dir}/services/risk_classify:security_guard_model_configs",
246ea96550Sopenharmony_ci    "${sg_root_dir}/resource/config/build:coverage_flags",
256ea96550Sopenharmony_ci  ]
266ea96550Sopenharmony_ci
276ea96550Sopenharmony_ci  include_dirs = [
286ea96550Sopenharmony_ci    "${sg_root_dir}/interfaces/inner_api/collect/include",
296ea96550Sopenharmony_ci    "${sg_root_dir}/interfaces/inner_api/collector/include",
306ea96550Sopenharmony_ci    "${sg_root_dir}/interfaces/inner_api/obtaindata/include",
316ea96550Sopenharmony_ci    "${sg_root_dir}//interfaces/inner_api/common/include",
326ea96550Sopenharmony_ci    "${sg_root_dir}/services/bigdata/include",
336ea96550Sopenharmony_ci    "${sg_root_dir}/services/config_manager/include",
346ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/sa/include",
356ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/store/include",
366ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/constants/include",
376ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/json/include",
386ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/task_handler/include",
396ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/database/include",
406ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/log/include",
416ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/utils/include",
426ea96550Sopenharmony_ci    "${sg_root_dir}/services/security_collector/include",
436ea96550Sopenharmony_ci    "${sg_root_dir}/interfaces/inner_api/data_collect_manager/include",
446ea96550Sopenharmony_ci    "${sg_root_dir}/interfaces/inner_api/classify/include",
456ea96550Sopenharmony_ci    "${sg_root_dir}/services/risk_classify/model_manager/include",
466ea96550Sopenharmony_ci  ]
476ea96550Sopenharmony_ci
486ea96550Sopenharmony_ci  sources = [
496ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/collector/src/security_collector_subscribe_info.cpp",
506ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/json/src/json_cfg.cpp",
516ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/utils/src/security_guard_utils.cpp",
526ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/sa/acquire_data_callback_proxy.cpp",
536ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/sa/acquire_data_subscribe_manager.cpp",
546ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/sa/data_collect_manager_callback_proxy.cpp",
556ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/sa/data_collect_manager_service.cpp",
566ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/sa/data_collect_manager_stub.cpp",
576ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/sa/data_format.cpp",
586ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/sa/security_event_query_callback_proxy.cpp",
596ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/store/src/database_helper.cpp",
606ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/store/src/database_manager.cpp",
616ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/store/src/risk_event_rdb_helper.cpp",
626ea96550Sopenharmony_ci    "${sg_root_dir}/services/security_collector/src/collector_cfg_marshalling.cpp",
636ea96550Sopenharmony_ci    "${sg_root_dir}/services/security_collector/src/data_collection.cpp",
646ea96550Sopenharmony_ci    "${sg_root_dir}/services/security_collector/src/lib_loader.cpp",
656ea96550Sopenharmony_ci  ]
666ea96550Sopenharmony_ci
676ea96550Sopenharmony_ci  sanitize = {
686ea96550Sopenharmony_ci    integer_overflow = true
696ea96550Sopenharmony_ci    ubsan = true
706ea96550Sopenharmony_ci    boundary_sanitize = true
716ea96550Sopenharmony_ci    cfi = true
726ea96550Sopenharmony_ci    cfi_cross_dso = true
736ea96550Sopenharmony_ci    debug = false
746ea96550Sopenharmony_ci  }
756ea96550Sopenharmony_ci  branch_protector_ret = "pac_ret"
766ea96550Sopenharmony_ci
776ea96550Sopenharmony_ci  deps = [
786ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/collect:libsg_collect_sdk",
796ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/collector:libsg_collector_sdk",
806ea96550Sopenharmony_ci    "${sg_root_dir}/services/bigdata:sg_bigdata_stamp",
816ea96550Sopenharmony_ci    "${sg_root_dir}/services/config_manager:sg_config_manager",
826ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect:sg_collect_service_database",
836ea96550Sopenharmony_ci    "${sg_root_dir}/services/risk_classify/model_manager:sg_model_manager_stamp",
846ea96550Sopenharmony_ci  ]
856ea96550Sopenharmony_ci
866ea96550Sopenharmony_ci  external_deps = [
876ea96550Sopenharmony_ci    "access_token:libaccesstoken_sdk",
886ea96550Sopenharmony_ci    "access_token:libtokenid_sdk",
896ea96550Sopenharmony_ci    "c_utils:utils",
906ea96550Sopenharmony_ci    "ffrt:libffrt",
916ea96550Sopenharmony_ci    "hilog:libhilog",
926ea96550Sopenharmony_ci    "hisysevent:libhisysevent",
936ea96550Sopenharmony_ci    "hisysevent:libhisyseventmanager",
946ea96550Sopenharmony_ci    "ipc:ipc_core",
956ea96550Sopenharmony_ci    "json:nlohmann_json_static",
966ea96550Sopenharmony_ci    "relational_store:native_rdb",
976ea96550Sopenharmony_ci    "safwk:system_ability_fwk",
986ea96550Sopenharmony_ci    "samgr:samgr_proxy",
996ea96550Sopenharmony_ci  ]
1006ea96550Sopenharmony_ci}
1016ea96550Sopenharmony_ci
1026ea96550Sopenharmony_ciohos_shared_library("sg_collect_service_database") {
1036ea96550Sopenharmony_ci  subsystem_name = "security"
1046ea96550Sopenharmony_ci  part_name = "security_guard"
1056ea96550Sopenharmony_ci
1066ea96550Sopenharmony_ci  configs = [
1076ea96550Sopenharmony_ci    "${sg_root_dir}/services/risk_classify:security_guard_model_configs",
1086ea96550Sopenharmony_ci    "${sg_root_dir}/resource/config/build:coverage_flags",
1096ea96550Sopenharmony_ci  ]
1106ea96550Sopenharmony_ci
1116ea96550Sopenharmony_ci  include_dirs = [
1126ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/database/include",
1136ea96550Sopenharmony_ci    "${sg_root_dir}/frameworks/common/log/include",
1146ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/store/include",
1156ea96550Sopenharmony_ci    "${sg_root_dir}/interfaces/inner_api/data_collect_manager/include",
1166ea96550Sopenharmony_ci  ]
1176ea96550Sopenharmony_ci
1186ea96550Sopenharmony_ci  sources = [
1196ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/store/src/database.cpp",
1206ea96550Sopenharmony_ci    "${sg_root_dir}/services/data_collect/store/src/rdb_event_store_callback.cpp",
1216ea96550Sopenharmony_ci  ]
1226ea96550Sopenharmony_ci
1236ea96550Sopenharmony_ci  sanitize = {
1246ea96550Sopenharmony_ci    integer_overflow = true
1256ea96550Sopenharmony_ci    ubsan = true
1266ea96550Sopenharmony_ci    boundary_sanitize = true
1276ea96550Sopenharmony_ci    cfi = true
1286ea96550Sopenharmony_ci    cfi_cross_dso = true
1296ea96550Sopenharmony_ci    debug = false
1306ea96550Sopenharmony_ci  }
1316ea96550Sopenharmony_ci  branch_protector_ret = "pac_ret"
1326ea96550Sopenharmony_ci
1336ea96550Sopenharmony_ci  deps = []
1346ea96550Sopenharmony_ci
1356ea96550Sopenharmony_ci  external_deps = [
1366ea96550Sopenharmony_ci    "hilog:libhilog",
1376ea96550Sopenharmony_ci    "relational_store:native_rdb",
1386ea96550Sopenharmony_ci  ]
1396ea96550Sopenharmony_ci}
140