# 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")
SO_DIR = "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime"
INNERKITS_DIR = "//foundation/aafwk/standard/interfaces/innerkits"
APPKIT_DIR = "//foundation/aafwk/standard/frameworks/kits"

config("ability_context_public_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "${SO_DIR}/include",
    "${APPKIT_DIR}/appkit/native/ability_runtime",
    "${APPKIT_DIR}/appkit/native/ability_runtime/context",
  ]

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

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

  sources = [
    "${SO_DIR}/src/ability_connection.cpp",
    "${SO_DIR}/src/ability_context_impl.cpp",
    "${SO_DIR}/src/connection_manager.cpp",
    "${SO_DIR}/src/js_extension_context.cpp",
    "${SO_DIR}/src/local_call_container.cpp",
    "${SO_DIR}/src/local_call_record.cpp",
  ]

  deps = [
    "${APPKIT_DIR}/appkit:app_context",
    "${INNERKITS_DIR}/ability_manager:ability_manager",
    "${INNERKITS_DIR}/want:want",
    "//foundation/ace/napi:ace_napi",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
  ]

  external_deps = [
    "ability_runtime:app_manager",
    "ability_runtime:runtime",
    "bytrace_standard:bytrace_core",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "utils_base:utils",
  ]

  subsystem_name = "aafwk"
  part_name = "ability_runtime"
}
