# Copyright (c) 2021-2022 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("appmgr_sdk_config") {
  include_dirs = [
    "include/appmgr",
    "${ability_base_innerapi_path}/configuration/include",
    "${kits_path}/ability/native/include",
    "${innerkits_path}/ability_manager/include",
    "${bundlefwk_inner_api_path}/appexecfwk_base/include",
  ]
  defines = [ "ABILITY_COMMAND_FOR_TEST" ]
}

config("appmgr_core_config") {
  include_dirs = [ "include" ]
  defines = [ "ABILITY_COMMAND_FOR_TEST" ]
}

ohos_shared_library("app_manager") {
  include_dirs = [
    "//third_party/json/include",
    "${aafwk_path}/services/appmgr/include",
    "${aafwk_path}/services/common/include",
  ]

  sources = [
    "src/appmgr/ability_controller_proxy.cpp",
    "src/appmgr/ability_controller_stub.cpp",
    "src/appmgr/ability_state_data.cpp",
    "src/appmgr/ams_mgr_proxy.cpp",
    "src/appmgr/ams_mgr_stub.cpp",
    "src/appmgr/app_launch_data.cpp",
    "src/appmgr/app_mgr_client.cpp",
    "src/appmgr/app_mgr_proxy.cpp",
    "src/appmgr/app_mgr_stub.cpp",
    "src/appmgr/app_process_data.cpp",
    "src/appmgr/app_record_id.cpp",
    "src/appmgr/app_scheduler_host.cpp",
    "src/appmgr/app_scheduler_proxy.cpp",
    "src/appmgr/app_service_manager.cpp",
    "src/appmgr/app_state_callback_host.cpp",
    "src/appmgr/app_state_callback_proxy.cpp",
    "src/appmgr/app_state_data.cpp",
    "src/appmgr/app_task_info.cpp",
    "src/appmgr/application_state_observer_proxy.cpp",
    "src/appmgr/application_state_observer_stub.cpp",
    "src/appmgr/priority_object.cpp",
    "src/appmgr/process_data.cpp",
    "src/appmgr/process_info.cpp",
    "src/appmgr/profile.cpp",
    "src/appmgr/render_scheduler_host.cpp",
    "src/appmgr/render_scheduler_proxy.cpp",
    "src/appmgr/running_process_info.cpp",
    "src/appmgr/start_specified_ability_response_proxy.cpp",
    "src/appmgr/start_specified_ability_response_stub.cpp",
    "src/appmgr/system_memory_attr.cpp",
  ]

  public_configs = [
    ":appmgr_core_config",
    ":appmgr_sdk_config",
  ]

  defines = [
    "AMS_LOG_TAG = \"AppexecfwkCore\"",
    "AMS_LOG_DOMAIN = 0xD001100",
  ]
  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  deps = []

  external_deps = [
    "ability_base:base",
    "ability_base:configuration",
    "ability_base:want",
    "bundle_framework:appexecfwk_base",
    "common_event_service:cesfwk_core",
    "common_event_service:cesfwk_innerkits",
    "hitrace_native:hitrace_meter",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "samgr_standard:samgr_proxy",
    "utils_base:utils",
  ]

  subsystem_name = "aafwk"
  part_name = "ability_runtime"
}
