# Copyright (C) 2021-2025 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("//base/security/huks/build/config.gni")
import("//build/ohos.gni")

group("huks_sdk_test") {
  testonly = true
  if (os_level == "standard" && support_jsapi) {
    if (huks_test_suite_running_environment == "system") {
      deps = [
        #"//base/security/huks/test:reliability",
        "//base/security/huks/test:unittest",
      ]
    }
  } else {
  }
}

group("huks_capi") {
  if (os_level == "standard") {
    # Include both original NDK library and the new external crypto library
    deps = [
      "//base/security/huks/interfaces/kits/c:huks_ndk",
    ]

    if (huks_enable_ukey_config == true) {
      deps += [ "//base/security/huks/interfaces/kits/c:huks_external_crypto" ]
    }
  }
}

group("huks_napi") {
  if (os_level == "standard") {
    if (support_jsapi) {
      # Include both original NAPI library and the new external crypto library
      deps = [
        "//base/security/huks/interfaces/kits/napi:huks",
      ]

      if (huks_enable_ukey_config == true) {
        deps += [ "//base/security/huks/interfaces/kits/napi:huksexternalcrypto_napi" ]
      }
    }
  }
}

group("huks_cjapi") {
  if (os_level == "standard") {
    deps = [ "//base/security/huks/interfaces/kits/cj:cj_huks_ffi" ]
  }
}

group("cipher_napi") {
  if (os_level == "standard") {
    if (support_jsapi) {
      deps =
          [ "//base/security/huks/frameworks/crypto_lite/js/napi:cipher_napi" ]
    }
  }
}

group("huks_crypto_extension") {
  if (os_level == "standard" && support_jsapi) {
    deps = [
      "//base/security/huks/interfaces/js/crypto_extension_module:cryptoextensionability_napi",
      "//base/security/huks/services/huks_standard/huks_service/extension/ability_native:crypto_extension_ability_native",
      "//base/security/huks/services/huks_standard/huks_service/extension/module_loader:crypto_extension_module",
    ]
  }
}

group("fwk_group") {
  if (os_level == "standard") {
    deps = [
      ":huks_cjapi",
      "//base/security/huks:cipher_napi",
      "//base/security/huks:huks_capi",
      "//base/security/huks:huks_napi",
      "//base/security/huks/frameworks/huks_standard/main:huks_standard_frameworks",
    ]
    if (huks_enable_ukey_config == true) {
      deps += [ "//base/security/huks:huks_crypto_extension" ]
    }
  } else if (os_level == "small") {
    deps = [
      "//base/security/huks/frameworks/crypto_lite/cipher:cipher_shared",
      "//base/security/huks/frameworks/crypto_lite/js/builtin:ace_kit_cipher",
      "//base/security/huks/frameworks/huks_lite:huks_sdk",
    ]
  } else {
    deps = [ "//base/security/huks/frameworks/huks_lite:huks_sdk" ]
  }
}

group("service_group") {
  if (os_level == "standard") {
    deps = [
      "//base/security/huks/services/huks_standard:huks_service",
      "//base/security/huks/services/huks_standard/huks_service/main/os_dependency/sa/sa_profile:huks_sa_profile",
    ]
    if (huks_enable_ukey_config == true) {
      deps += [ "//base/security/huks/services/huks_standard/huks_service/extension/ukey:libhuks_external_crypto_ext_core" ]
    }
    if (huks_use_rkc_in_standard) {
      deps += [ "//base/security/huks/services/huks_standard/huks_service/main:hks_compatibility_bin" ]
    }
    if (huks_security_level == "software") {
      deps += [ "//base/security/huks/services/huks_standard/huks_engine/main/core:huks_engine_core_standard" ]
    }
  } else if (os_level == "small") {
    deps = [ "//base/security/huks/frameworks/huks_lite:huks_server" ]
  }
}

group("huks_components") {
  deps = [
    "//base/security/huks:fwk_group",
    "//base/security/huks:service_group",
  ]
}