153c3577eSopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd.
253c3577eSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
353c3577eSopenharmony_ci# you may not use this file except in compliance with the License.
453c3577eSopenharmony_ci# You may obtain a copy of the License at
553c3577eSopenharmony_ci#
653c3577eSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
753c3577eSopenharmony_ci#
853c3577eSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
953c3577eSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1053c3577eSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1153c3577eSopenharmony_ci# See the License for the specific language governing permissions and
1253c3577eSopenharmony_ci# limitations under the License.
1353c3577eSopenharmony_ciimport("//build/ohos.gni")
1453c3577eSopenharmony_ciimport("//build/ohos_var.gni")
1553c3577eSopenharmony_ciimport("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni")
1653c3577eSopenharmony_ci
1753c3577eSopenharmony_cigroup("build_module") {
1853c3577eSopenharmony_ci  deps = [ ":distributeddataservice" ]
1953c3577eSopenharmony_ci  if (build_public_version) {
2053c3577eSopenharmony_ci    deps += [ ":distributeddata_profile" ]
2153c3577eSopenharmony_ci    deps += [ ":distributed_data.cfg" ]
2253c3577eSopenharmony_ci  }
2353c3577eSopenharmony_ci}
2453c3577eSopenharmony_ci
2553c3577eSopenharmony_ciohos_prebuilt_etc("distributed_data.cfg") {
2653c3577eSopenharmony_ci  source = "distributed_data.cfg"
2753c3577eSopenharmony_ci  relative_install_dir = "init"
2853c3577eSopenharmony_ci  subsystem_name = "distributeddatamgr"
2953c3577eSopenharmony_ci  part_name = "datamgr_service"
3053c3577eSopenharmony_ci}
3153c3577eSopenharmony_ci
3253c3577eSopenharmony_ciohos_sa_profile("distributeddata_profile") {
3353c3577eSopenharmony_ci  sources = [ "../sa_profile/1301.json" ]
3453c3577eSopenharmony_ci
3553c3577eSopenharmony_ci  part_name = "datamgr_service"
3653c3577eSopenharmony_ci}
3753c3577eSopenharmony_ci
3853c3577eSopenharmony_ciconfig("module_private_config") {
3953c3577eSopenharmony_ci  visibility = [ ":*" ]
4053c3577eSopenharmony_ci  include_dirs = [
4153c3577eSopenharmony_ci    "${kv_store_common_path}",
4253c3577eSopenharmony_ci    "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include",
4353c3577eSopenharmony_ci    "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include",
4453c3577eSopenharmony_ci    "${data_service_path}/adapter/include/account",
4553c3577eSopenharmony_ci    "${data_service_path}/adapter/include/permission",
4653c3577eSopenharmony_ci    "${data_service_path}/adapter/include/installer",
4753c3577eSopenharmony_ci    "${data_service_path}/adapter/include/broadcaster",
4853c3577eSopenharmony_ci    "${data_service_path}/adapter/include/utils",
4953c3577eSopenharmony_ci    "${data_service_path}/adapter/include/dfx",
5053c3577eSopenharmony_ci    "${data_service_path}/adapter/include",
5153c3577eSopenharmony_ci    "${data_service_path}/app/src/session_manager",
5253c3577eSopenharmony_ci    "${data_service_path}/framework/include",
5353c3577eSopenharmony_ci    "${data_service_path}/service/bootstrap/include",
5453c3577eSopenharmony_ci    "${data_service_path}/service/common",
5553c3577eSopenharmony_ci    "${data_service_path}/service/config/include",
5653c3577eSopenharmony_ci    "${data_service_path}/service/crypto/include",
5753c3577eSopenharmony_ci    "${data_service_path}/service/directory/include",
5853c3577eSopenharmony_ci    "${data_service_path}/service/permission/include",
5953c3577eSopenharmony_ci    "${data_service_path}/service/matrix/include",
6053c3577eSopenharmony_ci    "${data_service_path}/service/backup/include",
6153c3577eSopenharmony_ci    "${data_service_path}/service/app_id_mapping/include",
6253c3577eSopenharmony_ci    "${data_service_path}/service/kvdb",
6353c3577eSopenharmony_ci    "${data_service_path}/service/waterversion",
6453c3577eSopenharmony_ci    "${data_service_path}/service/dumper/include",
6553c3577eSopenharmony_ci
6653c3577eSopenharmony_ci    # for ipc_core interfaces.
6753c3577eSopenharmony_ci    "include",
6853c3577eSopenharmony_ci    "src",
6953c3577eSopenharmony_ci    "src/security",
7053c3577eSopenharmony_ci    "src/backup_rule/include",
7153c3577eSopenharmony_ci  ]
7253c3577eSopenharmony_ci
7353c3577eSopenharmony_ci  cflags = [
7453c3577eSopenharmony_ci    "-Wno-multichar",
7553c3577eSopenharmony_ci    "-D_LIBCPP_HAS_COND_CLOCKWAIT",
7653c3577eSopenharmony_ci  ]
7753c3577eSopenharmony_ci
7853c3577eSopenharmony_ci  cflags_cc = [ "-fvisibility=hidden" ]
7953c3577eSopenharmony_ci}
8053c3577eSopenharmony_ci
8153c3577eSopenharmony_ciohos_shared_library("distributeddataservice") {
8253c3577eSopenharmony_ci  branch_protector_ret = "pac_ret"
8353c3577eSopenharmony_ci  sanitize = {
8453c3577eSopenharmony_ci    cfi = true
8553c3577eSopenharmony_ci    cfi_cross_dso = true
8653c3577eSopenharmony_ci    debug = false
8753c3577eSopenharmony_ci    boundary_sanitize = true
8853c3577eSopenharmony_ci    ubsan = true
8953c3577eSopenharmony_ci  }
9053c3577eSopenharmony_ci  sources = [
9153c3577eSopenharmony_ci    "${data_service_path}/service/common/xcollie.cpp",
9253c3577eSopenharmony_ci    "src/db_info_handle_impl.cpp",
9353c3577eSopenharmony_ci    "src/feature_stub_impl.cpp",
9453c3577eSopenharmony_ci    "src/kvstore_account_observer.cpp",
9553c3577eSopenharmony_ci    "src/kvstore_data_service.cpp",
9653c3577eSopenharmony_ci    "src/kvstore_data_service_stub.cpp",
9753c3577eSopenharmony_ci    "src/kvstore_device_listener.cpp",
9853c3577eSopenharmony_ci    "src/kvstore_meta_manager.cpp",
9953c3577eSopenharmony_ci    "src/security/security.cpp",
10053c3577eSopenharmony_ci    "src/security/sensitive.cpp",
10153c3577eSopenharmony_ci    "src/session_manager/route_head_handler_impl.cpp",
10253c3577eSopenharmony_ci    "src/session_manager/session_manager.cpp",
10353c3577eSopenharmony_ci    "src/session_manager/upgrade_manager.cpp",
10453c3577eSopenharmony_ci    "src/task_manager.cpp",
10553c3577eSopenharmony_ci  ]
10653c3577eSopenharmony_ci
10753c3577eSopenharmony_ci  if (datamgr_service_power) {
10853c3577eSopenharmony_ci    variable_sources = [
10953c3577eSopenharmony_ci      "src/backup_rule/src/charging.cpp",
11053c3577eSopenharmony_ci      "src/backup_rule/src/screen_off.cpp",
11153c3577eSopenharmony_ci    ]
11253c3577eSopenharmony_ci    sources += variable_sources
11353c3577eSopenharmony_ci  }
11453c3577eSopenharmony_ci
11553c3577eSopenharmony_ci  configs = [ ":module_private_config" ]
11653c3577eSopenharmony_ci  deps = [
11753c3577eSopenharmony_ci    "${data_service_path}/adapter:distributeddata_adapter",
11853c3577eSopenharmony_ci    "${data_service_path}/adapter/broadcaster:distributeddata_broadcaster_static",
11953c3577eSopenharmony_ci    "${data_service_path}/adapter/utils:distributeddata_utils_static",
12053c3577eSopenharmony_ci    "${data_service_path}/app/src/checker:distributeddata_checker_static",
12153c3577eSopenharmony_ci    "${data_service_path}/app/src/flowctrl_manager:distributeddata_flowctrl_static",
12253c3577eSopenharmony_ci    "${data_service_path}/app/src/installer:distributeddata_installer_static",
12353c3577eSopenharmony_ci    "${data_service_path}/framework:distributeddatasvcfwk",
12453c3577eSopenharmony_ci    "${data_service_path}/service:distributeddatasvc",
12553c3577eSopenharmony_ci  ]
12653c3577eSopenharmony_ci
12753c3577eSopenharmony_ci  external_deps = [
12853c3577eSopenharmony_ci    "ability_base:base",
12953c3577eSopenharmony_ci    "ability_base:want",
13053c3577eSopenharmony_ci    "access_token:libaccesstoken_sdk",
13153c3577eSopenharmony_ci    "bundle_framework:appexecfwk_base",
13253c3577eSopenharmony_ci    "bundle_framework:appexecfwk_core",
13353c3577eSopenharmony_ci    "c_utils:utils",
13453c3577eSopenharmony_ci    "dataclassification:data_transit_mgr",
13553c3577eSopenharmony_ci    "file_api:securitylabel",
13653c3577eSopenharmony_ci    "hicollie:libhicollie",
13753c3577eSopenharmony_ci    "hilog:libhilog",
13853c3577eSopenharmony_ci    "hisysevent:libhisysevent",
13953c3577eSopenharmony_ci    "hitrace:hitrace_meter",
14053c3577eSopenharmony_ci    "hitrace:libhitracechain",
14153c3577eSopenharmony_ci    "ipc:ipc_core",
14253c3577eSopenharmony_ci    "json:nlohmann_json_static",
14353c3577eSopenharmony_ci    "kv_store:distributeddata_inner",
14453c3577eSopenharmony_ci    "kv_store:distributeddata_mgr",
14553c3577eSopenharmony_ci    "kv_store:distributeddb",
14653c3577eSopenharmony_ci    "memmgr:memmgrclient",
14753c3577eSopenharmony_ci    "safwk:system_ability_fwk",
14853c3577eSopenharmony_ci    "samgr:samgr_proxy",
14953c3577eSopenharmony_ci  ]
15053c3577eSopenharmony_ci
15153c3577eSopenharmony_ci  if (datamgr_service_power) {
15253c3577eSopenharmony_ci    external_deps += [
15353c3577eSopenharmony_ci      "battery_manager:batterysrv_client",
15453c3577eSopenharmony_ci      "power_manager:powermgr_client",
15553c3577eSopenharmony_ci    ]
15653c3577eSopenharmony_ci    defines = [ "SUPPORT_POWER" ]
15753c3577eSopenharmony_ci  }
15853c3577eSopenharmony_ci
15953c3577eSopenharmony_ci  subsystem_name = "distributeddatamgr"
16053c3577eSopenharmony_ci  part_name = "datamgr_service"
16153c3577eSopenharmony_ci  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
16253c3577eSopenharmony_ci}
163