# 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")

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

    xts_target_filter("build_targets_std") {
      xts_suite_root_path = ACTS_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 = ACTS_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 = ACTS_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 = ACTS_ROOT
      build_targets = all_test_targets_wearable
      subsystem_conf_path = _subsystem_conf_path
      extra_deps = [
        "testtools:deploy_testtools",
      ]
    }
  } else {
    print("ACTS 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("acts_opensource_process") {
    target = "acts"
    deps = [ ":build_targets_std" ]
    if (make_osp) {
      deps += [ "//build/ohos/packages:open_source_package" ]
    }
  }

  ohos_test_suite("xts_acts") {
    deps = [ ":acts_opensource_process" ]
  }

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

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

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