# 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/test.gni")
import("//foundation/aafwk/standard/aafwk.gni")

config("ability_command_config") {
  include_dirs = [
    "include",
    "//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include",
    "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/appmgr",
    "//utils/system/safwk/native/include",
    "//third_party/jsoncpp/include",
  ]
}

ohos_source_set("tools_aa_source_set") {
  sources = [
    "src/ability_command.cpp",
    "src/shell_command.cpp",
  ]

  public_configs = [
    ":ability_command_config",
    "${services_path}/abilitymgr:abilityms_config",
    "${services_path}/common:common_config",
  ]

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

  deps = [
    "${aafwk_path}/interfaces/innerkits/ability_manager:ability_manager",
    "${appexecfwk_path}/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
    "${appexecfwk_path}/interfaces/innerkits/appexecfwk_core:appexecfwk_core",
    "${appexecfwk_path}/interfaces/innerkits/libeventhandler:libeventhandler",
    "${innerkits_path}/base:base",
    "${innerkits_path}/want:want",
    "${services_path}/abilitymgr:abilityms",
    "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]
}

ohos_executable("aa") {
  sources = [ "src/main.cpp" ]

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

  deps = [
    ":tools_aa_source_set",
    "${appexecfwk_path}/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
    "${innerkits_path}/want:want",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
  ]

  install_enable = true

  subsystem_name = "aafwk"
  part_name = "aafwk_standard"
}

group("tools_aa") {
  deps = [ ":aa" ]
}
