# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build/ohos.gni")
import("//foundation/aafwk/standard/aafwk.gni")

config("formmgr_config") {
  include_dirs = [
    "include",
    "//third_party/json/include",
    "//utils/system/safwk/native/include",

    #    "//base/miscservices/time/interfaces/innerkits/include",
  ]
}

group("fms_target") {
  deps = [ ":libfms" ]
}

ohos_shared_library("libfms") {
  include_dirs = [
    "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler/include",
    "//foundation/aafwk/standard/interfaces/innerkits/ability_manager/include",
    "//base/security/permission/interfaces/innerkits/permission_standard/permissionsdk/main/cpp/include",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/bundlemgr",
    "//foundation/appexecfwk/standard/common/log/include",
    "//foundation/aafwk/standard/frameworks/kits/appkit/native/ability_runtime",

    #  "//third_party/libuuid",
  ]
  sources = [
    "src/form_ability_connection.cpp",
    "src/form_acquire_connection.cpp",
    "src/form_ams_helper.cpp",
    "src/form_batch_delete_connection.cpp",
    "src/form_bms_helper.cpp",
    "src/form_cache_mgr.cpp",
    "src/form_cast_temp_connection.cpp",
    "src/form_data_mgr.cpp",
    "src/form_db_cache.cpp",
    "src/form_db_info.cpp",
    "src/form_delete_connection.cpp",
    "src/form_dump_mgr.cpp",
    "src/form_event_notify_connection.cpp",
    "src/form_host_callback.cpp",
    "src/form_host_record.cpp",
    "src/form_info_mgr.cpp",
    "src/form_info_storage_mgr.cpp",
    "src/form_item_info.cpp",
    "src/form_mgr_adapter.cpp",
    "src/form_mgr_service.cpp",
    "src/form_msg_event_connection.cpp",
    "src/form_provider_mgr.cpp",
    "src/form_refresh_connection.cpp",
    "src/form_refresh_limiter.cpp",
    "src/form_storage_mgr.cpp",
    "src/form_supply_callback.cpp",
    "src/form_sys_event_receiver.cpp",
    "src/form_task_mgr.cpp",
    "src/form_timer_mgr.cpp",
    "src/form_util.cpp",
    "src/kvstore_death_recipient_callback.cpp",
  ]

  defines = [
    "APP_LOG_TAG = \"FormMgrService\"",
    "LOG_DOMAIN = 0xD001120",
  ]

  configs = [
    ":formmgr_config",
    "//base/miscservices/time/services:time_service_config",
    "${aafwk_path}/interfaces/innerkits/form_manager:formmgr_sdk_config",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  deps = [
    "${appexecfwk_path}/common:libappexecfwk_common",
    "${appexecfwk_path}/libs/libeventhandler:libeventhandler_target",
    "//base/miscservices/time/services:time_service",
    "//base/notification/ans_standard/frameworks/wantagent:wantagent_innerkits",
    "//foundation/aafwk/standard/frameworks/kits/appkit:app_context",
    "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/distributeddata:distributeddata_inner",
    "//foundation/distributedschedule/dmsfwk/services/dtbschedmgr:distributedschedsvr",
    "//utils/native/base:utils",

    #  "//third_party/libuuid:libuuid_static",
  ]

  external_deps = [
    "ability_runtime:app_manager",
    "ability_runtime:base",
    "ability_runtime:want",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "ces_standard:cesfwk_core",
    "ces_standard:cesfwk_innerkits",
    "dmsfwk_standard:zuri",
    "form_runtime:form_manager",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "os_account_standard:libaccountkits",
    "os_account_standard:os_account_innerkits",
    "permission_standard:libpermissionsdk_standard",
    "power_manager_native:powermgr_client",
    "safwk:system_ability_fwk",
    "samgr_standard:samgr_proxy",
  ]

  subsystem_name = "aafwk"
  part_name = "form_runtime"
}
