15ba71b47Sopenharmony_ci# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
25ba71b47Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
35ba71b47Sopenharmony_ci# you may not use this file except in compliance with the License.
45ba71b47Sopenharmony_ci# You may obtain a copy of the License at
55ba71b47Sopenharmony_ci#
65ba71b47Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
75ba71b47Sopenharmony_ci#
85ba71b47Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
95ba71b47Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
105ba71b47Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115ba71b47Sopenharmony_ci# See the License for the specific language governing permissions and
125ba71b47Sopenharmony_ci# limitations under the License.
135ba71b47Sopenharmony_ci
145ba71b47Sopenharmony_ciimport("//build/ohos.gni")
155ba71b47Sopenharmony_ciimport("//build/ohos_var.gni")
165ba71b47Sopenharmony_ciimport("../var.gni")
175ba71b47Sopenharmony_ci
185ba71b47Sopenharmony_ciconfig("distributed_store_config") {
195ba71b47Sopenharmony_ci  visibility = [ ":*" ]
205ba71b47Sopenharmony_ci  include_dirs =
215ba71b47Sopenharmony_ci      [ "//foundation/systemabilitymgr/samgr/services/samgr/native/include" ]
225ba71b47Sopenharmony_ci}
235ba71b47Sopenharmony_ci
245ba71b47Sopenharmony_ciconfig("sam_config") {
255ba71b47Sopenharmony_ci  # header file path
265ba71b47Sopenharmony_ci  include_dirs = [
275ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/include",
285ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/include/collect",
295ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/dfx/include",
305ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/utils/native/include",
315ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/lsamgr/include",
325ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/common/include",
335ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include",
345ba71b47Sopenharmony_ci  ]
355ba71b47Sopenharmony_ci}
365ba71b47Sopenharmony_ci
375ba71b47Sopenharmony_ciohos_executable("samgr") {
385ba71b47Sopenharmony_ci  sanitize = {
395ba71b47Sopenharmony_ci    cfi = true
405ba71b47Sopenharmony_ci    cfi_cross_dso = true
415ba71b47Sopenharmony_ci    debug = false
425ba71b47Sopenharmony_ci    cfi_no_nvcall = true
435ba71b47Sopenharmony_ci    blocklist = "../../../cfi_blocklist.txt"
445ba71b47Sopenharmony_ci  }
455ba71b47Sopenharmony_ci  branch_protector_ret = "pac_ret"
465ba71b47Sopenharmony_ci
475ba71b47Sopenharmony_ci  install_enable = true
485ba71b47Sopenharmony_ci  sources = [
495ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/frameworks/native/source/system_ability_load_callback_stub.cpp",
505ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/dfx/source/hisysevent_adapter.cpp",
515ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/lsamgr/src/local_ability_manager_proxy.cpp",
525ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/ability_death_recipient.cpp",
535ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/device_param_collect.cpp",
545ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/device_status_collect_manager.cpp",
555ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/device_timed_collect.cpp",
565ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/icollect_plugin.cpp",
575ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/ref_count_collect.cpp",
585ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/ffrt_handler.cpp",
595ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/main.cpp",
605ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/memory_guard.cpp",
615ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/rpc_callback_imp.cpp",
625ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/samgr_time_handler.cpp",
635ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/schedule/system_ability_event_handler.cpp",
645ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/schedule/system_ability_state_machine.cpp",
655ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/schedule/system_ability_state_scheduler.cpp",
665ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/system_ability_load_callback_proxy.cpp",
675ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/system_ability_manager.cpp",
685ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/system_ability_manager_dumper.cpp",
695ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/system_ability_manager_stub.cpp",
705ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/system_ability_manager_util.cpp",
715ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/system_ability_status_change_proxy.cpp",
725ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/services/samgr/native/source/system_process_status_change_proxy.cpp",
735ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/utils/native/source/tools.cpp",
745ba71b47Sopenharmony_ci  ]
755ba71b47Sopenharmony_ci
765ba71b47Sopenharmony_ci  deps = [
775ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/common:samgr_common",
785ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/dynamic_cache:dynamic_cache",
795ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/rust:samgr_rust",
805ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
815ba71b47Sopenharmony_ci  ]
825ba71b47Sopenharmony_ci
835ba71b47Sopenharmony_ci  configs = [
845ba71b47Sopenharmony_ci    ":sam_config",
855ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/common:config_samgr_common",
865ba71b47Sopenharmony_ci    "//foundation/systemabilitymgr/samgr/test/resource:coverage_flags",
875ba71b47Sopenharmony_ci    ":distributed_store_config",
885ba71b47Sopenharmony_ci  ]
895ba71b47Sopenharmony_ci  defines = []
905ba71b47Sopenharmony_ci  if (use_musl) {
915ba71b47Sopenharmony_ci    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
925ba71b47Sopenharmony_ci      defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ]
935ba71b47Sopenharmony_ci    }
945ba71b47Sopenharmony_ci  }
955ba71b47Sopenharmony_ci  if (is_standard_system) {
965ba71b47Sopenharmony_ci    external_deps = [
975ba71b47Sopenharmony_ci      "access_token:libaccesstoken_sdk",
985ba71b47Sopenharmony_ci      "c_utils:utils",
995ba71b47Sopenharmony_ci      "ffrt:libffrt",
1005ba71b47Sopenharmony_ci      "hilog:libhilog",
1015ba71b47Sopenharmony_ci      "hisysevent:libhisysevent",
1025ba71b47Sopenharmony_ci      "hitrace:hitrace_meter",
1035ba71b47Sopenharmony_ci      "init:libbeget_proxy",
1045ba71b47Sopenharmony_ci      "init:libbegetutil",
1055ba71b47Sopenharmony_ci      "ipc:ipc_core",
1065ba71b47Sopenharmony_ci      "ipc:libdbinder",
1075ba71b47Sopenharmony_ci      "safwk:system_ability_ondemand_reason",
1085ba71b47Sopenharmony_ci    ]
1095ba71b47Sopenharmony_ci
1105ba71b47Sopenharmony_ci    if (build_selinux) {
1115ba71b47Sopenharmony_ci      external_deps += [ "selinux_adapter:libservice_checker" ]
1125ba71b47Sopenharmony_ci      defines += [ "WITH_SELINUX" ]
1135ba71b47Sopenharmony_ci    }
1145ba71b47Sopenharmony_ci
1155ba71b47Sopenharmony_ci    if (hicollie_able) {
1165ba71b47Sopenharmony_ci      external_deps += [ "hicollie:libhicollie" ]
1175ba71b47Sopenharmony_ci      defines += [ "HICOLLIE_ENABLE" ]
1185ba71b47Sopenharmony_ci    }
1195ba71b47Sopenharmony_ci
1205ba71b47Sopenharmony_ci    if (support_device_manager) {
1215ba71b47Sopenharmony_ci      sources += [ "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/device_networking_collect.cpp" ]
1225ba71b47Sopenharmony_ci      external_deps += [ "device_manager:devicemanagersdk" ]
1235ba71b47Sopenharmony_ci      defines += [ "SUPPORT_DEVICE_MANAGER" ]
1245ba71b47Sopenharmony_ci    }
1255ba71b47Sopenharmony_ci
1265ba71b47Sopenharmony_ci    if (support_common_event) {
1275ba71b47Sopenharmony_ci      sources += [
1285ba71b47Sopenharmony_ci        "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/common_event_collect.cpp",
1295ba71b47Sopenharmony_ci        "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/device_switch_collect.cpp",
1305ba71b47Sopenharmony_ci      ]
1315ba71b47Sopenharmony_ci      external_deps += [
1325ba71b47Sopenharmony_ci        "ability_base:want",
1335ba71b47Sopenharmony_ci        "common_event_service:cesfwk_innerkits",
1345ba71b47Sopenharmony_ci      ]
1355ba71b47Sopenharmony_ci      defines += [
1365ba71b47Sopenharmony_ci        "SUPPORT_COMMON_EVENT",
1375ba71b47Sopenharmony_ci        "SUPPORT_SWITCH_COLLECT",
1385ba71b47Sopenharmony_ci      ]
1395ba71b47Sopenharmony_ci    }
1405ba71b47Sopenharmony_ci
1415ba71b47Sopenharmony_ci    if (preferences_enable) {
1425ba71b47Sopenharmony_ci      sources += [ "//foundation/systemabilitymgr/samgr/services/samgr/native/source/collect/device_timed_collect_tool.cpp" ]
1435ba71b47Sopenharmony_ci      external_deps += [ "preferences:native_preferences" ]
1445ba71b47Sopenharmony_ci      defines += [ "PREFERENCES_ENABLE" ]
1455ba71b47Sopenharmony_ci    }
1465ba71b47Sopenharmony_ci    part_name = "samgr"
1475ba71b47Sopenharmony_ci  }
1485ba71b47Sopenharmony_ci
1495ba71b47Sopenharmony_ci  subsystem_name = "systemabilitymgr"
1505ba71b47Sopenharmony_ci}
151