# Copyright (c) 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("string_utils_config") {
  include_dirs = [ "utils/include" ]
}

ohos_source_set("string_utils") {
  if (is_mingw) {
    defines = [ "WINDOWS_PLATFORM" ]
  } else {
    defines = [ "MAC_PLATFORM" ]
  }

  sources = [ "utils/src/file_path_utils.cpp" ]

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

  public_configs = [
    ":string_utils_config",
    "${ability_runtime_services_path}/common:common_config",
  ]

  subsystem_name = "ability"
  part_name = "ability_runtime"
}

config("ability_extractor_config") {
  include_dirs = [
    "utils/include",
    "//third_party/zlib/contrib/minizip",
    "//third_party/zlib",
  ]
}

ohos_source_set("runtime_extractor") {
  sources = [
    "utils/src/runtime_extractor.cpp",
    "utils/src/zip_file.cpp",
  ]

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

  deps = [ ":string_utils" ]

  public_configs = [
    ":ability_extractor_config",
    "${ability_runtime_services_path}/common:common_config",
  ]

  external_deps = [
    "c_utils:utils",
    "hiviewdfx_hilog_native:libhilog",
  ]

  subsystem_name = "ability"
  part_name = "ability_runtime"
}
