# 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")
import("//foundation/aafwk/standard/services/abilitymgr/abilitymgr.gni")
EVENT_DIR = "//base/notification/ces_standard/"

group("abilityms_target") {
  deps = [
    ":abilityms",
    ":ams_service_config",
  ]
}

group("unittest") {
  testonly = true

  deps = [ "test:unittest" ]
}

config("abilityms_config") {
  include_dirs = [
    "include/",
    "${EVENT_DIR}/frameworks/core/include",
    "${EVENT_DIR}/interfaces/innerkits/native/include",
    "${innerkits_path}/ability_manager/include",
    "${innerkits_path}/app_manager/include",
    "${innerkits_path}/base/include",
    "${innerkits_path}/want/include",
    "${innerkits_path}/want/include/ohos/aafwk/content",
    "${innerkits_path}/intent/include/ohos/aafwk/content",
    "${innerkits_path}/want/include/ohos/aafwk/content",
    "${services_path}/common/include",
    "//utils/native/base/include",
    "//utils/system/safwk/native/include",
    "//prebuilts/jdk/jdk8/linux-x86/include",
    "//prebuilts/jdk/jdk8/linux-x86/include/linux",
    "//third_party/json/include",
    "//foundation/aafwk/standard/frameworks/kits/ability/native/include",
    "//foundation/graphic/standard/interfaces/innerkits",
    "//foundation/multimedia/image_standard/interfaces/innerkits/include",
    "//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_rdb/include",
    "//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_appdatafwk/include",
    "//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_dataability/include",
    "//foundation/aafwk/standard/interfaces/innerkits/dataobs_manager/include",
    "//foundation/aafwk/standard/tools/aa/include",
    "//foundation/graphic/standard/interfaces/innerkits/wmservice",
    "//base/global/i18n_standard/frameworks/intl/include",
    "//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include",
    "//base/hiviewdfx/hiview/adapter/utility/include",
    "//base/account/os_account/frameworks/common/account_error/include",
    "//base/account/os_account/frameworks/common/database/include",
    "//base/account/os_account/frameworks/common/log/include",
    "//base/account/os_account/interfaces/innerkits/osaccount/native/include",
    "//base/hiviewdfx/hicollie/interfaces/native/innerkits/include",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
}

ohos_shared_library("abilityms") {
  sources = abilityms_files
  sources += [ "${services_path}/abilitymgr/src/sa_mgr_client.cpp" ]

  configs = [ ":abilityms_config" ]
  deps = [
    "${innerkits_path}/base:base",
    "${innerkits_path}/want:want",
    "//base/account/os_account/frameworks/osaccount/native:os_account_innerkits",
    "//base/global/i18n_standard/frameworks/intl:intl_util",
    "//base/hiviewdfx/hiview/adapter/utility:hiview_adapter_utility",
    "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime:ability_context_native",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
    "//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes",
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/ace/ace_engine/interfaces/innerkits/ui_service_manager:ui_service_mgr",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core",
    "//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
    "//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_dataability:native_dataability",
    "//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_rdb:native_rdb",
    "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk",
    "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "//foundation/multimedia/image_standard/interfaces/innerkits:image_native",
    "//third_party/libpng:libpng",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "ability_runtime:app_manager",
    "bytrace_standard:bytrace_core",
    "ces_standard:cesfwk_core",
    "ces_standard:cesfwk_innerkits",
    "device_manager_base:devicemanagersdk",
    "dsoftbus_standard:softbus_client",
    "hicollie_native:libhicollie",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "resmgr_standard:global_resmgr",
  ]

  public_deps = [ "//foundation/graphic/standard:libwmservice" ]

  subsystem_name = "aafwk"
  part_name = "ability_runtime"
}

ohos_prebuilt_etc("ams_service_config.json") {
  source = "//foundation/aafwk/standard/services/abilitymgr/resource/ams_service_config.json"
  subsystem_name = "aafwk"
  part_name = "ability_runtime"
}

group("ams_service_config") {
  deps = [ ":ams_service_config.json" ]
}
