# 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/ability/ability_runtime/ability_runtime.gni")

config("ability_context_public_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context",
    "${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime",
    "${ability_runtime_path}/interfaces/kits/native/ability/ability_runtime/context",
    "${ability_runtime_path}/interfaces/kits/native/ability/native",
  ]

  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }
  if (ability_runtime_graphics) {
    defines = [ "SUPPORT_GRAPHICS" ]
  }
}

ohos_shared_library("ability_context_native") {
  public_configs = [ ":ability_context_public_config" ]

  sources = [
    "ability_runtime/ability_connection.cpp",
    "ability_runtime/ability_context_impl.cpp",
    "ability_runtime/authorization_result.cpp",
    "ability_runtime/connection_manager.cpp",
    "ability_runtime/js_extension_context.cpp",
    "ability_runtime/local_call_container.cpp",
    "ability_runtime/local_call_record.cpp",
  ]

  deps = [
    "${ability_runtime_native_path}/appkit:app_context",
    "${ability_runtime_native_path}/appkit:app_context_utils",
  ]

  external_deps = [
    "ability_base:want",
    "ability_runtime:ability_manager",
    "ability_runtime:runtime",
    "access_token:libaccesstoken_sdk",
    "access_token:libtoken_callback_sdk",
    "c_utils:utils",
    "faultloggerd:lib_dfx_dump_catcher",
    "hichecker_native:libhichecker",
    "hitrace_native:hitrace_meter",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "napi:ace_napi",
  ]

  subsystem_name = "ability"
  part_name = "ability_runtime"
}
