# 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("//test/xts/tools/build/target_filter.gni")
import("test_targets.gni")

assert(XTS_SUITENAME != "")
if (build_xts == true && XTS_SUITENAME == "hats") {
  _subsystem_conf_path =
      "${root_build_dir}/build_configs/subsystem_info/src_subsystem_info.json"

  xts_target_filter("build_targets_std") {
    xts_suite_root_path = HATS_ROOT
    build_targets = all_test_targets
    subsystem_conf_path = _subsystem_conf_path
    extra_deps = [
      "${XTS_ROOT}/tools/others/query:libQuery",
      "testtools:deploy_testtools",
    ]
  }

  xts_target_filter("build_targets_ivi") {
    xts_suite_root_path = HATS_ROOT
    build_targets = all_test_targets_ivi
    subsystem_conf_path = _subsystem_conf_path
    extra_deps = [ "testtools:deploy_testtools" ]
  }

  xts_target_filter("build_targets_intellitv") {
    xts_suite_root_path = HATS_ROOT
    build_targets = all_test_targets_intellitv
    subsystem_conf_path = _subsystem_conf_path
    extra_deps = [ "testtools:deploy_testtools" ]
  }

  xts_target_filter("build_targets_wearable") {
    xts_suite_root_path = HATS_ROOT
    build_targets = all_test_targets_wearable
    subsystem_conf_path = _subsystem_conf_path
    extra_deps = [ "testtools:deploy_testtools" ]
  }
} else {
  print("HATS build is not enabled.")

  group("build_targets_std") {
    deps = []
  }

  group("build_targets_ivi") {
    deps = []
  }

  group("build_targets_intellitv") {
    deps = []
  }

  group("build_targets_wearable") {
    deps = []
  }
}

merge_xts_notice("hats_opensource_process") {
  target = "hats"
  deps = [ ":build_targets_std" ]
  if (make_osp) {
    deps += [ "//build/ohos/packages:open_source_package" ]
  }
}

ohos_test_suite("xts_hats") {
  deps = [ ":hats_opensource_process" ]
}

ohos_test_suite("hats_ivi") {
  deps = [ ":build_targets_ivi" ]
}

ohos_test_suite("hats_intellitv") {
  deps = [ ":build_targets_intellitv" ]
}

ohos_test_suite("hats_wearable") {
  deps = [ ":build_targets_wearable" ]
}