# Copyright (c) 2021-2026 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")

declare_args() {
  hisysevent_feature_support_usr_symlink = false
}

group("hisyseventcat_package") {
  # root of all the hiview dependencies
  deps = [ ":hisysevent" ]
}

ohos_executable("hisysevent") {
  branch_protector_ret = "pac_ret"

  cflags_cc = [ "-Os" ]

  install_enable = true

  include_dirs = [
    ".",
    "include",
  ]

  public_configs = [ "../../adapter/native/idl:sys_event_impl_config" ]

  deps = [
    "../../adapter/native/idl:sys_event_impl_client",
    "../../interfaces/native/innerkits/hisysevent:libhisysevent",
    "../../interfaces/native/innerkits/hisysevent_manager:libhisyseventmanager",
  ]

  external_deps = [
    "c_utils:utils",
    "hilog:libhilog",
    "ipc:ipc_single",
    "jsoncpp:jsoncpp",
    "safwk:system_ability_fwk",
    "samgr:samgr_proxy",
  ]

  sources = [
    "hisysevent_json_decorator.cpp",
    "hisysevent_tool.cpp",
    "hisysevent_tool_listener.cpp",
    "hisysevent_tool_query.cpp",
    "json_flatten_parser.cpp",
    "main.cpp",
  ]

  if (hisysevent_feature_support_usr_symlink) {
    symlink_target_name = [
      "../usr/bin/hisysevent",
    ]
  }

  part_name = "hisysevent"
  subsystem_name = "hiviewdfx"
}

group("unittest") {
  testonly = true
  deps = [ "test:unittest" ]
}